diff options
| author | Shinigami <[email protected]> | 2022-03-07 21:01:24 +0100 |
|---|---|---|
| committer | GitHub <[email protected]> | 2022-03-07 21:01:24 +0100 |
| commit | 5cd3daef2b586b7f7c89b82259831ca4810d77d5 (patch) | |
| tree | 6ed63b5d247ccbc9423daaf9f22b14d5a42d68fd /src | |
| parent | 4f7447c3e38da71d261da254dd631b84fb4c22c4 (diff) | |
| download | faker-5cd3daef2b586b7f7c89b82259831ca4810d77d5.tar.xz faker-5cd3daef2b586b7f7c89b82259831ca4810d77d5.zip | |
chore: configure eqeqeq lint rule (#595)
Diffstat (limited to 'src')
| -rw-r--r-- | src/datatype.ts | 2 | ||||
| -rw-r--r-- | src/date.ts | 2 | ||||
| -rw-r--r-- | src/finance.ts | 6 | ||||
| -rw-r--r-- | src/helpers.ts | 10 | ||||
| -rw-r--r-- | src/internet.ts | 2 | ||||
| -rw-r--r-- | src/lorem.ts | 4 | ||||
| -rw-r--r-- | src/mersenne.ts | 4 | ||||
| -rw-r--r-- | src/vendor/mersenne.ts | 2 | ||||
| -rw-r--r-- | src/word.ts | 14 |
9 files changed, 23 insertions, 23 deletions
diff --git a/src/datatype.ts b/src/datatype.ts index a5e751c0..ba2ebdc4 100644 --- a/src/datatype.ts +++ b/src/datatype.ts @@ -182,7 +182,7 @@ export class Datatype { const RFC4122_TEMPLATE = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'; const replacePlaceholders = (placeholder) => { const random = this.faker.datatype.number({ min: 0, max: 15 }); - const value = placeholder == 'x' ? random : (random & 0x3) | 0x8; + const value = placeholder === 'x' ? random : (random & 0x3) | 0x8; return value.toString(16); }; return RFC4122_TEMPLATE.replace(/[xy]/g, replacePlaceholders); diff --git a/src/date.ts b/src/date.ts index a8b95bb8..818a946a 100644 --- a/src/date.ts +++ b/src/date.ts @@ -112,7 +112,7 @@ export class _Date { * // [ 2023-05-02T16:00:00.000Z, 2026-09-01T08:00:00.000Z ] */ betweens(from: string, to: string, num?: number): Date[] { - if (typeof num == 'undefined') { + if (typeof num === 'undefined') { num = 3; } const newDates: Date[] = []; diff --git a/src/finance.ts b/src/finance.ts index bf1f725f..a25f6443 100644 --- a/src/finance.ts +++ b/src/finance.ts @@ -91,7 +91,7 @@ export class Finance { mask(length?: number, parens?: boolean, ellipsis?: boolean): string { // set defaults length = - length == 0 || !length || typeof length == 'undefined' ? 4 : length; + length === 0 || !length || typeof length === 'undefined' ? 4 : length; parens = parens == null ? true : parens; ellipsis = ellipsis == null ? true : ellipsis; @@ -352,9 +352,9 @@ export class Finance { let c = bban.count; count += bban.count; while (c > 0) { - if (bban.type == 'a') { + if (bban.type === 'a') { s += this.faker.random.arrayElement(this.ibanLib.alpha); - } else if (bban.type == 'c') { + } else if (bban.type === 'c') { if (this.faker.datatype.number(100) < 80) { s += this.faker.datatype.number(9); } else { diff --git a/src/helpers.ts b/src/helpers.ts index 7a0cba22..0f970dba 100644 --- a/src/helpers.ts +++ b/src/helpers.ts @@ -178,9 +178,9 @@ export class Helpers { replaceSymbolWithNumber(string: string = '', symbol: string = '#'): string { let str = ''; for (let i = 0; i < string.length; i++) { - if (string.charAt(i) == symbol) { + if (string.charAt(i) === symbol) { str += this.faker.datatype.number(9); - } else if (string.charAt(i) == '!') { + } else if (string.charAt(i) === '!') { str += this.faker.datatype.number({ min: 2, max: 9 }); } else { str += string.charAt(i); @@ -237,11 +237,11 @@ export class Helpers { let str = ''; for (let i = 0; i < string.length; i++) { - if (string.charAt(i) == '#') { + if (string.charAt(i) === '#') { str += this.faker.datatype.number(9); - } else if (string.charAt(i) == '?') { + } else if (string.charAt(i) === '?') { str += this.faker.random.arrayElement(alpha); - } else if (string.charAt(i) == '*') { + } else if (string.charAt(i) === '*') { str += this.faker.datatype.boolean() ? this.faker.random.arrayElement(alpha) : this.faker.datatype.number(9); diff --git a/src/internet.ts b/src/internet.ts index 027195c0..f80059f9 100644 --- a/src/internet.ts +++ b/src/internet.ts @@ -336,7 +336,7 @@ export class Internet { for (i = 0; i < 12; i++) { mac += this.faker.datatype.number(15).toString(16); - if (i % 2 == 1 && i != 11) { + if (i % 2 === 1 && i !== 11) { mac += validSep; } } diff --git a/src/lorem.ts b/src/lorem.ts index 2c22ac10..296c88b5 100644 --- a/src/lorem.ts +++ b/src/lorem.ts @@ -50,7 +50,7 @@ export class Lorem { * faker.lorem.words(10) // 'debitis consectetur voluptatem non doloremque ipsum autem totam eum ratione' */ words(num?: number): string { - if (typeof num == 'undefined') { + if (typeof num === 'undefined') { num = 3; } const words: string[] = []; @@ -72,7 +72,7 @@ export class Lorem { */ // TODO @Shinigami92 2022-01-11: `range` is not in use sentence(wordCount?: number, range?: number): string { - if (typeof wordCount == 'undefined') { + if (typeof wordCount === 'undefined') { wordCount = this.faker.datatype.number({ min: 3, max: 10 }); } // if (typeof range == 'undefined') { range = 7; } diff --git a/src/mersenne.ts b/src/mersenne.ts index c28a5642..6539d738 100644 --- a/src/mersenne.ts +++ b/src/mersenne.ts @@ -46,7 +46,7 @@ export class Mersenne { * @throws If the seed is not a `number`. */ seed(S: number): void { - if (typeof S != 'number') { + if (typeof S !== 'number') { throw new Error('seed(S) must take numeric argument; is ' + typeof S); } @@ -60,7 +60,7 @@ export class Mersenne { * @throws If the seed is not a `number[]`. */ seed_array(A: number[]): void { - if (typeof A != 'object') { + if (typeof A !== 'object') { throw new Error( 'seed_array(A) must take array of numbers; is ' + typeof A ); diff --git a/src/vendor/mersenne.ts b/src/vendor/mersenne.ts index 5a257a14..23e44f2c 100644 --- a/src/vendor/mersenne.ts +++ b/src/vendor/mersenne.ts @@ -237,7 +237,7 @@ export default class MersenneTwister19937 { //c//int kk; let kk: number; - if (this.mti == this.N + 1) { + if (this.mti === this.N + 1) { /* if init_genrand() has not been called, */ //c//init_genrand(5489); /* a default initial seed is used */ this.initGenrand(5489); diff --git a/src/word.ts b/src/word.ts index 482db788..4570e964 100644 --- a/src/word.ts +++ b/src/word.ts @@ -24,7 +24,7 @@ export class Word { let wordList = this.faker.definitions.word.adjective; if (length) { wordList = this.faker.definitions.word.adjective.filter( - (word) => word.length == length + (word) => word.length === length ); } @@ -46,7 +46,7 @@ export class Word { let wordList = this.faker.definitions.word.adverb; if (length) { wordList = this.faker.definitions.word.adverb.filter( - (word: string) => word.length == length + (word: string) => word.length === length ); } @@ -68,7 +68,7 @@ export class Word { let wordList = this.faker.definitions.word.conjunction; if (length) { wordList = this.faker.definitions.word.conjunction.filter( - (word: string) => word.length == length + (word: string) => word.length === length ); } @@ -90,7 +90,7 @@ export class Word { let wordList = this.faker.definitions.word.interjection; if (length) { wordList = this.faker.definitions.word.interjection.filter( - (word: string) => word.length == length + (word: string) => word.length === length ); } @@ -112,7 +112,7 @@ export class Word { let wordList = this.faker.definitions.word.noun; if (length) { wordList = this.faker.definitions.word.noun.filter( - (word: string) => word.length == length + (word: string) => word.length === length ); } @@ -134,7 +134,7 @@ export class Word { let wordList = this.faker.definitions.word.preposition; if (length) { wordList = this.faker.definitions.word.preposition.filter( - (word: string) => word.length == length + (word: string) => word.length === length ); } @@ -156,7 +156,7 @@ export class Word { let wordList = this.faker.definitions.word.verb; if (length) { wordList = this.faker.definitions.word.verb.filter( - (word: string) => word.length == length + (word: string) => word.length === length ); } |
