fs-tree-diff
Advanced tools
Comparing version 0.4.3 to 0.4.4
@@ -20,3 +20,15 @@ 'use strict'; | ||
} else { | ||
this.entries = new Set(options.entries || [], 'relativePath'); | ||
var inputs = options.entries || []; | ||
this.entries = new Set(inputs, 'relativePath'); | ||
if (this.entries.size !== inputs.length) { | ||
var uniqInputs = new Set(); | ||
for (var i=0; i<inputs.length; ++i) { | ||
if (uniqInputs.has(inputs[i].relativePath)) { | ||
throw new Error('Duplicate Entry "' + inputs[i].relativePath + '"'); | ||
} | ||
uniqInputs.add(inputs[i].relativePath); | ||
} | ||
} | ||
} | ||
@@ -77,3 +89,3 @@ } | ||
// TODO: addEntries should be combined with th preOrderDepthReducer and return addOps | ||
// TODO: addEntries should be combined with the preOrderDepthReducer and return addOps | ||
tree.addEntries(fsAddTree.entries); | ||
@@ -80,0 +92,0 @@ var createOps = tree.preOrderDepthReducer(reduceAdditions, []); |
{ | ||
"name": "fs-tree-diff", | ||
"version": "0.4.3", | ||
"version": "0.4.4", | ||
"description": "Backs out file tree changes", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -13,3 +13,3 @@ # fs-tree-diff [![Build Status](https://travis-ci.org/stefanpenner/fs-tree-diff.svg)](https://travis-ci.org/stefanpenner/fs-tree-diff) | ||
* `create` – create the specified file | ||
* `update` – update the specified file | ||
* `change` – update the specified file to reflect changes | ||
@@ -16,0 +16,0 @@ The operations choosen aim to minimize the amount of IO required to apply a given patch. |
@@ -143,2 +143,11 @@ 'use strict'; | ||
}); | ||
it('throws an error for duplicate paths', function() { | ||
expect(function () { | ||
fsTree.calculatePatch(FSTree.fromEntries([ | ||
file('a/foo.js', { size: 1, mtime: 1 }), | ||
file('a/foo.js', { size: 1, mtime: 2 }), | ||
])); | ||
}).to.throw('Duplicate Entry "a/foo.js"'); | ||
}); | ||
}); | ||
@@ -145,0 +154,0 @@ }); |
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
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
31772
13
783
1