Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

dift

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dift - npm Package Compare versions

Comparing version 0.1.2 to 0.1.3

19

lib/index.js

@@ -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",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc