Skip to content

Commit

Permalink
bugfix: Generated patch contains array length (closes #14) (tests a…
Browse files Browse the repository at this point in the history
…lready present)
  • Loading branch information
warpech committed Oct 10, 2013
1 parent 2e451ef commit c3702e9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
3 changes: 1 addition & 2 deletions src/json-patch-duplex.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ var jsonpatch;

var a = 0, alen = arr.length;
while (a < alen) {
if (arr[a].name != "____Path") {
if (!(arr[a].name === '____Path') && !(arr[a].name === 'length' && _isArray(arr[a].object)) && !(arr[a].name === '__Jasmine_been_here_before__')) {
observeOps[arr[a].type].call(arr[a], patches, arr[a].object.____Path);
}
a++;
Expand Down Expand Up @@ -367,4 +367,3 @@ if (typeof exports !== "undefined") {
exports.unobserve = jsonpatch.unobserve;
exports.generate = jsonpatch.generate;
}
//# sourceMappingURL=json-patch-duplex.js.map
6 changes: 5 additions & 1 deletion src/json-patch-duplex.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,11 @@ module jsonpatch {
var a = 0
, alen = arr.length;
while (a < alen) {
if (arr[a].name != "____Path") {
if (
!(arr[a].name === '____Path')
&& !(arr[a].name === 'length' && _isArray(arr[a].object))
&& !(arr[a].name === '__Jasmine_been_here_before__')
) {
observeOps[arr[a].type].call(arr[a], patches, arr[a].object.____Path);
}
a++;
Expand Down

0 comments on commit c3702e9

Please sign in to comment.