just-diff-apply
Advanced tools
Comparing version 3.1.0 to 3.1.2
@@ -1,6 +0,1 @@ | ||
var collectionDiffApply = { | ||
diffApply: diffApply, | ||
jsonPatchPathConverter: jsonPatchPathConverter, | ||
}; | ||
/* | ||
@@ -73,3 +68,5 @@ const obj1 = {a: 3, b: 5}; | ||
if (!Array.isArray(thisPath)) { | ||
throw new Error('diff path must be an array, consider supplying a path converter'); | ||
throw new Error( | ||
'diff path must be an array, consider supplying a path converter' | ||
); | ||
} | ||
@@ -83,3 +80,3 @@ } | ||
var thisProp; | ||
while (((thisProp = pathCopy.shift())) != null) { | ||
while ((thisProp = pathCopy.shift()) != null) { | ||
if (!(thisProp in subObject)) { | ||
@@ -92,7 +89,13 @@ subObject[thisProp] = {}; | ||
if (!subObject.hasOwnProperty(lastProp)) { | ||
throw new Error(['expected to find property', thisDiff.path, 'in object', obj].join(' ')); | ||
throw new Error( | ||
['expected to find property', thisDiff.path, 'in object', obj].join( | ||
' ' | ||
) | ||
); | ||
} | ||
} | ||
if (thisOp === REMOVE) { | ||
Array.isArray(subObject) ? subObject.splice(lastProp, 1) : delete subObject[lastProp]; | ||
Array.isArray(subObject) | ||
? subObject.splice(lastProp, 1) | ||
: delete subObject[lastProp]; | ||
} | ||
@@ -110,2 +113,2 @@ if (thisOp === REPLACE || thisOp === ADD) { | ||
export { collectionDiffApply as default }; | ||
export {diffApply, jsonPatchPathConverter}; |
{ | ||
"name": "just-diff-apply", | ||
"version": "3.1.0", | ||
"version": "3.1.2", | ||
"description": "Apply a diff to an object. Optionally supports jsonPatch protocol", | ||
"type": "commonjs", | ||
"main": "index.js", | ||
@@ -7,0 +6,0 @@ "module": "index.esm.js", |
199
9316