buffer-indexof
Advanced tools
Comparing version
10
index.js
@@ -7,2 +7,8 @@ module.exports = function bufferIndexOf(buf,search,offset){ | ||
for(var i=offset;i<buf.length;++i){ | ||
if(buf[i] != search[m]){ | ||
s = -1; | ||
m = 0; | ||
} | ||
if(buf[i] == search[m]) { | ||
@@ -12,6 +18,4 @@ if(s == -1) s = i; | ||
if(m == search.length) break; | ||
} else { | ||
s = -1; | ||
m = 0; | ||
} | ||
} | ||
@@ -18,0 +22,0 @@ |
{ | ||
"name": "buffer-indexof", | ||
"description": "find the index of a buffer in a buffe", | ||
"version": "0.0.2", | ||
"description": "find the index of a buffer in a buffer", | ||
"version": "1.0.0", | ||
"repository": { | ||
@@ -6,0 +6,0 @@ "url": "git://github.com/soldair/node-buffer-indexof.git" |
@@ -30,1 +30,7 @@ [](http://travis-ci.org/soldair/node-buffer-indexof) | ||
``` | ||
CHANGELOG | ||
---------- | ||
- 1.0.0 | ||
- fixed issue finding multibyte needles in haystack. thanks @imulus |
@@ -13,4 +13,6 @@ var test = require('tape'); | ||
t.equals(bindexOf(new Buffer('aaa'), new Buffer('aa'), 2), -1, 'should not match') | ||
t.equals(bindexOf(new Buffer('aaa'), new Buffer('aa'), 2), -1, 'should not match with 2 offset') | ||
t.equals(bindexOf(new Buffer('aaa'), new Buffer('aa')), 0, 'should match') | ||
t.equals(bindexOf(b,newLineBuffer),2,'should find newlines'); | ||
@@ -17,0 +19,0 @@ |
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
3696
20.31%7
16.67%41
32.26%1
-50%36
20%