Comparing version 2.0.4 to 2.0.5
@@ -0,1 +1,10 @@ | ||
<a name="2.0.5"></a> | ||
## 2.0.5 (2018-06-08) | ||
* Support string as id ([32b8006](https://github.com/kikobeats/hyperdiff/commit/32b8006)), closes [#8](https://github.com/kikobeats/hyperdiff/issues/8) | ||
* Update compositor.json via compositor.io ([3e50f07](https://github.com/kikobeats/hyperdiff/commit/3e50f07)) | ||
* Update node version ([e2c3446](https://github.com/kikobeats/hyperdiff/commit/e2c3446)) | ||
<a name="2.0.4"></a> | ||
@@ -2,0 +11,0 @@ ## 2.0.4 (2017-12-01) |
@@ -17,3 +17,3 @@ 'use strict' | ||
function indexOf (collection, item, props) { | ||
function indexOf (collection, item) { | ||
return collection.indexOf(item) | ||
@@ -32,3 +32,3 @@ } | ||
function determinateFindIndex (props) { | ||
function determinateFindIndex (ids, props) { | ||
return props ? findIndexWithProps : indexOf | ||
@@ -38,8 +38,10 @@ } | ||
function hyperdiff (orig, dist, props) { | ||
const ids = props ? [].concat(props) : [] | ||
const {first, second} = determinateCollections(orig, dist) | ||
const findIndex = determinateFindIndex(props) | ||
const findIndex = determinateFindIndex(ids, props) | ||
debug('preconditions first=%j second=%j findIndex=%s', first, second, findIndex.name) | ||
const results = first.reduce(function (acc, item, index) { | ||
const itemIndex = findIndex(second, item, props) | ||
const itemIndex = findIndex(second, item, ids) | ||
const destination = isPresent(itemIndex) ? 'common' : 'removed' | ||
@@ -46,0 +48,0 @@ acc[destination].push(item) |
@@ -5,3 +5,3 @@ { | ||
"homepage": "https://github.com/Kikobeats/hyperdiff", | ||
"version": "2.0.4", | ||
"version": "2.0.5", | ||
"main": "lib", | ||
@@ -49,3 +49,3 @@ "author": { | ||
"engines": { | ||
"node": ">= 6" | ||
"node": ">= 8" | ||
}, | ||
@@ -52,0 +52,0 @@ "files": [ |
@@ -100,3 +100,2 @@ # hyperdiff | ||
*Required*<br> | ||
Type: `string`|`array`|`function` | ||
@@ -103,0 +102,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
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
9988
43
111