-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
36 lines (29 loc) · 739 Bytes
/
Copy pathindex.js
File metadata and controls
36 lines (29 loc) · 739 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
'use strict';
(function() {
function ChangesStub() {
var self = this;
var changes = {};
self.addInitialChange = function(name, value) {
return change(name, value, undefined, true);
};
self.addChange = function(name, value, oldValue) {
return change(name, value, oldValue, false);
}
self.build = function() {
return changes;
};
function change(name, value, oldValue, isFirst) {
changes[name] = {
currentValue: value,
previousValue: oldValue,
isFirstChange: function() { return isFirst; }
};
return self;
}
}
if (typeof module !== 'undefined' && typeof module.exports !== 'undefined') {
module.exports = ChangesStub;
} else {
window.StubChanges = ChangesStub;
}
})();