regexgen
Advanced tools
Comparing version 1.2.3 to 1.2.4
{ | ||
"name": "regexgen", | ||
"version": "1.2.3", | ||
"version": "1.2.4", | ||
"description": "Generate regular expressions that match a set of strings", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -20,2 +20,6 @@ const jsesc = require('jsesc'); | ||
get length() { | ||
return this.options[0].length; | ||
} | ||
toString() { | ||
@@ -22,0 +26,0 @@ return this.options.map(o => parens(o, this)).join('|'); |
@@ -87,2 +87,10 @@ const assert = require('assert'); | ||
}); | ||
it('should sort alternations of alternations correctly', function () { | ||
let r = regexgen(['aef', 'aghz', 'ayz', 'abcdz', 'abcd']); | ||
let s = 'abcdz'; | ||
assert.deepEqual(s.match(r)[0], s); | ||
assert.deepEqual(r, /a(?:(?:bcd|gh|y)z|bcd|ef)/); | ||
}); | ||
}); |
20757
628