diff --git a/README.md b/README.md
index 79b6426b4..4a84f97cb 100644
--- a/README.md
+++ b/README.md
@@ -85,7 +85,7 @@ Here is a list of the validators currently available.
Validator | Description
--------------------------------------- | --------------------------------------
-**contains(str, seed [, options])** | check if the string contains the seed.
`options` is an object that defaults to `{ ignoreCase: false, minOccurrences: 1 }`.
Options:
`ignoreCase`: Ignore case when doing comparison, default false.
`minOccurences`: Minimum number of occurrences for the seed in the string. Defaults to 1.
+**contains(str, seed [, options])** | check if the string contains the seed.
`options` is an object that defaults to `{ ignoreCase: false, minOccurrences: 1 }`.
Options:
`ignoreCase`: Ignore case when doing comparison, default false.
`minOccurrences`: Minimum number of occurrences for the seed in the string. Defaults to 1.
**equals(str, comparison)** | check if the string matches the comparison.
**isAbaRouting(str)** | check if the string is an ABA routing number for US bank account / cheque.
**isAfter(str [, options])** | check if the string is a date that is after the specified date.
`options` is an object that defaults to `{ comparisonDate: Date().toString() }`.
**Options:**
`comparisonDate`: Date to compare to. Defaults to `Date().toString()` (now).
diff --git a/src/lib/contains.js b/src/lib/contains.js
index 7be314b04..8e716c4be 100644
--- a/src/lib/contains.js
+++ b/src/lib/contains.js
@@ -2,14 +2,14 @@ import assertString from './util/assertString';
import toString from './util/toString';
import merge from './util/merge';
-const defaulContainsOptions = {
+const defaultContainsOptions = {
ignoreCase: false,
minOccurrences: 1,
};
export default function contains(str, elem, options) {
assertString(str);
- options = merge(options, defaulContainsOptions);
+ options = merge(options, defaultContainsOptions);
if (options.ignoreCase) {
return str.toLowerCase().split(toString(elem).toLowerCase()).length > options.minOccurrences;
diff --git a/src/lib/isEAN.js b/src/lib/isEAN.js
index 968c385dd..731932ad3 100644
--- a/src/lib/isEAN.js
+++ b/src/lib/isEAN.js
@@ -15,9 +15,9 @@
import assertString from './util/assertString';
/**
- * Define EAN Lenghts; 8 for EAN-8; 13 for EAN-13; 14 for EAN-14
+ * Define EAN Lengths; 8 for EAN-8; 13 for EAN-13; 14 for EAN-14
* and Regular Expression for valid EANs (EAN-8, EAN-13, EAN-14),
- * with exact numberic matching of 8 or 13 or 14 digits [0-9]
+ * with exact numeric matching of 8 or 13 or 14 digits [0-9]
*/
const LENGTH_EAN_8 = 8;
const LENGTH_EAN_14 = 14;
diff --git a/src/lib/isIMEI.js b/src/lib/isIMEI.js
index fb97d4924..984b4fb88 100644
--- a/src/lib/isIMEI.js
+++ b/src/lib/isIMEI.js
@@ -1,8 +1,8 @@
import assertString from './util/assertString';
-let imeiRegexWithoutHypens = /^[0-9]{15}$/;
-let imeiRegexWithHypens = /^\d{2}-\d{6}-\d{6}-\d{1}$/;
+let imeiRegexWithoutHyphens = /^[0-9]{15}$/;
+let imeiRegexWithHyphens = /^\d{2}-\d{6}-\d{6}-\d{1}$/;
export default function isIMEI(str, options) {
@@ -11,10 +11,10 @@ export default function isIMEI(str, options) {
// default regex for checking imei is the one without hyphens
- let imeiRegex = imeiRegexWithoutHypens;
+ let imeiRegex = imeiRegexWithoutHyphens;
if (options.allow_hyphens) {
- imeiRegex = imeiRegexWithHypens;
+ imeiRegex = imeiRegexWithHyphens;
}
diff --git a/src/lib/isMimeType.js b/src/lib/isMimeType.js
index 4081117af..820fa4dc2 100644
--- a/src/lib/isMimeType.js
+++ b/src/lib/isMimeType.js
@@ -4,18 +4,18 @@ import assertString from './util/assertString';
Checks if the provided string matches to a correct Media type format (MIME type)
This function only checks is the string format follows the
- etablished rules by the according RFC specifications.
+ established rules by the according RFC specifications.
This function supports 'charset' in textual media types
(https://tools.ietf.org/html/rfc6657).
This function does not check against all the media types listed
by the IANA (https://www.iana.org/assignments/media-types/media-types.xhtml)
because of lightness purposes : it would require to include
- all these MIME types in this librairy, which would weigh it
+ all these MIME types in this library, which would weigh it
significantly. This kind of effort maybe is not worth for the use that
- this function has in this entire librairy.
+ this function has in this entire library.
- More informations in the RFC specifications :
+ More information in the RFC specifications :
- https://tools.ietf.org/html/rfc2045
- https://tools.ietf.org/html/rfc2046
- https://tools.ietf.org/html/rfc7231#section-3.1.1.1
diff --git a/src/lib/isTaxID.js b/src/lib/isTaxID.js
index d13229f69..5e5f8cb5b 100644
--- a/src/lib/isTaxID.js
+++ b/src/lib/isTaxID.js
@@ -174,24 +174,24 @@ function deDeCheck(tin) {
const digits = tin.split('').map(a => parseInt(a, 10));
// Fill array with strings of number positions
- let occurences = [];
+ let occurrences = [];
for (let i = 0; i < digits.length - 1; i++) {
- occurences.push('');
+ occurrences.push('');
for (let j = 0; j < digits.length - 1; j++) {
if (digits[i] === digits[j]) {
- occurences[i] += j;
+ occurrences[i] += j;
}
}
}
- // Remove digits with one occurence and test for only one duplicate/triplicate
- occurences = occurences.filter(a => a.length > 1);
- if (occurences.length !== 2 && occurences.length !== 3) { return false; }
+ // Remove digits with one occurrence and test for only one duplicate/triplicate
+ occurrences = occurrences.filter(a => a.length > 1);
+ if (occurrences.length !== 2 && occurrences.length !== 3) { return false; }
// In case of triplicate value only two digits are allowed next to each other
- if (occurences[0].length === 3) {
- const trip_locations = occurences[0].split('').map(a => parseInt(a, 10));
- let recurrent = 0; // Amount of neighbour occurences
+ if (occurrences[0].length === 3) {
+ const trip_locations = occurrences[0].split('').map(a => parseInt(a, 10));
+ let recurrent = 0; // Amount of neighbor occurrences
for (let i = 0; i < trip_locations.length - 1; i++) {
if (trip_locations[i] + 1 === trip_locations[i + 1]) {
recurrent += 1;
@@ -621,10 +621,10 @@ function huHuCheck(tin) {
* and X characters after vowels may only be followed by other X characters.
*/
function itItNameCheck(name) {
- // true at the first occurence of a vowel
+ // true at the first occurrence of a vowel
let vowelflag = false;
- // true at the first occurence of an X AFTER vowel
+ // true at the first occurrence of an X AFTER vowel
// (to properly handle last names with X as consonant)
let xflag = false;
@@ -890,7 +890,7 @@ function plPlCheck(tin) {
const date = `${full_year}/${month}/${tin.slice(4, 6)}`;
if (!isDate(date, 'YYYY/MM/DD')) { return false; }
- // Calculate last digit by mulitplying with odd one-digit numbers except 5
+ // Calculate last digit by multiplying with odd one-digit numbers except 5
let checksum = 0;
let multiplier = 1;
for (let i = 0; i < tin.length - 1; i++) {
diff --git a/test/validators.test.js b/test/validators.test.js
index 8037acf37..48379eb8b 100644
--- a/test/validators.test.js
+++ b/test/validators.test.js
@@ -14835,7 +14835,7 @@ describe('Validators', () => {
],
invalid: [
'',
- 'somthing',
+ 'something',
'valid@gmail.com',
'mailto:?subject=okay&subject=444',
'mailto:?subject=something&wrong=888',