🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Sign inDemoInstall
Socket

buffer-indexof

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

buffer-indexof - npm Package Compare versions

Comparing version

to
1.0.0

test/multibyteneedle.js

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 @@ [![Build Status](https://secure.travis-ci.org/soldair/node-buffer-indexof.png)](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 @@