diff --git a/README.md b/README.md index 67489521b..33e21e537 100644 --- a/README.md +++ b/README.md @@ -154,7 +154,6 @@ * [`toDecimalMark`](#todecimalmark) * [`toOrdinalSuffix`](#toordinalsuffix) * [`UUIDGenerator`](#uuidgenerator) -* [`validateEmail`](#validateemail) * [`validateNumber`](#validatenumber) ## Array @@ -355,8 +354,8 @@ Returns every nth element in an array. Use `Array.filter()` to create a new array that contains every nth element of a given array. ```js -const everyNth = (arr, nth) => arr.filter((e, i) => i % nth === 0); -// everyNth([1,2,3,4,5,6], 2) -> [ 1, 3, 5 ] +const everyNth = (arr, nth) => arr.filter((e, i) => i % nth === nth - 1); +// everyNth([1,2,3,4,5,6], 2) -> [ 2, 4, 6 ] ``` [⬆ back to top](#table-of-contents) @@ -2167,21 +2166,6 @@ const UUIDGenerator = () => [⬆ back to top](#table-of-contents) -### validateEmail - -Returns `true` if the given string is a valid email, `false` otherwise. - -Use a regular expression to check if the email is valid. -Returns `true` if email is valid, `false` if not. - -```js -const validateEmail = str => - /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(str); -// validateEmail(mymail@gmail.com) -> true -``` - -[⬆ back to top](#table-of-contents) - ### validateNumber Returns `true` if the given value is a number, `false` otherwise. diff --git a/docs/index.html b/docs/index.html index 5ce2df18c..3b1a8b42c 100644 --- a/docs/index.html +++ b/docs/index.html @@ -185,7 +185,6 @@ toDecimalMark toOrdinalSuffix UUIDGenerator -validateEmail validateNumber
 

Array

@@ -290,8 +289,8 @@ Returns the remaining elements.


everyNth

Returns every nth element in an array.

Use Array.filter() to create a new array that contains every nth element of a given array.

-
const everyNth = (arr, nth) => arr.filter((e, i) => i % nth === 0);
-// everyNth([1,2,3,4,5,6], 2) -> [ 1, 3, 5 ]
+
const everyNth = (arr, nth) => arr.filter((e, i) => i % nth === nth - 1);
+// everyNth([1,2,3,4,5,6], 2) -> [ 2, 4, 6 ]
 

filterNonUnique

Filters out the non-unique values in an array.

@@ -1318,14 +1317,6 @@ If digit is found in teens pattern, use teens ordinal.

); // UUIDGenerator() -> '7982fcfe-5721-4632-bede-6000885be57d'
-

validateEmail

-

Returns true if the given string is a valid email, false otherwise.

-

Use a regular expression to check if the email is valid. -Returns true if email is valid, false if not.

-
const validateEmail = str =>
-  /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(str);
-// validateEmail(mymail@gmail.com) -> true
-

validateNumber

Returns true if the given value is a number, false otherwise.

Use !isNaN in combination with parseFloat() to check if the argument is a number. diff --git a/tag_database b/tag_database index 6e965bf45..78da7daaf 100644 --- a/tag_database +++ b/tag_database @@ -119,7 +119,6 @@ truncateString:string truthCheckCollection:object union:array UUIDGenerator:utility -validateEmail:utility validateNumber:utility without:array words:string