feat: refactoring project
This commit is contained in:
28
node_modules/regexpu-core/README.md
generated
vendored
28
node_modules/regexpu-core/README.md
generated
vendored
@@ -27,13 +27,13 @@ This module exports a single function named `rewritePattern`.
|
||||
This function takes a string that represents a regular expression pattern as well as a string representing its flags, and returns an ES5-compatible version of the pattern.
|
||||
|
||||
```js
|
||||
rewritePattern('foo.bar', 'u');
|
||||
rewritePattern('foo.bar', 'u', { unicodeFlag: "transform" });
|
||||
// → 'foo(?:[\\0-\\t\\x0B\\f\\x0E-\\u2027\\u202A-\\uD7FF\\uDC00-\\uFFFF]|[\\uD800-\\uDBFF][\\uDC00-\\uDFFF]|[\\uD800-\\uDBFF])bar'
|
||||
|
||||
rewritePattern('[\\u{1D306}-\\u{1D308}a-z]', 'u');
|
||||
rewritePattern('[\\u{1D306}-\\u{1D308}a-z]', 'u', { unicodeFlag: "transform" });
|
||||
// → '(?:[a-z]|\\uD834[\\uDF06-\\uDF08])'
|
||||
|
||||
rewritePattern('[\\u{1D306}-\\u{1D308}a-z]', 'ui');
|
||||
rewritePattern('[\\u{1D306}-\\u{1D308}a-z]', 'ui', { unicodeFlag: "transform" });
|
||||
// → '(?:[a-z\\u017F\\u212A]|\\uD834[\\uDF06-\\uDF08])'
|
||||
```
|
||||
|
||||
@@ -41,11 +41,11 @@ _regexpu-core_ can rewrite non-ES6 regular expressions too, which is useful to d
|
||||
|
||||
```js
|
||||
// In ES5, the dot operator only matches BMP symbols:
|
||||
rewritePattern('foo.bar');
|
||||
rewritePattern('foo.bar', '', { unicodeFlag: "transform" });
|
||||
// → 'foo(?:[\\0-\\t\\x0B\\f\\x0E-\\u2027\\u202A-\\uFFFF])bar'
|
||||
|
||||
// But with the ES2015 `u` flag, it matches astral symbols too:
|
||||
rewritePattern('foo.bar', 'u');
|
||||
rewritePattern('foo.bar', 'u', { unicodeFlag: "transform" });
|
||||
// → 'foo(?:[\\0-\\t\\x0B\\f\\x0E-\\u2027\\u202A-\\uD7FF\\uDC00-\\uFFFF]|[\\uD800-\\uDBFF][\\uDC00-\\uDFFF]|[\\uD800-\\uDBFF])bar'
|
||||
```
|
||||
|
||||
@@ -114,19 +114,13 @@ These options can be set to `false` or `'transform'`. When using `'transform'`,
|
||||
// → '(.)\1'
|
||||
```
|
||||
|
||||
#### Experimental regular expression features
|
||||
|
||||
These options can be set to `false`, `'parse'` and `'transform'`. When using `'transform'`, the corresponding features are compiled to older syntax that can run in older browsers. When using `'parse'`, they are parsed and left as-is in the output pattern. When using `false` (the default), they result in a syntax error if used.
|
||||
|
||||
Once these features become stable (when the proposals are accepted as part of ECMAScript), they will be parsed by default and thus `'parse'` will behave like `false`.
|
||||
|
||||
- `unicodeSetsFlag` - [The `v` (`unicodeSets`) flag](https://github.com/tc39/proposal-regexp-set-notation)
|
||||
|
||||
```js
|
||||
rewritePattern('[\\p{Emoji}&&\\p{ASCII}]', 'u', {
|
||||
rewritePattern('[\\p{Emoji}&&\\p{ASCII}]', 'v', {
|
||||
unicodeSetsFlag: 'transform'
|
||||
});
|
||||
// → '[#\*0-9]'
|
||||
// → '[#\\*0-9]'
|
||||
```
|
||||
|
||||
By default, patterns with the `v` flag are transformed to patterns with the `u` flag. If you want to downlevel them more you can set the `unicodeFlag: 'transform'` option.
|
||||
@@ -146,7 +140,7 @@ Once these features become stable (when the proposals are accepted as part of EC
|
||||
// → '(?:(?![f-h])[\s\S])' (to be used without /u)
|
||||
```
|
||||
|
||||
- `modifiers` - [Inline `m`/`s`/`i` modifiers](https://github.com/tc39/proposal-regexp-modifiers)
|
||||
- `modifiers` - [Inline `i`/`m`/`s` modifiers](https://github.com/tc39/proposal-regexp-modifiers)
|
||||
|
||||
```js
|
||||
rewritePattern('(?i:[a-z])[a-z]', '', {
|
||||
@@ -155,6 +149,12 @@ Once these features become stable (when the proposals are accepted as part of EC
|
||||
// → '(?:[a-zA-Z])([a-z])'
|
||||
```
|
||||
|
||||
#### Experimental regular expression features
|
||||
|
||||
These options can be set to `false`, `'parse'` and `'transform'`. When using `'transform'`, the corresponding features are compiled to older syntax that can run in older browsers. When using `'parse'`, they are parsed and left as-is in the output pattern. When using `false` (the default), they result in a syntax error if used.
|
||||
|
||||
Once these features become stable (when the proposals are accepted as part of ECMAScript), they will be parsed by default and thus `'parse'` will behave like `false`.
|
||||
|
||||
#### Miscellaneous options
|
||||
|
||||
- `onNamedGroup`
|
||||
|
||||
Reference in New Issue
Block a user