Comparing version 0.2.1 to 0.2.2
@@ -10,3 +10,3 @@ // Generated by `/scripts/character-class-escape-sets.js`. Do not edit. | ||
.addRange(0x3A, 0xFFFF), | ||
's': regenerate(0x20, 0xA0, 0x1680, 0x202F, 0x205F, 0x3000, 0xFEFF) | ||
's': regenerate(0x20, 0xA0, 0x1680, 0x180E, 0x202F, 0x205F, 0x3000, 0xFEFF) | ||
.addRange(0x9, 0xD) | ||
@@ -20,3 +20,4 @@ .addRange(0x2000, 0x200A) | ||
.addRange(0xA1, 0x167F) | ||
.addRange(0x1681, 0x1FFF) | ||
.addRange(0x1681, 0x180D) | ||
.addRange(0x180F, 0x1FFF) | ||
.addRange(0x200B, 0x2027) | ||
@@ -45,3 +46,3 @@ .addRange(0x202A, 0x202E) | ||
.addRange(0x3A, 0x10FFFF), | ||
's': regenerate(0x20, 0xA0, 0x1680, 0x202F, 0x205F, 0x3000, 0xFEFF) | ||
's': regenerate(0x20, 0xA0, 0x1680, 0x180E, 0x202F, 0x205F, 0x3000, 0xFEFF) | ||
.addRange(0x9, 0xD) | ||
@@ -55,3 +56,4 @@ .addRange(0x2000, 0x200A) | ||
.addRange(0xA1, 0x167F) | ||
.addRange(0x1681, 0x1FFF) | ||
.addRange(0x1681, 0x180D) | ||
.addRange(0x180F, 0x1FFF) | ||
.addRange(0x200B, 0x2027) | ||
@@ -80,3 +82,3 @@ .addRange(0x202A, 0x202E) | ||
.addRange(0x3A, 0x10FFFF), | ||
's': regenerate(0x20, 0xA0, 0x1680, 0x202F, 0x205F, 0x3000, 0xFEFF) | ||
's': regenerate(0x20, 0xA0, 0x1680, 0x180E, 0x202F, 0x205F, 0x3000, 0xFEFF) | ||
.addRange(0x9, 0xD) | ||
@@ -90,3 +92,4 @@ .addRange(0x2000, 0x200A) | ||
.addRange(0xA1, 0x167F) | ||
.addRange(0x1681, 0x1FFF) | ||
.addRange(0x1681, 0x180D) | ||
.addRange(0x180F, 0x1FFF) | ||
.addRange(0x200B, 0x2027) | ||
@@ -93,0 +96,0 @@ .addRange(0x202A, 0x202E) |
{ | ||
"name": "regexpu", | ||
"version": "0.2.1", | ||
"version": "0.2.2", | ||
"description": "A source code transpiler that enables the use of ES6 Unicode regular expressions in ES5.", | ||
@@ -59,4 +59,4 @@ "homepage": "https://mths.be/regexpu", | ||
"esprima": "git+https://github.com/mathiasbynens/esprima-es6-regexp.git", | ||
"recast": "^0.7.0", | ||
"regenerate": "^0.6.4", | ||
"recast": "^0.7.4", | ||
"regenerate": "^1.0.0", | ||
"regjsgen": "^0.2.0", | ||
@@ -67,8 +67,9 @@ "regjsparser": "^0.1.2" | ||
"coveralls": "^2.11.1", | ||
"istanbul": "^0.3.0", | ||
"istanbul": "^0.3.2", | ||
"jsesc": "^0.5.0", | ||
"lodash": "^2.4.1", | ||
"mocha": "^1.21.4", | ||
"unicode-5.1.0": "^0.1.5", | ||
"unicode-7.0.0": "^0.1.5" | ||
} | ||
} |
# regexpu [![Build status](https://travis-ci.org/mathiasbynens/regexpu.svg?branch=master)](https://travis-ci.org/mathiasbynens/regexpu) [![Code coverage status](http://img.shields.io/coveralls/mathiasbynens/regexpu/master.svg)](https://coveralls.io/r/mathiasbynens/regexpu) [![Dependency status](https://gemnasium.com/mathiasbynens/regexpu.svg)](https://gemnasium.com/mathiasbynens/regexpu) | ||
_regexpu_ is a source code transpiler that enables the use of ES6 Unicode regular expressions in JavaScript-of-today (ES5). It rewrites regular expressions that make use of [the ES6 `u` flag](https://mathiasbynens.be/notes/es6-unicode-regex) into equivalent ES5-compatible regular expressions. [Here’s an online demo.](https://mothereff.in/regexpu) | ||
_regexpu_ is a source code transpiler that enables the use of ES6 Unicode regular expressions in JavaScript-of-today (ES5). It rewrites regular expressions that make use of [the ES6 `u` flag](https://mathiasbynens.be/notes/es6-unicode-regex) into equivalent ES5-compatible regular expressions. | ||
[Here’s an online demo.](https://mothereff.in/regexpu) | ||
As of v0.0.61, [Traceur](https://github.com/google/traceur-compiler) uses _regexpu_ for its `u` regexp transpilation. [The Traceur REPL demo](https://google.github.io/traceur-compiler/demo/repl.html#%2F%2F%20Traceur%20now%20uses%20regexpu%20(https%3A%2F%2Fmths.be%2Fregexpu)%20to%20transpile%20regular%0A%2F%2F%20expression%20literals%20that%20have%20the%20ES6%20%60u%60%20flag%20set%20into%20equivalent%20ES5.%0A%0A%2F%2F%20Match%20any%20symbol%20from%20U%2B1F4A9%20PILE%20OF%20POO%20to%20U%2B1F4AB%20DIZZY%20SYMBOL.%0Avar%20regex%20%3D%20%2F%5B%F0%9F%92%A9-%F0%9F%92%AB%5D%2Fu%3B%20%2F%2F%20Or%2C%20%60%2F%5Cu%7B1F4A9%7D-%5Cu%7B1F4AB%7D%2Fu%60.%0Aconsole.log(%0A%20%20regex.test('%F0%9F%92%A8')%2C%20%2F%2F%20false%0A%20%20regex.test('%F0%9F%92%A9')%2C%20%2F%2F%20true%0A%20%20regex.test('%F0%9F%92%AA')%2C%20%2F%2F%20true%0A%20%20regex.test('%F0%9F%92%AB')%2C%20%2F%2F%20true%0A%20%20regex.test('%F0%9F%92%AC')%20%20%2F%2F%20false%0A)%3B%0A%0A%2F%2F%20See%20https%3A%2F%2Fmathiasbynens.be%2Fnotes%2Fes6-unicode-regex%20for%20more%20examples%20and%0A%2F%2F%20info.%0A) lets you try `u` regexps as well as other ES.next features. | ||
## Example | ||
@@ -6,0 +10,0 @@ |
@@ -12,16 +12,15 @@ var recast = require('recast'); | ||
// use the `regex` property here instead. | ||
var match = node.raw.match(/^\/(.+)\/([gimuy]*)$/); | ||
if (match) { | ||
var pattern = match[1]; | ||
var flags = match[2]; | ||
if (flags.indexOf('u') != -1) { | ||
var result = '/' + rewritePattern(pattern, flags) + '/' + | ||
flags.replace('u', ''); | ||
node.raw = result; | ||
node.value = { | ||
'toString': function() { | ||
return result; | ||
} | ||
}; | ||
} | ||
var value = node.raw; | ||
var lastIndex = value.lastIndexOf('/'); | ||
var pattern = value.slice(1, lastIndex); | ||
var flags = value.slice(lastIndex + 1); | ||
if (flags.indexOf('u') != -1) { | ||
var result = '/' + rewritePattern(pattern, flags) + '/' + | ||
flags.replace('u', ''); | ||
node.raw = result; | ||
node.value = { | ||
'toString': function() { | ||
return result; | ||
} | ||
}; | ||
} | ||
@@ -28,0 +27,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
28726
533
183
7
+ Addedregenerate@1.4.2(transitive)
- Removedregenerate@0.6.4(transitive)
Updatedrecast@^0.7.4
Updatedregenerate@^1.0.0