character-parser
Advanced tools
Comparing version 2.1.1 to 2.2.0
12
index.js
'use strict'; | ||
var objIsRegex = require('is-regex'); | ||
exports = (module.exports = parse); | ||
@@ -51,3 +53,3 @@ | ||
while (index < src.length) { | ||
if ((options.ignoreNesting || !state.isNesting(options)) && startsWith(src, delimiter, index)) { | ||
if ((options.ignoreNesting || !state.isNesting(options)) && matches(src, delimiter, index)) { | ||
var end = index; | ||
@@ -224,4 +226,8 @@ return { | ||
function startsWith(str, start, i) { | ||
return str.substr(i || 0, start.length) === start; | ||
function matches(str, matcher, i) { | ||
if (objIsRegex(matcher)) { | ||
return matcher.test(str.substr(i || 0)); | ||
} else { | ||
return str.substr(i || 0, matcher.length) === matcher; | ||
} | ||
} | ||
@@ -228,0 +234,0 @@ |
{ | ||
"name": "character-parser", | ||
"version": "2.1.1", | ||
"version": "2.2.0", | ||
"description": "Parse JavaScript one character at a time to look for snippets in Templates. This is not a validator, it's just designed to allow you to have sections of JavaScript delimited by brackets robustly.", | ||
@@ -29,3 +29,6 @@ "main": "index.js", | ||
"testit": "~2.0.2" | ||
}, | ||
"dependencies": { | ||
"is-regex": "^1.0.3" | ||
} | ||
} | ||
} |
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
17331
276
1
+ Addedis-regex@^1.0.3
+ Addedcall-bind@1.0.7(transitive)
+ Addeddefine-data-property@1.1.4(transitive)
+ Addedes-define-property@1.0.0(transitive)
+ Addedes-errors@1.3.0(transitive)
+ Addedfunction-bind@1.1.2(transitive)
+ Addedget-intrinsic@1.2.4(transitive)
+ Addedgopd@1.0.1(transitive)
+ Addedhas-property-descriptors@1.0.2(transitive)
+ Addedhas-proto@1.0.3(transitive)
+ Addedhas-symbols@1.0.3(transitive)
+ Addedhas-tostringtag@1.0.2(transitive)
+ Addedhasown@2.0.2(transitive)
+ Addedis-regex@1.1.4(transitive)
+ Addedset-function-length@1.2.2(transitive)