Default unicode-property-regex to outputting 'u' flag regexes.
This commit is contained in:
parent
e7c57ae85a
commit
3782c7267e
@ -43,11 +43,18 @@ To transpile to ES6/ES2015:
|
||||
```js
|
||||
require("@babel/core").transform(code, {
|
||||
"plugins": [
|
||||
["@babel/proposal-unicode-property-regex", { "useUnicodeFlag": true }]
|
||||
["@babel/proposal-unicode-property-regex", { "useUnicodeFlag": false }]
|
||||
]
|
||||
});
|
||||
```
|
||||
|
||||
## Options
|
||||
|
||||
* `useUnicodeFlag` (defaults to `true`)
|
||||
|
||||
When disabled with `false`, the transform will convert unicode regexes to
|
||||
non-unicode regexes, removing the `u` flag. See https://www.npmjs.com/package/regexpu-core#useunicodeflag-default-false- for more information.
|
||||
|
||||
## Author
|
||||
|
||||
| [](https://twitter.com/mathias "Follow @mathias on Twitter") |
|
||||
|
||||
@ -2,7 +2,7 @@ import rewritePattern from "regexpu-core";
|
||||
import * as regex from "@babel/helper-regex";
|
||||
|
||||
export default function(api, options) {
|
||||
const { useUnicodeFlag = false } = options;
|
||||
const { useUnicodeFlag = true } = options;
|
||||
if (typeof useUnicodeFlag !== "boolean") {
|
||||
throw new Error(".useUnicodeFlag must be a boolean, or undefined");
|
||||
}
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
{
|
||||
"plugins": [
|
||||
["proposal-unicode-property-regex"]
|
||||
["proposal-unicode-property-regex", {
|
||||
"useUnicodeFlag": false
|
||||
}]
|
||||
]
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user