Skip to content

Commit 6b34bfe

Browse files
author
Phillip Clark
committedMar 12, 2014
Merge pull request #12 from paulpflug/master
Bugfix for #10, #12
2 parents 55eeee3 + bcf174d commit 6b34bfe

File tree

1 file changed

+2
-30
lines changed

1 file changed

+2
-30
lines changed
 

‎index.js

+2-30
Original file line numberDiff line numberDiff line change
@@ -67,34 +67,6 @@
6767
}
6868
inherits(DiffArray, Diff);
6969

70-
function checkForDiff(object) {
71-
if (object && object.kind && object.path){
72-
switch(object.kind) {
73-
case 'A':
74-
if (object.hasOwnProperty('index') && object.hasOwnProperty('item')){
75-
return true;
76-
}
77-
break;
78-
case 'D':
79-
if (object.hasOwnProperty('lhs')){
80-
return true;
81-
}
82-
break;
83-
case 'E':
84-
if (object.hasOwnProperty('lhs') && object.hasOwnProperty('rhs')){
85-
return true;
86-
}
87-
break;
88-
case 'N':
89-
if (object.hasOwnProperty('rhs')){
90-
return true;
91-
}
92-
break;
93-
}
94-
}
95-
return false;
96-
}
97-
9870
function arrayRemove(arr, from, to) {
9971
var rest = arr.slice((to || from) + 1 || arr.length);
10072
arr.length = from < 0 ? arr.length + from : from;
@@ -217,8 +189,8 @@
217189
}
218190

219191
function applyChange(target, source, change) {
220-
if (!checkForDiff(change)) {
221-
throw new TypeError('[Object] Required properties on change are missing');
192+
if (!(change instanceof Diff)) {
193+
throw new TypeError('[Object] change must be instanceof Diff');
222194
}
223195
if (target && source && change) {
224196
var it = target, i, u;

0 commit comments

Comments
 (0)
Please sign in to comment.