Skip to content

Commit

Permalink
3.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Starcounter-Jack committed Aug 13, 2021
1 parent e729404 commit 3fcf484
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
12 changes: 6 additions & 6 deletions dist/fast-json-patch.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! fast-json-patch, version: 3.0.0-1 */
/*! fast-json-patch, version: 3.1.0 */
var jsonpatch =
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
Expand Down Expand Up @@ -464,6 +464,9 @@ function applyOperation(document, operation, validateOperation, mutateDocument,
}
while (true) {
key = keys[t];
if (key && key.indexOf('~') != -1) {
key = helpers_js_1.unescapePathComponent(key);
}
if (banPrototypeModifications && key == '__proto__') {
throw new TypeError('JSON-Patch: modifying `__proto__` prop is banned for security reasons, if this was on purpose, please set `banPrototypeModifications` flag false and pass it to this function. More info in fast-json-patch README');
}
Expand Down Expand Up @@ -505,9 +508,6 @@ function applyOperation(document, operation, validateOperation, mutateDocument,
}
}
else {
if (key && key.indexOf('~') != -1) {
key = helpers_js_1.unescapePathComponent(key);
}
if (t >= len) {
var returnValue = objOps[operation.op].call(operation, obj, key, document); // Apply patch
if (returnValue.test === false) {
Expand All @@ -519,7 +519,7 @@ function applyOperation(document, operation, validateOperation, mutateDocument,
obj = obj[key];
// If we have more keys in the path, but the next value isn't a non-null object,
// throw an OPERATION_PATH_UNRESOLVABLE error instead of iterating again.
if (t < len && (!obj || typeof obj !== "object")) {
if (validateOperation && t < len && (!obj || typeof obj !== "object")) {
throw new exports.JsonPatchError('Cannot perform operation at the desired path', 'OPERATION_PATH_UNRESOLVABLE', index, operation, document);
}
}
Expand Down Expand Up @@ -872,7 +872,7 @@ function _generate(mirror, obj, patches, path, invertible) {
var oldVal = mirror[key];
if (helpers_js_1.hasOwnProperty(obj, key) && !(obj[key] === undefined && oldVal !== undefined && Array.isArray(obj) === false)) {
var newVal = obj[key];
if (typeof oldVal == "object" && oldVal != null && typeof newVal == "object" && newVal != null) {
if (typeof oldVal == "object" && oldVal != null && typeof newVal == "object" && newVal != null && Array.isArray(oldVal) === Array.isArray(newVal)) {
_generate(oldVal, newVal, patches, path + "/" + helpers_js_1.escapePathComponent(key), invertible);
}
else {
Expand Down
Loading

0 comments on commit 3fcf484

Please sign in to comment.