JSPM

  • Created
  • Published
  • Downloads 8564230
  • Score
    100M100P100Q32825F
  • License MIT

Compile Unicode property escapes in Unicode regular expressions to ES5.

Package Exports

  • @babel/plugin-proposal-unicode-property-regex

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@babel/plugin-proposal-unicode-property-regex) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

@babel/plugin-proposal-unicode-property-regex

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 --save-dev @babel/plugin-proposal-unicode-property-regex

Usage

.babelrc

{
  "plugins": ["@babel/plugin-proposal-unicode-property-regex"]
}

Via CLI

babel --plugins @babel/@babel/plugin-proposal-unicode-property-regex script.js

Via Node.js API

require("@babel/core").transform(code, {
  "plugins": ["@babel/plugin-proposal-unicode-property-regex"]
});

To transpile to ES6/ES2015:

require("@babel/core").transform(code, {
  "plugins": [
    ["@babel/plugin-proposal-unicode-property-regex", { "useUnicodeFlag": false }]
  ]
});

Options

  • useUnicodeFlag (defaults to true)

When disabled with false, the transform converts Unicode regexes to non-Unicode regexes for wider support, removing the u flag. See https://github.com/mathiasbynens/regexpu-core#useunicodeflag-default-false for more information.

Author

twitter/mathias
Mathias Bynens