Skip to content

Commit

Permalink
fix: spell issues
Browse files Browse the repository at this point in the history
  • Loading branch information
rubiin committed Jun 14, 2024
1 parent 2b6b0fa commit a6644cb
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 26 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.<br/><br/>`options` is an object that defaults to `{ ignoreCase: false, minOccurrences: 1 }`.<br />Options: <br/> `ignoreCase`: Ignore case when doing comparison, default false.<br/>`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.<br/><br/>`options` is an object that defaults to `{ ignoreCase: false, minOccurrences: 1 }`.<br />Options: <br/> `ignoreCase`: Ignore case when doing comparison, default false.<br/>`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.<br/><br/>`options` is an object that defaults to `{ comparisonDate: Date().toString() }`.<br/>**Options:**<br/>`comparisonDate`: Date to compare to. Defaults to `Date().toString()` (now).
Expand Down
4 changes: 2 additions & 2 deletions src/lib/contains.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions src/lib/isEAN.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
8 changes: 4 additions & 4 deletions src/lib/isIMEI.js
Original file line number Diff line number Diff line change
@@ -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) {
Expand All @@ -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;
}


Expand Down
8 changes: 4 additions & 4 deletions src/lib/isMimeType.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
24 changes: 12 additions & 12 deletions src/lib/isTaxID.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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 multitplying with odd one-digit numbers except 5
let checksum = 0;
let multiplier = 1;
for (let i = 0; i < tin.length - 1; i++) {
Expand Down
2 changes: 1 addition & 1 deletion test/validators.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -14835,7 +14835,7 @@ describe('Validators', () => {
],
invalid: [
'',
'somthing',
'something',
'valid@gmail.com',
'mailto:?subject=okay&subject=444',
'mailto:?subject=something&wrong=888',
Expand Down

0 comments on commit a6644cb

Please sign in to comment.