Comparing version 2.3.1 to 2.3.2
# Changelog | ||
## v2.3.2 | ||
* Fixing issue concerning merging and monkeys. | ||
* Fixing path coercion in monkeys' dependencies. | ||
## v2.3.1 | ||
@@ -4,0 +9,0 @@ |
@@ -56,2 +56,3 @@ /** | ||
var makeError = helpers.makeError; | ||
var deepClone = helpers.deepClone; | ||
var deepMerge = helpers.deepMerge; | ||
@@ -396,3 +397,3 @@ var shallowClone = helpers.shallowClone; | ||
if (/deep/.test(realOperation.type)) realOperation.value = deepMerge({}, monkeysNode, realOperation.value);else realOperation.value = shallowMerge({}, monkeysNode, realOperation.value); | ||
if (/deep/.test(realOperation.type)) realOperation.value = deepMerge({}, deepClone(monkeysNode), realOperation.value);else realOperation.value = shallowMerge({}, deepClone(monkeysNode), realOperation.value); | ||
} | ||
@@ -599,3 +600,3 @@ } | ||
*/ | ||
Baobab.VERSION = '2.3.1'; | ||
Baobab.VERSION = '2.3.2'; | ||
module.exports = exports['default']; |
@@ -211,3 +211,3 @@ /* eslint eqeqeq: 0 */ | ||
function cloner(deep, item) { | ||
if (!item || typeof item !== 'object' || item instanceof Error || item instanceof _monkey.MonkeyDefinition || 'ArrayBuffer' in global && item instanceof ArrayBuffer) return item; | ||
if (!item || typeof item !== 'object' || item instanceof Error || item instanceof _monkey.MonkeyDefinition || item instanceof _monkey.Monkey || 'ArrayBuffer' in global && item instanceof ArrayBuffer) return item; | ||
@@ -494,2 +494,5 @@ // Array | ||
// Coercing to array | ||
to = [].concat(to); | ||
for (var i = 0, l = to.length; i < l; i++) { | ||
@@ -582,2 +585,8 @@ var step = to[i]; | ||
// Solving startIndex | ||
if (_type2['default']['function'](startIndex)) startIndex = index(array, startIndex); | ||
if (_type2['default'].object(startIndex)) startIndex = index(array, function (e) { | ||
return compare(e, startIndex); | ||
}); | ||
// Positive index | ||
@@ -584,0 +593,0 @@ |
@@ -71,2 +71,8 @@ /** | ||
// Coercing paths for convenience | ||
this.paths = this.paths.map(function (p) { | ||
return [].concat(p); | ||
}); | ||
// Does the definition contain dynamic paths | ||
this.hasDynamicPaths = this.paths.some(_type2['default'].dynamicPath); | ||
@@ -73,0 +79,0 @@ } |
{ | ||
"name": "baobab", | ||
"version": "2.3.1", | ||
"version": "2.3.2", | ||
"description": "JavaScript persistent data tree with cursors.", | ||
@@ -5,0 +5,0 @@ "main": "./dist/baobab.js", |
@@ -329,3 +329,3 @@ [![Build Status](https://travis-ci.org/Yomguithereal/baobab.svg)](https://travis-ci.org/Yomguithereal/baobab) | ||
var inc = function(nb) { | ||
return inc + 1; | ||
return nb + 1; | ||
}; | ||
@@ -541,4 +541,4 @@ | ||
// Retrieving or selecting data by passing a descriptor object in the path | ||
var complexCursor = tree.select('items', {id: 'one'}, 'value'); | ||
tree.get('items', {id: 'one'}, 'value'); | ||
var complexCursor = tree.select('palette', 'items', {id: 'one'}, 'value'); | ||
tree.get('palette', 'items', {id: 'one'}, 'value'); | ||
>>> 'Hey' | ||
@@ -545,0 +545,0 @@ |
@@ -21,2 +21,3 @@ /** | ||
makeError, | ||
deepClone, | ||
deepMerge, | ||
@@ -378,5 +379,5 @@ shallowClone, | ||
if (/deep/.test(realOperation.type)) | ||
realOperation.value = deepMerge({}, monkeysNode, realOperation.value); | ||
realOperation.value = deepMerge({}, deepClone(monkeysNode), realOperation.value); | ||
else | ||
realOperation.value = shallowMerge({}, monkeysNode, realOperation.value); | ||
realOperation.value = shallowMerge({}, deepClone(monkeysNode), realOperation.value); | ||
} | ||
@@ -584,2 +585,2 @@ } | ||
*/ | ||
Baobab.VERSION = '2.3.1'; | ||
Baobab.VERSION = '2.3.2'; |
@@ -175,2 +175,3 @@ /* eslint eqeqeq: 0 */ | ||
item instanceof MonkeyDefinition || | ||
item instanceof Monkey || | ||
('ArrayBuffer' in global && item instanceof ArrayBuffer)) | ||
@@ -479,2 +480,5 @@ return item; | ||
// Coercing to array | ||
to = [].concat(to); | ||
for (let i = 0, l = to.length; i < l; i++) { | ||
@@ -564,2 +568,8 @@ const step = to[i]; | ||
// Solving startIndex | ||
if (type.function(startIndex)) | ||
startIndex = index(array, startIndex); | ||
if (type.object(startIndex)) | ||
startIndex = index(array, e => compare(e, startIndex)); | ||
// Positive index | ||
@@ -566,0 +576,0 @@ if (startIndex >= 0) |
@@ -59,2 +59,6 @@ /** | ||
// Coercing paths for convenience | ||
this.paths = this.paths.map(p => [].concat(p)); | ||
// Does the definition contain dynamic paths | ||
this.hasDynamicPaths = this.paths.some(type.dynamicPath); | ||
@@ -61,0 +65,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
203027
4981