Comparing version 1.0.0 to 1.0.1
@@ -97,2 +97,16 @@ // Load modules | ||
internals._indexOf = function (haystack, needle) { | ||
Hoek.assert(haystack, 'Missing haystack'); | ||
for (var i = 0, il = haystack.length - needle.length; i <= il; ++i) { // Has enough room to fit the entire needle | ||
if (haystack.startsWith(needle.value, i)) { | ||
return i; | ||
} | ||
} | ||
return -1; | ||
}; | ||
exports.Stream = internals.Stream = function (needle) { | ||
@@ -106,2 +120,3 @@ | ||
this._haystack = new Vise(); | ||
this._indexOf = this._needle.length > 2 ? exports.horspool : internals._indexOf; | ||
@@ -137,3 +152,3 @@ this.on('finish', function () { | ||
var match = exports.horspool(this._haystack, this._needle); | ||
var match = this._indexOf(this._haystack, this._needle); | ||
if (match === -1 && | ||
@@ -150,3 +165,3 @@ chunk.length >= this._needle.length) { | ||
match = exports.horspool(this._haystack, this._needle); | ||
match = this._indexOf(this._haystack, this._needle); | ||
} | ||
@@ -153,0 +168,0 @@ |
{ | ||
"name": "nigel", | ||
"description": "BoyerMooreHorspool algorithms", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"repository": "git://github.com/hapijs/nigel", | ||
@@ -6,0 +6,0 @@ "main": "index", |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
22828
476
0