babel-plugin-transform-unicode-property-regex

Compile Unicode property escapes in Unicode regular expressions to ES5.

MIT 7 个版本
安装
npm install babel-plugin-transform-unicode-property-regex
yarn add babel-plugin-transform-unicode-property-regex
pnpm add babel-plugin-transform-unicode-property-regex
bun add babel-plugin-transform-unicode-property-regex
README

babel-plugin-transform-unicode-property-regex Build status

Compile Unicode property escapes (\p{…} and \P{…}) in Unicode regular expressions to ES5 or ES6 that works in today’s environments.

Note: the Unicode property escape syntax is non-standard and may or may not reflect what eventually gets specified.

Here’s an online demo.

Installation

$ npm install babel-plugin-transform-unicode-property-regex

Usage

.babelrc

{
  "plugins": ["transform-unicode-property-regex"]
}

Via CLI

$ babel --plugins transform-unicode-property-regex script.js

Via Node.js API

require('babel-core').transform(code, {
  'plugins': ['transform-unicode-property-regex']
});

To transpile to ES6/ES2015:

require('babel-core').transform(code, {
  'plugins': [
    ['transform-unicode-property-regex', { 'useUnicodeFlag': true }]
  ]
});

Author

twitter/mathias
Mathias Bynens

License

This code is available under the MIT license.

版本列表
2.0.5 2017-09-18
2.0.4 2017-08-19
2.0.3 2017-08-17
2.0.2 2017-06-21
2.0.1 2017-03-08
2.0.0 2017-01-20
1.0.0 2016-06-02