Comparing version 0.1.2 to 0.1.3
@@ -27,3 +27,3 @@ /** | ||
if (nextLen === 0) return;else { | ||
// All removes | ||
// All creates | ||
for (var i = 0; i < nextLen; i++) { | ||
@@ -35,3 +35,3 @@ effect(CREATE, null, next[i], i); | ||
} else if (nextLen === 0) { | ||
// All creates | ||
// All removes | ||
for (var i = 0; i < prevLen; i++) { | ||
@@ -62,3 +62,3 @@ effect(REMOVE, prev[i], null, i); | ||
// Fast-path at this particular point because the "no change" case that this covers | ||
// is orders magnitude more common than the others | ||
// is orders of magnitude more common than the others | ||
if (nStartIdx === nextLen && pStartIdx === prevLen) { | ||
@@ -88,3 +88,3 @@ return; | ||
var prevMap = keyMap(prev, pStartIdx, pEndIdx + 1); | ||
var prevMap = keyMap(prev, pStartIdx, pEndIdx + 1, key); | ||
var keep = {}; | ||
@@ -105,7 +105,6 @@ | ||
// If there are no creations, then you have to | ||
// remove exactly prevLen - nextLen elements in this | ||
// diff. You have to remove one more for each element | ||
// that was created. This means once we have | ||
// remove exactly max(prevLen - nextLen, 0) elements in this | ||
// diff. You have to remove one more for each element | ||
// that was created. This means once we have | ||
// removed that many, we can stop. | ||
var necessaryRemovals = prevLen - nextLen + created; | ||
@@ -132,7 +131,7 @@ for (var removals = 0; removals < necessaryRemovals; pStartItem = prev[++pStartIdx]) { | ||
function keyMap(items, start, end) { | ||
function keyMap(items, start, end, key) { | ||
var map = {}; | ||
for (var i = start; i < end; ++i) { | ||
map[items[i].key] = i; | ||
map[key(items[i])] = i; | ||
} | ||
@@ -139,0 +138,0 @@ |
@@ -5,3 +5,3 @@ { | ||
"repository": "git://github.com/ashaffer/dift.git", | ||
"version": "0.1.2", | ||
"version": "0.1.3", | ||
"license": "MIT", | ||
@@ -8,0 +8,0 @@ "main": "lib/index.js", |
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
11587