Comparing version 2.3.2 to 2.3.3
# Changelog | ||
## v2.3.3 | ||
* Fixing again an issue concerning merging an monkeys (thanks to [@abalmos](https://github.com/abalmos) and [@Zache](https://github.com/Zache)). | ||
## v2.3.2 | ||
@@ -4,0 +8,0 @@ |
@@ -390,9 +390,14 @@ /** | ||
var realOperation = operation; | ||
if (/merge/.test(operation.type)) { | ||
if (/merge/i.test(operation.type)) { | ||
var monkeysNode = getIn(this._monkeys, solvedPath).data; | ||
if (_type2['default'].object(monkeysNode)) { | ||
// Cloning the operation not to create weird behavior for the user | ||
realOperation = shallowClone(realOperation); | ||
if (/deep/.test(realOperation.type)) realOperation.value = deepMerge({}, deepClone(monkeysNode), realOperation.value);else realOperation.value = shallowMerge({}, deepClone(monkeysNode), realOperation.value); | ||
// Fetching the existing node in the current data | ||
var currentNode = getIn(this._data, solvedPath).data; | ||
if (/deep/i.test(realOperation.type)) realOperation.value = deepMerge({}, deepMerge({}, currentNode, deepClone(monkeysNode)), realOperation.value);else realOperation.value = shallowMerge({}, deepMerge({}, currentNode, deepClone(monkeysNode)), realOperation.value); | ||
} | ||
@@ -399,0 +404,0 @@ } |
{ | ||
"name": "baobab", | ||
"version": "2.3.2", | ||
"version": "2.3.3", | ||
"description": "JavaScript persistent data tree with cursors.", | ||
@@ -10,3 +10,3 @@ "main": "./dist/baobab.js", | ||
"devDependencies": { | ||
"@yomguithereal/eslint-config": "^1.1.0", | ||
"@yomguithereal/eslint-config": "^1.1.1", | ||
"add-banner": "^0.1.0", | ||
@@ -13,0 +13,0 @@ "async": "^1.2.1", |
@@ -371,12 +371,23 @@ /** | ||
let realOperation = operation; | ||
if (/merge/.test(operation.type)) { | ||
if (/merge/i.test(operation.type)) { | ||
const monkeysNode = getIn(this._monkeys, solvedPath).data; | ||
if (type.object(monkeysNode)) { | ||
// Cloning the operation not to create weird behavior for the user | ||
realOperation = shallowClone(realOperation); | ||
if (/deep/.test(realOperation.type)) | ||
realOperation.value = deepMerge({}, deepClone(monkeysNode), realOperation.value); | ||
// Fetching the existing node in the current data | ||
const currentNode = getIn(this._data, solvedPath).data; | ||
if (/deep/i.test(realOperation.type)) | ||
realOperation.value = deepMerge({}, | ||
deepMerge({}, currentNode, deepClone(monkeysNode)), | ||
realOperation.value | ||
); | ||
else | ||
realOperation.value = shallowMerge({}, deepClone(monkeysNode), realOperation.value); | ||
realOperation.value = shallowMerge({}, | ||
deepMerge({}, currentNode, deepClone(monkeysNode)), | ||
realOperation.value | ||
); | ||
} | ||
@@ -383,0 +394,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
203772
4993