-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
41 lines (34 loc) · 865 Bytes
/
script.js
File metadata and controls
41 lines (34 loc) · 865 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
38
39
40
41
require.config({
paths: {
ObjectComparer: 'src/ObjectComparer'
}
});
require([
'ObjectComparer'
], function (
ObjectComparer
) {
var comparer1, comparer2, Obj1, Obj2,
func = function () {},
properties = {
a: 1,
b: true,
c: 'string',
d: [],
e: {}
};
Obj1 = function (properties) {
this.func = func;
this.properties = properties;
};
Obj2 = function (properties) {
this.properties = properties;
};
Obj2.prototype.func = func;
obj1 = new Obj1(properties);
obj2 = new Obj2(properties);
comparer1 = new ObjectComparer();
comparer2 = new ObjectComparer(true); // do not use hasOwnProperty()
console.log(comparer1.areEqual(obj1, obj2));
console.log(comparer2.areEqual(obj1, obj2));
});