diff options
| author | ST-DDT <[email protected]> | 2023-10-07 11:05:58 +0200 |
|---|---|---|
| committer | GitHub <[email protected]> | 2023-10-07 09:05:58 +0000 |
| commit | eb2b18b8a0e64eded3731bae4204d2925dbef3e7 (patch) | |
| tree | 0ace6e551d0a75fae07e6acef448b48691589cdc /src/modules/helpers | |
| parent | c80c035333e3c832c46dc7dcac5c86a289829e0d (diff) | |
| download | faker-eb2b18b8a0e64eded3731bae4204d2925dbef3e7.tar.xz faker-eb2b18b8a0e64eded3731bae4204d2925dbef3e7.zip | |
infra(eslint): enable no-useless-escape eslint rule (#2434)
Diffstat (limited to 'src/modules/helpers')
| -rw-r--r-- | src/modules/helpers/index.ts | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/modules/helpers/index.ts b/src/modules/helpers/index.ts index 7ace1e91..3cc9e855 100644 --- a/src/modules/helpers/index.ts +++ b/src/modules/helpers/index.ts @@ -99,9 +99,9 @@ function legacyRegexpStringParse( string: string = '' ): string { // Deal with range repeat `{min,max}` - const RANGE_REP_REG = /(.)\{(\d+)\,(\d+)\}/; + const RANGE_REP_REG = /(.)\{(\d+),(\d+)\}/; const REP_REG = /(.)\{(\d+)\}/; - const RANGE_REG = /\[(\d+)\-(\d+)\]/; + const RANGE_REG = /\[(\d+)-(\d+)\]/; let min: number; let max: number; let tmp: number; @@ -192,7 +192,7 @@ export class SimpleHelpersModule { .normalize('NFKD') //for example è decomposes to as e + ̀ .replace(/[\u0300-\u036f]/g, '') // removes combining marks .replace(/ /g, '-') // replaces spaces with hyphens - .replace(/[^\w\.\-]+/g, ''); // removes all non-word characters except for dots and hyphens + .replace(/[^\w.-]+/g, ''); // removes all non-word characters except for dots and hyphens } /** @@ -416,7 +416,7 @@ export class SimpleHelpersModule { // Deal with single wildcards const SINGLE_CHAR_REG = - /([.A-Za-z0-9])(?:\{(\d+)(?:\,(\d+)|)\}|(\?|\*|\+))(?![^[]*]|[^{]*})/; + /([.A-Za-z0-9])(?:\{(\d+)(?:,(\d+)|)\}|(\?|\*|\+))(?![^[]*]|[^{]*})/; let token = pattern.match(SINGLE_CHAR_REG); while (token != null) { const quantifierMin: string = token[2]; @@ -439,7 +439,7 @@ export class SimpleHelpersModule { const SINGLE_RANGE_REG = /(\d-\d|\w-\w|\d|\w|[-!@#$&()`.+,/"])/; const RANGE_ALPHANUMEMRIC_REG = - /\[(\^|)(-|)(.+?)\](?:\{(\d+)(?:\,(\d+)|)\}|(\?|\*|\+)|)/; + /\[(\^|)(-|)(.+?)\](?:\{(\d+)(?:,(\d+)|)\}|(\?|\*|\+)|)/; // Deal with character classes with quantifiers `[a-z0-9]{min[, max]}` token = pattern.match(RANGE_ALPHANUMEMRIC_REG); while (token != null) { @@ -548,7 +548,7 @@ export class SimpleHelpersModule { token = pattern.match(RANGE_ALPHANUMEMRIC_REG); } - const RANGE_REP_REG = /(.)\{(\d+)\,(\d+)\}/; + const RANGE_REP_REG = /(.)\{(\d+),(\d+)\}/; // Deal with quantifier ranges `{min,max}` token = pattern.match(RANGE_REP_REG); while (token != null) { |
