-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathArrayDiffElement.js
More file actions
37 lines (27 loc) · 803 Bytes
/
ArrayDiffElement.js
File metadata and controls
37 lines (27 loc) · 803 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
(function() {
function defineArrayDiffElement() {
function ArrayDiffElement(item, newIndex, oldIndex) {
this.item = item;
this.newIndex = newIndex;
this.oldIndex = oldIndex;
}
ArrayDiffElement.prototype.added = function() {
return this.oldIndex === undefined;
};
ArrayDiffElement.prototype.removed = function() {
return this.newIndex === undefined;
};
ArrayDiffElement.prototype.common = function() {
return this.oldIndex !== undefined && this.newIndex !== undefined;
};
return ArrayDiffElement;
}
// Use define() if using AMD/RequireJS
if (typeof define === 'function' && define.amd) {
define([], defineArrayDiffElement);
}
// Otherwise define it in the global context
else {
self.ArrayDiffElement = defineArrayDiffElement();
}
})();