Comparing version 1.5.0 to 1.6.0
{ | ||
"name": "re2", | ||
"version": "1.5.0", | ||
"version": "1.6.0", | ||
"description": "Bindings for RE2: fast, safe alternative to backtracking regular expression engines.", | ||
@@ -12,3 +12,3 @@ "homepage": "http://github.com/uhop/node-re2", | ||
"dependencies": { | ||
"nan": "^2.6.2" | ||
"nan": "^2.8.0" | ||
}, | ||
@@ -15,0 +15,0 @@ "devDependencies": { |
11
re2.js
"use strict"; | ||
var re2 = require('./build/Release/re2.node'); | ||
var RE2 = require('./build/Release/re2.node'); | ||
module.exports = re2; | ||
if (typeof Symbol != 'undefined') { | ||
Symbol.match && (RE2.prototype[Symbol.match] = function (str) { return this.match(str); }); | ||
Symbol.search && (RE2.prototype[Symbol.search] = function (str) { return this.search(str); }); | ||
Symbol.replace && (RE2.prototype[Symbol.replace] = function (str, repl) { return this.replace(str, repl); }); | ||
Symbol.split && (RE2.prototype[Symbol.split] = function (str, limit) { return this.split(str, limit); }); | ||
} | ||
module.exports = RE2; |
@@ -61,2 +61,19 @@ # node-re2 | ||
Starting with 1.6.0 following well-known symbol-based methods are supported (see [Symbols](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol)): | ||
* [`re2[Symbol.match](str)`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol/match) | ||
* [`re2[Symbol.search](str)`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol/search) | ||
* [`re2[Symbol.replace](str, newSubStr|function)`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol/replace) | ||
* [`re2[Symbol.split](str[, limit])`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol/split) | ||
It allows to use `RE2` instances on strings directly, just like `RegExp` instances: | ||
```js | ||
var re = new RE2("1"); | ||
"213".match(re); // [ '1', index: 1, input: '213' ] | ||
"213".search(re); // 1 | ||
"213".replace(re, "+"); // 2+3 | ||
"213".split(re); // [ '2', '3' ] | ||
``` | ||
## Extensions | ||
@@ -87,2 +104,4 @@ | ||
Starting with 1.6.0, these methods added as well-known symbol-based methods to be used transparently with ES6 string/regex machinery. | ||
### `Buffer` support | ||
@@ -300,2 +319,3 @@ | ||
- 1.6.0 *Added well-known symbol-based methods of ES6. Refreshed NAN.* | ||
- 1.5.0 *Bug fixes, error checks, better docs. Thx [Jamie Davis](https://github.com/davisjam), and [omg](https://github.com/omg)!* | ||
@@ -302,0 +322,0 @@ - 1.4.1 *Minor corrections in README.* |
@@ -15,4 +15,5 @@ "use strict"; | ||
var testInvalid = require("./test_invalid"); | ||
var testSplit = require("./test_symbols"); | ||
unit.run(); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
1126785
122
772
343
250
Updatednan@^2.8.0