Skip to content

Commit 0d6ca5a

Browse files
rubiinWikiRik
andauthored
fix: spell issues (validatorjs#2423)
* fix: spell issues * Update src/lib/isTaxID.js Co-authored-by: Rik Smale <[email protected]> --------- Co-authored-by: Rik Smale <[email protected]>
1 parent efd5b62 commit 0d6ca5a

File tree

6 files changed

+25
-25
lines changed

6 files changed

+25
-25
lines changed

src/lib/contains.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@ import assertString from './util/assertString';
22
import toString from './util/toString';
33
import merge from './util/merge';
44

5-
const defaulContainsOptions = {
5+
const defaultContainsOptions = {
66
ignoreCase: false,
77
minOccurrences: 1,
88
};
99

1010
export default function contains(str, elem, options) {
1111
assertString(str);
12-
options = merge(options, defaulContainsOptions);
12+
options = merge(options, defaultContainsOptions);
1313

1414
if (options.ignoreCase) {
1515
return str.toLowerCase().split(toString(elem).toLowerCase()).length > options.minOccurrences;

src/lib/isEAN.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@
1515
import assertString from './util/assertString';
1616

1717
/**
18-
* Define EAN Lenghts; 8 for EAN-8; 13 for EAN-13; 14 for EAN-14
18+
* Define EAN Lengths; 8 for EAN-8; 13 for EAN-13; 14 for EAN-14
1919
* and Regular Expression for valid EANs (EAN-8, EAN-13, EAN-14),
20-
* with exact numberic matching of 8 or 13 or 14 digits [0-9]
20+
* with exact numeric matching of 8 or 13 or 14 digits [0-9]
2121
*/
2222
const LENGTH_EAN_8 = 8;
2323
const LENGTH_EAN_14 = 14;

src/lib/isIMEI.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import assertString from './util/assertString';
22

33

4-
let imeiRegexWithoutHypens = /^[0-9]{15}$/;
5-
let imeiRegexWithHypens = /^\d{2}-\d{6}-\d{6}-\d{1}$/;
4+
let imeiRegexWithoutHyphens = /^[0-9]{15}$/;
5+
let imeiRegexWithHyphens = /^\d{2}-\d{6}-\d{6}-\d{1}$/;
66

77

88
export default function isIMEI(str, options) {
@@ -11,10 +11,10 @@ export default function isIMEI(str, options) {
1111

1212
// default regex for checking imei is the one without hyphens
1313

14-
let imeiRegex = imeiRegexWithoutHypens;
14+
let imeiRegex = imeiRegexWithoutHyphens;
1515

1616
if (options.allow_hyphens) {
17-
imeiRegex = imeiRegexWithHypens;
17+
imeiRegex = imeiRegexWithHyphens;
1818
}
1919

2020

src/lib/isMimeType.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,18 @@ import assertString from './util/assertString';
44
Checks if the provided string matches to a correct Media type format (MIME type)
55
66
This function only checks is the string format follows the
7-
etablished rules by the according RFC specifications.
7+
established rules by the according RFC specifications.
88
This function supports 'charset' in textual media types
99
(https://tools.ietf.org/html/rfc6657).
1010
1111
This function does not check against all the media types listed
1212
by the IANA (https://www.iana.org/assignments/media-types/media-types.xhtml)
1313
because of lightness purposes : it would require to include
14-
all these MIME types in this librairy, which would weigh it
14+
all these MIME types in this library, which would weigh it
1515
significantly. This kind of effort maybe is not worth for the use that
16-
this function has in this entire librairy.
16+
this function has in this entire library.
1717
18-
More informations in the RFC specifications :
18+
More information in the RFC specifications :
1919
- https://tools.ietf.org/html/rfc2045
2020
- https://tools.ietf.org/html/rfc2046
2121
- https://tools.ietf.org/html/rfc7231#section-3.1.1.1

src/lib/isTaxID.js

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -174,24 +174,24 @@ function deDeCheck(tin) {
174174
const digits = tin.split('').map(a => parseInt(a, 10));
175175

176176
// Fill array with strings of number positions
177-
let occurences = [];
177+
let occurrences = [];
178178
for (let i = 0; i < digits.length - 1; i++) {
179-
occurences.push('');
179+
occurrences.push('');
180180
for (let j = 0; j < digits.length - 1; j++) {
181181
if (digits[i] === digits[j]) {
182-
occurences[i] += j;
182+
occurrences[i] += j;
183183
}
184184
}
185185
}
186186

187-
// Remove digits with one occurence and test for only one duplicate/triplicate
188-
occurences = occurences.filter(a => a.length > 1);
189-
if (occurences.length !== 2 && occurences.length !== 3) { return false; }
187+
// Remove digits with one occurrence and test for only one duplicate/triplicate
188+
occurrences = occurrences.filter(a => a.length > 1);
189+
if (occurrences.length !== 2 && occurrences.length !== 3) { return false; }
190190

191191
// In case of triplicate value only two digits are allowed next to each other
192-
if (occurences[0].length === 3) {
193-
const trip_locations = occurences[0].split('').map(a => parseInt(a, 10));
194-
let recurrent = 0; // Amount of neighbour occurences
192+
if (occurrences[0].length === 3) {
193+
const trip_locations = occurrences[0].split('').map(a => parseInt(a, 10));
194+
let recurrent = 0; // Amount of neighbor occurrences
195195
for (let i = 0; i < trip_locations.length - 1; i++) {
196196
if (trip_locations[i] + 1 === trip_locations[i + 1]) {
197197
recurrent += 1;
@@ -621,10 +621,10 @@ function huHuCheck(tin) {
621621
* and X characters after vowels may only be followed by other X characters.
622622
*/
623623
function itItNameCheck(name) {
624-
// true at the first occurence of a vowel
624+
// true at the first occurrence of a vowel
625625
let vowelflag = false;
626626

627-
// true at the first occurence of an X AFTER vowel
627+
// true at the first occurrence of an X AFTER vowel
628628
// (to properly handle last names with X as consonant)
629629
let xflag = false;
630630

@@ -890,7 +890,7 @@ function plPlCheck(tin) {
890890
const date = `${full_year}/${month}/${tin.slice(4, 6)}`;
891891
if (!isDate(date, 'YYYY/MM/DD')) { return false; }
892892

893-
// Calculate last digit by mulitplying with odd one-digit numbers except 5
893+
// Calculate last digit by multiplying with odd one-digit numbers except 5
894894
let checksum = 0;
895895
let multiplier = 1;
896896
for (let i = 0; i < tin.length - 1; i++) {

test/validators.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15003,7 +15003,7 @@ describe('Validators', () => {
1500315003
],
1500415004
invalid: [
1500515005
'',
15006-
'somthing',
15006+
'something',
1500715007
1500815008
'mailto:?subject=okay&subject=444',
1500915009
'mailto:?subject=something&wrong=888',

0 commit comments

Comments
 (0)