@rimbu/deep
Advanced tools
Comparing version 0.7.0 to 0.7.1
@@ -99,7 +99,14 @@ "use strict"; | ||
var itemPatch = patcher[Patch.MAP]; | ||
var result = arr.slice(); | ||
var result = undefined; | ||
for (var i = 0; i < arr.length; i++) { | ||
result[i] = patchSingle(arr[i], itemPatch, value, root); | ||
var currentItem = arr[i]; | ||
var newItem = patchSingle(currentItem, itemPatch, value, root); | ||
if (!Object.is(newItem, currentItem)) { | ||
if (undefined === result) { | ||
result = arr.slice(); | ||
} | ||
result[i] = newItem; | ||
} | ||
} | ||
return result; | ||
return (result !== null && result !== void 0 ? result : arr); | ||
} | ||
@@ -106,0 +113,0 @@ var clone = valueIsArray ? tslib_1.__spreadArray([], tslib_1.__read(value)) : tslib_1.__assign({}, value); |
@@ -73,7 +73,14 @@ import { RimbuError } from '@rimbu/base'; | ||
const itemPatch = patcher[Patch.MAP]; | ||
const result = arr.slice(); | ||
let result = undefined; | ||
for (let i = 0; i < arr.length; i++) { | ||
result[i] = patchSingle(arr[i], itemPatch, value, root); | ||
const currentItem = arr[i]; | ||
const newItem = patchSingle(currentItem, itemPatch, value, root); | ||
if (!Object.is(newItem, currentItem)) { | ||
if (undefined === result) { | ||
result = arr.slice(); | ||
} | ||
result[i] = newItem; | ||
} | ||
} | ||
return result; | ||
return (result !== null && result !== void 0 ? result : arr); | ||
} | ||
@@ -80,0 +87,0 @@ const clone = valueIsArray ? [...value] : Object.assign({}, value); |
{ | ||
"name": "@rimbu/deep", | ||
"version": "0.7.0", | ||
"version": "0.7.1", | ||
"description": "Tools to use handle plain JS objects as immutable objects", | ||
@@ -48,3 +48,3 @@ "keywords": [ | ||
"bundle:types": "tsc --p tsconfig.types.json", | ||
"clean": "rimraf dist deno_dist", | ||
"clean": "rimraf dist", | ||
"format": "yarn format:base --write", | ||
@@ -60,4 +60,4 @@ "format:base": "prettier \"{!CHANGELOG.md}|**/*.{ts,tsx,js,json,md}\"", | ||
"dependencies": { | ||
"@rimbu/base": "^0.6.1", | ||
"@rimbu/common": "^0.6.1" | ||
"@rimbu/base": "^0.6.2", | ||
"@rimbu/common": "^0.7.0" | ||
}, | ||
@@ -70,3 +70,3 @@ "publishConfig": { | ||
}, | ||
"gitHead": "4990d9a30716d3a5e7117545e5a6ced2d36ae3ad" | ||
"gitHead": "28453a94283b4f6bcdac1a07737b2bd58ece3658" | ||
} |
@@ -144,9 +144,16 @@ import { RimbuError } from '@rimbu/base'; | ||
const result = arr.slice(); | ||
let result: any[] | undefined = undefined; | ||
for (let i = 0; i < arr.length; i++) { | ||
result[i] = patchSingle(arr[i], itemPatch, value, root); | ||
const currentItem = arr[i]; | ||
const newItem = patchSingle(currentItem, itemPatch, value, root); | ||
if (!Object.is(newItem, currentItem)) { | ||
if (undefined === result) { | ||
result = arr.slice(); | ||
} | ||
result[i] = newItem; | ||
} | ||
} | ||
return result as any; | ||
return (result ?? arr) as any; | ||
} | ||
@@ -153,0 +160,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
101940
2180
- Removed@rimbu/common@0.6.1(transitive)
Updated@rimbu/base@^0.6.2
Updated@rimbu/common@^0.7.0