safe-regex
Advanced tools
Comparing version 0.0.0 to 0.0.1
@@ -14,2 +14,8 @@ var parse = require('ret'); | ||
if (node.options) { | ||
for (var i = 0, len = node.options.length; i < len; i++) { | ||
var ok = walk({ stack: node.options[i] }, starHeight); | ||
if (!ok) return false; | ||
} | ||
} | ||
var stack = node.stack || (node.value && node.value.stack); | ||
@@ -16,0 +22,0 @@ if (!stack) return true; |
{ | ||
"name": "safe-regex", | ||
"version": "0.0.0", | ||
"version": "0.0.1", | ||
"description": "detect possibly catastrophic, exponential-time regular expressions", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -23,2 +23,3 @@ var safe = require('../'); | ||
/(x+x+)+y/, | ||
/foo|(x+x+)+y/, | ||
/(a+){10}y/, | ||
@@ -30,3 +31,3 @@ /(a+){2}y/, | ||
test('unsafe regex', function (t) { | ||
t.plan(good.length); | ||
t.plan(bad.length); | ||
bad.forEach(function (re) { | ||
@@ -33,0 +34,0 @@ t.equal(safe(re), false); |
5112
60