multipasta
Advanced tools
Comparing version
@@ -123,9 +123,2 @@ "use strict"; | ||
let chunkLength = chunk.length; | ||
if (chunkLength < state.needleLength) { | ||
if (state.previousChunk === undefined) { | ||
state.previousChunk = chunk; | ||
state.previousChunkLength = chunkLength; | ||
return; | ||
} | ||
} | ||
if (state.previousChunk !== undefined) { | ||
@@ -139,2 +132,7 @@ const newChunk = Buffer.allocUnsafe(state.previousChunkLength + chunkLength); | ||
} | ||
if (chunkLength < state.needleLength) { | ||
state.previousChunk = chunk; | ||
state.previousChunkLength = chunkLength; | ||
return; | ||
} | ||
let pos = 0; | ||
@@ -149,2 +147,3 @@ while (pos < chunkLength) { | ||
pos = match + state.needleLength; | ||
continue; | ||
} else if (chunk[chunkLength - 1] in state.indexes) { | ||
@@ -172,11 +171,8 @@ const indexes = state.indexes[chunk[chunkLength - 1]]; | ||
} | ||
break; | ||
} else if (pos === 0) { | ||
callback(state.matchIndex, chunk); | ||
} else { | ||
if (pos === 0) { | ||
callback(state.matchIndex, chunk); | ||
} else { | ||
callback(state.matchIndex, chunk.subarray(pos)); | ||
} | ||
break; | ||
callback(state.matchIndex, chunk.subarray(pos)); | ||
} | ||
break; | ||
} | ||
@@ -183,0 +179,0 @@ } |
@@ -117,9 +117,2 @@ function noopMatch(_, __) { | ||
let chunkLength = chunk.length; | ||
if (chunkLength < state.needleLength) { | ||
if (state.previousChunk === undefined) { | ||
state.previousChunk = chunk; | ||
state.previousChunkLength = chunkLength; | ||
return; | ||
} | ||
} | ||
if (state.previousChunk !== undefined) { | ||
@@ -133,2 +126,7 @@ const newChunk = Buffer.allocUnsafe(state.previousChunkLength + chunkLength); | ||
} | ||
if (chunkLength < state.needleLength) { | ||
state.previousChunk = chunk; | ||
state.previousChunkLength = chunkLength; | ||
return; | ||
} | ||
let pos = 0; | ||
@@ -143,2 +141,3 @@ while (pos < chunkLength) { | ||
pos = match + state.needleLength; | ||
continue; | ||
} else if (chunk[chunkLength - 1] in state.indexes) { | ||
@@ -166,11 +165,8 @@ const indexes = state.indexes[chunk[chunkLength - 1]]; | ||
} | ||
break; | ||
} else if (pos === 0) { | ||
callback(state.matchIndex, chunk); | ||
} else { | ||
if (pos === 0) { | ||
callback(state.matchIndex, chunk); | ||
} else { | ||
callback(state.matchIndex, chunk.subarray(pos)); | ||
} | ||
break; | ||
callback(state.matchIndex, chunk.subarray(pos)); | ||
} | ||
break; | ||
} | ||
@@ -177,0 +173,0 @@ } |
{ | ||
"name": "multipasta", | ||
"version": "0.1.15", | ||
"version": "0.1.16", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
@@ -180,10 +180,2 @@ interface SearchState { | ||
if (chunkLength < state.needleLength) { | ||
if (state.previousChunk === undefined) { | ||
state.previousChunk = chunk | ||
state.previousChunkLength = chunkLength | ||
return | ||
} | ||
} | ||
if (state.previousChunk !== undefined) { | ||
@@ -200,2 +192,8 @@ const newChunk = Buffer.allocUnsafe( | ||
if (chunkLength < state.needleLength) { | ||
state.previousChunk = chunk | ||
state.previousChunkLength = chunkLength | ||
return | ||
} | ||
let pos = 0 | ||
@@ -211,2 +209,3 @@ while (pos < chunkLength) { | ||
pos = match + state.needleLength | ||
continue | ||
} else if (chunk[chunkLength - 1] in state.indexes) { | ||
@@ -240,11 +239,9 @@ const indexes = state.indexes[chunk[chunkLength - 1]] | ||
} | ||
break | ||
} else if (pos === 0) { | ||
callback(state.matchIndex, chunk) | ||
} else { | ||
if (pos === 0) { | ||
callback(state.matchIndex, chunk) | ||
} else { | ||
callback(state.matchIndex, chunk.subarray(pos)) | ||
} | ||
break | ||
callback(state.matchIndex, chunk.subarray(pos)) | ||
} | ||
break | ||
} | ||
@@ -251,0 +248,0 @@ } |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
186980
-0.19%3106
-0.38%