{ "_args": [ [ { "raw": "regexpu-core@^2.0.0", "scope": null, "escapedName": "regexpu-core", "name": "regexpu-core", "rawSpec": "^2.0.0", "spec": ">=2.0.0 <3.0.0", "type": "range" }, "/home/jdaugherty/work/GT2/GT2-Android/node_modules/babel-plugin-transform-es2015-unicode-regex" ] ], "_from": "regexpu-core@>=2.0.0 <3.0.0", "_id": "regexpu-core@2.0.0", "_inCache": true, "_location": "/regexpu-core", "_nodeVersion": "5.2.0", "_npmOperationalInternal": { "host": "packages-9-west.internal.npmjs.com", "tmp": "tmp/regexpu-core-2.0.0.tgz_1454960202073_0.38952653063461185" }, "_npmUser": { "name": "mathias", "email": "mathias@qiwi.be" }, "_npmVersion": "3.6.0", "_phantomChildren": {}, "_requested": { "raw": "regexpu-core@^2.0.0", "scope": null, "escapedName": "regexpu-core", "name": "regexpu-core", "rawSpec": "^2.0.0", "spec": ">=2.0.0 <3.0.0", "type": "range" }, "_requiredBy": [ "/babel-plugin-transform-es2015-unicode-regex" ], "_resolved": "https://registry.npmjs.org/regexpu-core/-/regexpu-core-2.0.0.tgz", "_shasum": "49d038837b8dcf8bfa5b9a42139938e6ea2ae240", "_shrinkwrap": null, "_spec": "regexpu-core@^2.0.0", "_where": "/home/jdaugherty/work/GT2/GT2-Android/node_modules/babel-plugin-transform-es2015-unicode-regex", "author": { "name": "Mathias Bynens", "url": "https://mathiasbynens.be/" }, "bugs": { "url": "https://github.com/mathiasbynens/regexpu-core/issues" }, "dependencies": { "regenerate": "^1.2.1", "regjsgen": "^0.2.0", "regjsparser": "^0.1.4" }, "description": "regexpu’s core functionality (i.e. `rewritePattern(pattern, flag)`), capable of translating ES6 Unicode regular expressions to ES5.", "devDependencies": { "coveralls": "^2.11.2", "istanbul": "^0.4.0", "jsesc": "^0.5.0", "lodash": "^3.6.0", "mocha": "^2.2.1", "regexpu-fixtures": "^2.0.0", "unicode-8.0.0": "^0.1.5" }, "directories": {}, "dist": { "shasum": "49d038837b8dcf8bfa5b9a42139938e6ea2ae240", "tarball": "https://registry.npmjs.org/regexpu-core/-/regexpu-core-2.0.0.tgz" }, "files": [ "LICENSE-MIT.txt", "rewrite-pattern.js", "data/character-class-escape-sets.js", "data/iu-mappings.json" ], "gitHead": "ae4efe52b72ba73e9a2c0f35e11c2ff1d0e12dcd", "homepage": "https://mths.be/regexpu", "keywords": [ "codegen", "desugaring", "ecmascript", "es5", "es6", "harmony", "javascript", "refactoring", "regex", "regexp", "regular expressions", "rewriting", "syntax", "transformation", "transpile", "transpiler", "unicode" ], "license": "MIT", "main": "rewrite-pattern.js", "maintainers": [ { "name": "mathias", "email": "mathias@qiwi.be" } ], "name": "regexpu-core", "optionalDependencies": {}, "readme": "# regexpu-core [![Build status](https://travis-ci.org/mathiasbynens/regexpu-core.svg?branch=master)](https://travis-ci.org/mathiasbynens/regexpu-core) [![Code coverage status](http://img.shields.io/coveralls/mathiasbynens/regexpu-core/master.svg)](https://coveralls.io/r/mathiasbynens/regexpu-core) [![Dependency status](https://gemnasium.com/mathiasbynens/regexpu-core.svg)](https://gemnasium.com/mathiasbynens/regexpu-core)\n\n_regexpu_ is a source code transpiler that enables the use of ES6 Unicode regular expressions in JavaScript-of-today (ES5).\n\n_regexpu-core_ contains _regexpu_’s core functionality, i.e. `rewritePattern(pattern, flag)`, which enables rewriting regular expressions that make use of [the ES6 `u` flag](https://mathiasbynens.be/notes/es6-unicode-regex) into equivalent ES5-compatible regular expression patterns.\n\n## Installation\n\nTo use _regexpu-core_ programmatically, install it as a dependency via [npm](https://www.npmjs.com/):\n\n```bash\nnpm install regexpu-core --save-dev\n```\n\nThen, `require` it:\n\n```js\nconst rewritePattern = require('regexpu-core');\n```\n\n## API\n\nThis module exports a single function named `rewritePattern`.\n\n### `rewritePattern(pattern, flags)`\n\nThis 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.\n\n```js\nrewritePattern('foo.bar', 'u');\n// → 'foo(?:[\\\\0-\\\\t\\\\x0B\\\\f\\\\x0E-\\\\u2027\\\\u202A-\\\\uD7FF\\\\uDC00-\\\\uFFFF]|[\\\\uD800-\\\\uDBFF][\\\\uDC00-\\\\uDFFF]|[\\\\uD800-\\\\uDBFF])bar'\n\nrewritePattern('[\\\\u{1D306}-\\\\u{1D308}a-z]', 'u');\n// → '(?:[a-z]|\\\\uD834[\\\\uDF06-\\\\uDF08])'\n\nrewritePattern('[\\\\u{1D306}-\\\\u{1D308}a-z]', 'ui');\n// → '(?:[a-z\\\\u017F\\\\u212A]|\\\\uD834[\\\\uDF06-\\\\uDF08])'\n```\n\n_regexpu-core_ can rewrite non-ES6 regular expressions too, which is useful to demonstrate how their behavior changes once the `u` and `i` flags are added:\n\n```js\n// In ES5, the dot operator only matches BMP symbols:\nrewritePattern('foo.bar');\n// → 'foo(?:[\\\\0-\\\\t\\\\x0B\\\\f\\\\x0E-\\\\u2027\\\\u202A-\\\\uFFFF])bar'\n\n// But with the ES6 `u` flag, it matches astral symbols too:\nrewritePattern('foo.bar', 'u');\n// → 'foo(?:[\\\\0-\\\\t\\\\x0B\\\\f\\\\x0E-\\\\u2027\\\\u202A-\\\\uD7FF\\\\uDC00-\\\\uFFFF]|[\\\\uD800-\\\\uDBFF][\\\\uDC00-\\\\uDFFF]|[\\\\uD800-\\\\uDBFF])bar'\n```\n\n`rewritePattern` uses [regjsgen](https://github.com/d10/regjsgen), [regjsparser](https://github.com/jviereck/regjsparser), and [regenerate](https://github.com/mathiasbynens/regenerate) as internal dependencies.\n\n## Author\n\n| [![twitter/mathias](https://gravatar.com/avatar/24e08a9ea84deb17ae121074d0f17125?s=70)](https://twitter.com/mathias \"Follow @mathias on Twitter\") |\n|---|\n| [Mathias Bynens](https://mathiasbynens.be/) |\n\n## License\n\n_regexpu-core_ is available under the [MIT](https://mths.be/mit) license.\n", "readmeFilename": "README.md", "repository": { "type": "git", "url": "git+https://github.com/mathiasbynens/regexpu-core.git" }, "scripts": { "build": "node scripts/iu-mappings.js && node scripts/character-class-escape-sets.js", "coverage": "istanbul cover --report html node_modules/.bin/_mocha tests/tests.js -- -u exports -R spec", "test": "mocha tests" }, "version": "2.0.0" }