Skip to content

Commit

Permalink
fix new array tracked as object
Browse files Browse the repository at this point in the history
  • Loading branch information
Barak Edry committed Mar 30, 2017
1 parent b5a0342 commit 0f423c4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions lib/diff-tracker.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,16 @@ function addChildTracker(childTracker, key) {
}
}

module.exports.create = function createDiffTracker() {
module.exports.create = function createDiffTracker(diffsAsArray) {
return {
hasAdditions: false,
hasDeletions: false,
hasUpdates: false,
hasDifferences: false,
additions: {},
additions: diffsAsArray ? [] : {},
deletions: {},
updates: {},
differences: {},
differences: diffsAsArray ? [] : {},
addChildTracking: addChildTracker
};
};
2 changes: 1 addition & 1 deletion lib/merge-diff.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ MergeDiff.prototype._mergeObject = function (source, delta, path, options, level
isSourceArray = _.isArray(source);

if (options.emitEvents) {
levelDiffs = DiffTracker.create();
levelDiffs = DiffTracker.create(isSourceArray && source.length === 0 && _.isArray(delta));
levelDiffs.path = path;
}

Expand Down

0 comments on commit 0f423c4

Please sign in to comment.