ende 0.5.6 → 0.5.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/component.json +2 -2
- data/components/component/bind/{0.0.1 → 1.0.0}/component.json +1 -1
- data/components/component/bind/{0.0.1 → 1.0.0}/index.js +1 -2
- data/components/component/jquery/1.0.0/component.json +10 -0
- data/components/component/jquery/1.0.0/index.js +10308 -0
- data/components/component/matches-selector/{0.1.2 → 0.1.4}/component.json +1 -1
- data/components/component/matches-selector/{0.1.2 → 0.1.4}/index.js +0 -0
- data/components/indefinido/advisable/master/component.json +1 -1
- data/components/indefinido/indemma/master/component.json +4 -7
- data/components/indefinido/indemma/master/lib/record.js +7 -2
- data/components/indefinido/indemma/master/lib/record/dirtyable.js +15 -6
- data/components/indefinido/indemma/master/lib/record/scopable.js +1 -1
- data/components/indefinido/observable/es6-modules/component.json +1 -1
- data/components/indefinido/observable/es6-modules/lib/legacy/schedulerable.js +8 -3
- data/components/indefinido/observable/es6-modules/lib/observable.js +0 -1
- data/components/indefinido/observable/es6-modules/lib/observable/observation.js +2 -2
- data/components/paulmillr/es6-shim/{0.10.1 → 0.14.0}/component.json +1 -1
- data/components/paulmillr/es6-shim/{0.10.1 → 0.14.0}/es6-shim.js +151 -102
- data/components/pluma/assimilate/{0.3.0 → 0.4.0}/component.json +2 -2
- data/components/pluma/assimilate/{0.3.0 → 0.4.0}/dist/assimilate.js +1 -1
- data/lib/assets/javascripts/aura/extensions/rivets.js.coffee +12 -6
- data/lib/assets/javascripts/config/load_components.js.coffee +1 -1
- data/lib/assets/javascripts/ende.js.coffee +1 -1
- data/lib/ende/version.rb +1 -1
- data/vendor/assets/component/build.css +112 -0
- data/vendor/assets/components/ende_build.js +20357 -19584
- metadata +13 -84
- data/components/chaijs/assertion-error/1.0.0/component.json +0 -18
- data/components/chaijs/assertion-error/1.0.0/index.js +0 -110
- data/components/chaijs/chai/1.9.1/.gitignore +0 -22
- data/components/chaijs/chai/1.9.1/.mailmap +0 -1
- data/components/chaijs/chai/1.9.1/.npmignore +0 -14
- data/components/chaijs/chai/1.9.1/.travis.yml +0 -14
- data/components/chaijs/chai/1.9.1/CONTRIBUTING.md +0 -173
- data/components/chaijs/chai/1.9.1/History.md +0 -895
- data/components/chaijs/chai/1.9.1/Makefile +0 -93
- data/components/chaijs/chai/1.9.1/README.md +0 -99
- data/components/chaijs/chai/1.9.1/ReleaseNotes.md +0 -482
- data/components/chaijs/chai/1.9.1/bower.json +0 -27
- data/components/chaijs/chai/1.9.1/chai.js +0 -4782
- data/components/chaijs/chai/1.9.1/component.json +0 -50
- data/components/chaijs/chai/1.9.1/index.js +0 -1
- data/components/chaijs/chai/1.9.1/karma.conf.js +0 -28
- data/components/chaijs/chai/1.9.1/karma.sauce.js +0 -41
- data/components/chaijs/chai/1.9.1/lib/chai.js +0 -87
- data/components/chaijs/chai/1.9.1/lib/chai/assertion.js +0 -130
- data/components/chaijs/chai/1.9.1/lib/chai/config.js +0 -50
- data/components/chaijs/chai/1.9.1/lib/chai/core/assertions.js +0 -1314
- data/components/chaijs/chai/1.9.1/lib/chai/interface/assert.js +0 -1056
- data/components/chaijs/chai/1.9.1/lib/chai/interface/expect.js +0 -12
- data/components/chaijs/chai/1.9.1/lib/chai/interface/should.js +0 -78
- data/components/chaijs/chai/1.9.1/lib/chai/utils/addChainableMethod.js +0 -111
- data/components/chaijs/chai/1.9.1/lib/chai/utils/addMethod.js +0 -43
- data/components/chaijs/chai/1.9.1/lib/chai/utils/addProperty.js +0 -40
- data/components/chaijs/chai/1.9.1/lib/chai/utils/flag.js +0 -32
- data/components/chaijs/chai/1.9.1/lib/chai/utils/getActual.js +0 -18
- data/components/chaijs/chai/1.9.1/lib/chai/utils/getEnumerableProperties.js +0 -25
- data/components/chaijs/chai/1.9.1/lib/chai/utils/getMessage.js +0 -49
- data/components/chaijs/chai/1.9.1/lib/chai/utils/getName.js +0 -20
- data/components/chaijs/chai/1.9.1/lib/chai/utils/getPathValue.js +0 -102
- data/components/chaijs/chai/1.9.1/lib/chai/utils/getProperties.js +0 -35
- data/components/chaijs/chai/1.9.1/lib/chai/utils/index.js +0 -114
- data/components/chaijs/chai/1.9.1/lib/chai/utils/inspect.js +0 -320
- data/components/chaijs/chai/1.9.1/lib/chai/utils/objDisplay.js +0 -49
- data/components/chaijs/chai/1.9.1/lib/chai/utils/overwriteChainableMethod.js +0 -53
- data/components/chaijs/chai/1.9.1/lib/chai/utils/overwriteMethod.js +0 -51
- data/components/chaijs/chai/1.9.1/lib/chai/utils/overwriteProperty.js +0 -54
- data/components/chaijs/chai/1.9.1/lib/chai/utils/test.js +0 -26
- data/components/chaijs/chai/1.9.1/lib/chai/utils/transferFlags.js +0 -44
- data/components/chaijs/chai/1.9.1/lib/chai/utils/type.js +0 -45
- data/components/chaijs/chai/1.9.1/package.json +0 -42
- data/components/chaijs/chai/1.9.1/sauce.browsers.js +0 -128
- data/components/chaijs/chai/1.9.1/support/sauce/sauce_connect_block.sh +0 -7
- data/components/chaijs/chai/1.9.1/support/sauce/sauce_connect_setup.sh +0 -53
- data/components/chaijs/chai/1.9.1/test/assert.js +0 -638
- data/components/chaijs/chai/1.9.1/test/auth/.gitkeep +0 -0
- data/components/chaijs/chai/1.9.1/test/bootstrap/index.js +0 -22
- data/components/chaijs/chai/1.9.1/test/bootstrap/karma.js +0 -22
- data/components/chaijs/chai/1.9.1/test/configuration.js +0 -133
- data/components/chaijs/chai/1.9.1/test/display/errors.js +0 -14
- data/components/chaijs/chai/1.9.1/test/display/message.js +0 -47
- data/components/chaijs/chai/1.9.1/test/expect.js +0 -814
- data/components/chaijs/chai/1.9.1/test/globalShould.js +0 -15
- data/components/chaijs/chai/1.9.1/test/plugins.js +0 -24
- data/components/chaijs/chai/1.9.1/test/should.js +0 -744
- data/components/chaijs/chai/1.9.1/test/utilities.js +0 -309
- data/components/chaijs/deep-eql/0.1.3/component.json +0 -20
- data/components/chaijs/deep-eql/0.1.3/lib/eql.js +0 -257
- data/components/chaijs/type-detect/0.1.1/component.json +0 -18
- data/components/chaijs/type-detect/0.1.1/lib/type.js +0 -142
- data/components/component/classes/1.2.1/component.json +0 -19
- data/components/component/classes/1.2.1/index.js +0 -184
- data/components/component/domify/1.2.2/component.json +0 -22
- data/components/component/domify/1.2.2/index.js +0 -87
- data/components/component/event/0.1.3/component.json +0 -13
- data/components/component/event/0.1.3/index.js +0 -35
- data/components/component/jquery/1.9.1/component.json +0 -14
- data/components/component/jquery/1.9.1/index.js +0 -9601
- data/components/component/query/0.0.3/component.json +0 -23
- data/components/component/query/0.0.3/index.js +0 -21
- data/lib/tasks/.gitkeep +0 -0
|
@@ -1,309 +0,0 @@
|
|
|
1
|
-
describe('utilities', function () {
|
|
2
|
-
var expect = chai.expect;
|
|
3
|
-
|
|
4
|
-
after(function() {
|
|
5
|
-
// Some clean-up so we can run tests in a --watch
|
|
6
|
-
delete chai.Assertion.prototype.eqqqual;
|
|
7
|
-
delete chai.Assertion.prototype.result;
|
|
8
|
-
delete chai.Assertion.prototype.doesnotexist;
|
|
9
|
-
});
|
|
10
|
-
|
|
11
|
-
it('_obj', function () {
|
|
12
|
-
var foo = 'bar'
|
|
13
|
-
, test = expect(foo);
|
|
14
|
-
|
|
15
|
-
expect(test).to.have.property('_obj', foo);
|
|
16
|
-
|
|
17
|
-
var bar = 'baz';
|
|
18
|
-
test._obj = bar;
|
|
19
|
-
|
|
20
|
-
expect(test).to.have.property('_obj', bar);
|
|
21
|
-
test.equal(bar);
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
it('transferFlags', function () {
|
|
25
|
-
var foo = 'bar'
|
|
26
|
-
, test = expect(foo).not;
|
|
27
|
-
|
|
28
|
-
chai.use(function (_chai, utils) {
|
|
29
|
-
var obj = {};
|
|
30
|
-
utils.transferFlags(test, obj);
|
|
31
|
-
expect(utils.flag(obj, 'object')).to.equal(foo);
|
|
32
|
-
expect(utils.flag(obj, 'negate')).to.equal(true);
|
|
33
|
-
});
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
it('transferFlags, includeAll = false', function () {
|
|
37
|
-
var foo = 'bar';
|
|
38
|
-
|
|
39
|
-
chai.use(function (_chai, utils) {
|
|
40
|
-
var obj = {};
|
|
41
|
-
var test = function() {};
|
|
42
|
-
|
|
43
|
-
var assertion = new chai.Assertion({}, "message", test);
|
|
44
|
-
var flag = {};
|
|
45
|
-
utils.flag(obj, 'flagMe', flag);
|
|
46
|
-
utils.flag(obj, 'negate', true);
|
|
47
|
-
utils.transferFlags(test, obj, false);
|
|
48
|
-
|
|
49
|
-
expect(utils.flag(obj, 'object')).to.equal(undefined);
|
|
50
|
-
expect(utils.flag(obj, 'message')).to.equal(undefined);
|
|
51
|
-
expect(utils.flag(obj, 'ssfi')).to.equal(undefined);
|
|
52
|
-
expect(utils.flag(obj, 'negate')).to.equal(true);
|
|
53
|
-
expect(utils.flag(obj, 'flagMe')).to.equal(flag);
|
|
54
|
-
});
|
|
55
|
-
});
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
it('getPathValue', function () {
|
|
59
|
-
var object = {
|
|
60
|
-
hello: 'universe'
|
|
61
|
-
, universe: {
|
|
62
|
-
hello: 'world'
|
|
63
|
-
}
|
|
64
|
-
, world: [ 'hello', 'universe' ]
|
|
65
|
-
, complex: [
|
|
66
|
-
{ hello: 'universe' }
|
|
67
|
-
, { universe: 'world' }
|
|
68
|
-
, [ { hello: 'world' } ]
|
|
69
|
-
]
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
var arr = [ [ true ] ];
|
|
73
|
-
|
|
74
|
-
chai.use(function (_chai, utils) {
|
|
75
|
-
var gpv = utils.getPathValue;
|
|
76
|
-
expect(gpv('hello', object)).to.equal('universe');
|
|
77
|
-
expect(gpv('universe.hello', object)).to.equal('world');
|
|
78
|
-
expect(gpv('world[1]', object)).to.equal('universe');
|
|
79
|
-
expect(gpv('complex[1].universe', object)).to.equal('world');
|
|
80
|
-
expect(gpv('complex[2][0].hello', object)).to.equal('world');
|
|
81
|
-
expect(gpv('[0][0]', arr)).to.be.true;
|
|
82
|
-
});
|
|
83
|
-
});
|
|
84
|
-
|
|
85
|
-
it('addMethod', function () {
|
|
86
|
-
chai.use(function(_chai, utils) {
|
|
87
|
-
expect(_chai.Assertion).to.not.respondTo('eqqqual');
|
|
88
|
-
_chai.Assertion.addMethod('eqqqual', function (str) {
|
|
89
|
-
var object = utils.flag(this, 'object');
|
|
90
|
-
new _chai.Assertion(object).to.be.eql(str);
|
|
91
|
-
});
|
|
92
|
-
expect(_chai.Assertion).to.respondTo('eqqqual');
|
|
93
|
-
});
|
|
94
|
-
|
|
95
|
-
expect('spec').to.eqqqual('spec');
|
|
96
|
-
});
|
|
97
|
-
|
|
98
|
-
it('addMethod returning result', function () {
|
|
99
|
-
chai.use(function(_chai, utils) {
|
|
100
|
-
_chai.Assertion.addMethod('result', function () {
|
|
101
|
-
return 'result';
|
|
102
|
-
})
|
|
103
|
-
});
|
|
104
|
-
|
|
105
|
-
expect(expect('foo').result()).to.equal('result');
|
|
106
|
-
});
|
|
107
|
-
|
|
108
|
-
it('overwriteMethod', function () {
|
|
109
|
-
chai.use(function (_chai, _) {
|
|
110
|
-
expect(_chai.Assertion).to.respondTo('eqqqual');
|
|
111
|
-
_chai.Assertion.overwriteMethod('eqqqual', function (_super) {
|
|
112
|
-
return function (str) {
|
|
113
|
-
var object = _.flag(this, 'object');
|
|
114
|
-
if (object == 'cucumber' && str == 'cuke') {
|
|
115
|
-
_.flag(this, 'cucumber', true);
|
|
116
|
-
} else {
|
|
117
|
-
_super.apply(this, arguments);
|
|
118
|
-
}
|
|
119
|
-
};
|
|
120
|
-
});
|
|
121
|
-
|
|
122
|
-
});
|
|
123
|
-
|
|
124
|
-
var vege = expect('cucumber').to.eqqqual('cucumber');
|
|
125
|
-
expect(vege.__flags).to.not.have.property('cucumber');
|
|
126
|
-
var cuke = expect('cucumber').to.eqqqual('cuke');
|
|
127
|
-
expect(cuke.__flags).to.have.property('cucumber');
|
|
128
|
-
|
|
129
|
-
chai.use(function (_chai, _) {
|
|
130
|
-
expect(_chai.Assertion).to.not.respondTo('doesnotexist');
|
|
131
|
-
_chai.Assertion.overwriteMethod('doesnotexist', function (_super) {
|
|
132
|
-
expect(_super).to.be.a('function');
|
|
133
|
-
return function () {
|
|
134
|
-
_.flag(this, 'doesnt', true);
|
|
135
|
-
_super.apply(this, arguments);
|
|
136
|
-
}
|
|
137
|
-
});
|
|
138
|
-
});
|
|
139
|
-
|
|
140
|
-
var dne = expect('something').to.doesnotexist();
|
|
141
|
-
expect(dne.__flags).to.have.property('doesnt');
|
|
142
|
-
});
|
|
143
|
-
|
|
144
|
-
it('overwriteMethod returning result', function () {
|
|
145
|
-
chai.use(function (_chai, _) {
|
|
146
|
-
_chai.Assertion.overwriteMethod('result', function (_super) {
|
|
147
|
-
return function () {
|
|
148
|
-
return 'result';
|
|
149
|
-
}
|
|
150
|
-
});
|
|
151
|
-
});
|
|
152
|
-
|
|
153
|
-
expect(expect('foo').result()).to.equal('result');
|
|
154
|
-
});
|
|
155
|
-
|
|
156
|
-
it('addProperty', function () {
|
|
157
|
-
chai.use(function (_chai, _) {
|
|
158
|
-
_chai.Assertion.addProperty('tea', function () {
|
|
159
|
-
_.flag(this, 'tea', 'chai');
|
|
160
|
-
});
|
|
161
|
-
});
|
|
162
|
-
|
|
163
|
-
var assert = expect('chai').to.be.tea;
|
|
164
|
-
expect(assert.__flags.tea).to.equal('chai');
|
|
165
|
-
});
|
|
166
|
-
|
|
167
|
-
it('addProperty returning result', function () {
|
|
168
|
-
chai.use(function(_chai, _) {
|
|
169
|
-
_chai.Assertion.addProperty('result', function () {
|
|
170
|
-
return 'result';
|
|
171
|
-
})
|
|
172
|
-
});
|
|
173
|
-
|
|
174
|
-
expect(expect('foo').result).to.equal('result');
|
|
175
|
-
});
|
|
176
|
-
|
|
177
|
-
it('overwriteProperty', function () {
|
|
178
|
-
chai.use(function (_chai, _) {
|
|
179
|
-
expect(new chai.Assertion()).to.have.property('tea');
|
|
180
|
-
_chai.Assertion.overwriteProperty('tea', function (_super) {
|
|
181
|
-
return function () {
|
|
182
|
-
var act = _.flag(this, 'object');
|
|
183
|
-
if (act === 'matcha') {
|
|
184
|
-
_.flag(this, 'tea', 'matcha');
|
|
185
|
-
} else {
|
|
186
|
-
_super.call(this);
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
});
|
|
190
|
-
});
|
|
191
|
-
|
|
192
|
-
var matcha = expect('matcha').to.be.tea;
|
|
193
|
-
expect(matcha.__flags.tea).to.equal('matcha');
|
|
194
|
-
var assert = expect('something').to.be.tea;
|
|
195
|
-
expect(assert.__flags.tea).to.equal('chai');
|
|
196
|
-
});
|
|
197
|
-
|
|
198
|
-
it('overwriteProperty returning result', function () {
|
|
199
|
-
chai.use(function(_chai, _) {
|
|
200
|
-
_chai.Assertion.overwriteProperty('result', function (_super) {
|
|
201
|
-
return function () {
|
|
202
|
-
return 'result';
|
|
203
|
-
}
|
|
204
|
-
});
|
|
205
|
-
});
|
|
206
|
-
|
|
207
|
-
expect(expect('foo').result).to.equal('result');
|
|
208
|
-
});
|
|
209
|
-
|
|
210
|
-
it('getMessage', function () {
|
|
211
|
-
chai.use(function (_chai, _) {
|
|
212
|
-
expect(_.getMessage({}, [])).to.equal('');
|
|
213
|
-
expect(_.getMessage({}, [null, null, null])).to.equal('');
|
|
214
|
-
|
|
215
|
-
var obj = {};
|
|
216
|
-
_.flag(obj, 'message', 'foo');
|
|
217
|
-
expect(_.getMessage(obj, [])).to.contain('foo');
|
|
218
|
-
});
|
|
219
|
-
});
|
|
220
|
-
|
|
221
|
-
it('inspect with custom object-returning inspect()s', function () {
|
|
222
|
-
chai.use(function (_chai, _) {
|
|
223
|
-
var obj = {
|
|
224
|
-
outer: {
|
|
225
|
-
inspect: function () {
|
|
226
|
-
return { foo: 'bar' };
|
|
227
|
-
}
|
|
228
|
-
}
|
|
229
|
-
};
|
|
230
|
-
|
|
231
|
-
expect(_.inspect(obj)).to.equal('{ outer: { foo: \'bar\' } }');
|
|
232
|
-
});
|
|
233
|
-
});
|
|
234
|
-
|
|
235
|
-
it('addChainableMethod', function () {
|
|
236
|
-
chai.use(function (_chai, _) {
|
|
237
|
-
_chai.Assertion.addChainableMethod('x',
|
|
238
|
-
function () {
|
|
239
|
-
new chai.Assertion(this._obj).to.be.equal('x');
|
|
240
|
-
}
|
|
241
|
-
, function () {
|
|
242
|
-
this._obj = this._obj || {};
|
|
243
|
-
this._obj.__x = 'X!'
|
|
244
|
-
}
|
|
245
|
-
);
|
|
246
|
-
|
|
247
|
-
expect("foo").x.to.equal("foo");
|
|
248
|
-
expect("x").x();
|
|
249
|
-
|
|
250
|
-
expect(function () {
|
|
251
|
-
expect("foo").x();
|
|
252
|
-
}).to.throw(_chai.AssertionError);
|
|
253
|
-
|
|
254
|
-
// Verify whether the original Function properties are present.
|
|
255
|
-
// see https://github.com/chaijs/chai/commit/514dd6ce4#commitcomment-2593383
|
|
256
|
-
var propertyDescriptor = Object.getOwnPropertyDescriptor(chai.Assertion.prototype, "x");
|
|
257
|
-
expect(propertyDescriptor.get).to.have.property("call", Function.prototype.call);
|
|
258
|
-
expect(propertyDescriptor.get).to.have.property("apply", Function.prototype.apply);
|
|
259
|
-
expect(propertyDescriptor.get()).to.have.property("call", Function.prototype.call);
|
|
260
|
-
expect(propertyDescriptor.get()).to.have.property("apply", Function.prototype.apply);
|
|
261
|
-
|
|
262
|
-
var obj = {};
|
|
263
|
-
expect(obj).x.to.be.ok;
|
|
264
|
-
expect(obj).to.have.property('__x', 'X!');
|
|
265
|
-
})
|
|
266
|
-
});
|
|
267
|
-
|
|
268
|
-
it('overwriteChainableMethod', function () {
|
|
269
|
-
chai.use(function (_chai, _) {
|
|
270
|
-
_chai.Assertion.overwriteChainableMethod('x',
|
|
271
|
-
function(_super) {
|
|
272
|
-
return function() {
|
|
273
|
-
if (_.flag(this, 'marked')) {
|
|
274
|
-
new chai.Assertion(this._obj).to.be.equal('spot');
|
|
275
|
-
} else {
|
|
276
|
-
_super.apply(this, arguments);
|
|
277
|
-
}
|
|
278
|
-
};
|
|
279
|
-
}
|
|
280
|
-
, function(_super) {
|
|
281
|
-
return function() {
|
|
282
|
-
_.flag(this, 'message', 'x marks the spot');
|
|
283
|
-
_super.apply(this, arguments);
|
|
284
|
-
};
|
|
285
|
-
}
|
|
286
|
-
);
|
|
287
|
-
|
|
288
|
-
// Make sure the original behavior of 'x' remains the same
|
|
289
|
-
expect('foo').x.to.equal("foo");
|
|
290
|
-
expect("x").x();
|
|
291
|
-
expect(function () {
|
|
292
|
-
expect("foo").x();
|
|
293
|
-
}).to.throw(_chai.AssertionError);
|
|
294
|
-
var obj = {};
|
|
295
|
-
expect(obj).x.to.be.ok;
|
|
296
|
-
expect(obj).to.have.property('__x', 'X!');
|
|
297
|
-
|
|
298
|
-
// Test the new behavior of 'x'
|
|
299
|
-
var assertion = expect('foo').x.to.be.ok;
|
|
300
|
-
expect(_.flag(assertion, 'message')).to.equal('x marks the spot');
|
|
301
|
-
expect(function () {
|
|
302
|
-
var assertion = expect('x');
|
|
303
|
-
_.flag(assertion, 'marked', true);
|
|
304
|
-
assertion.x()
|
|
305
|
-
}).to.throw(_chai.AssertionError);
|
|
306
|
-
});
|
|
307
|
-
});
|
|
308
|
-
|
|
309
|
-
});
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "deep-eql",
|
|
3
|
-
"version": "0.1.3",
|
|
4
|
-
"description": "Improved deep equality testing for Node.js and the browser.",
|
|
5
|
-
"license": "MIT",
|
|
6
|
-
"keywords": [],
|
|
7
|
-
"main": "lib/eql.js",
|
|
8
|
-
"scripts": [
|
|
9
|
-
"lib/eql.js"
|
|
10
|
-
],
|
|
11
|
-
"dependencies": {
|
|
12
|
-
"chaijs/type-detect": "0.1.1"
|
|
13
|
-
},
|
|
14
|
-
"development": {
|
|
15
|
-
"dependencies": {
|
|
16
|
-
"chaijs/simple-assert": "1.0.0"
|
|
17
|
-
}
|
|
18
|
-
},
|
|
19
|
-
"repository": "chaijs/deep-eql"
|
|
20
|
-
}
|
|
@@ -1,257 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* deep-eql
|
|
3
|
-
* Copyright(c) 2013 Jake Luer <jake@alogicalparadox.com>
|
|
4
|
-
* MIT Licensed
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
/*!
|
|
8
|
-
* Module dependencies
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
var type = require('type-detect');
|
|
12
|
-
|
|
13
|
-
/*!
|
|
14
|
-
* Buffer.isBuffer browser shim
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
var Buffer;
|
|
18
|
-
try { Buffer = require('buffer').Buffer; }
|
|
19
|
-
catch(ex) {
|
|
20
|
-
Buffer = {};
|
|
21
|
-
Buffer.isBuffer = function() { return false; }
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
/*!
|
|
25
|
-
* Primary Export
|
|
26
|
-
*/
|
|
27
|
-
|
|
28
|
-
module.exports = deepEqual;
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* Assert super-strict (egal) equality between
|
|
32
|
-
* two objects of any type.
|
|
33
|
-
*
|
|
34
|
-
* @param {Mixed} a
|
|
35
|
-
* @param {Mixed} b
|
|
36
|
-
* @param {Array} memoised (optional)
|
|
37
|
-
* @return {Boolean} equal match
|
|
38
|
-
*/
|
|
39
|
-
|
|
40
|
-
function deepEqual(a, b, m) {
|
|
41
|
-
if (sameValue(a, b)) {
|
|
42
|
-
return true;
|
|
43
|
-
} else if ('date' === type(a)) {
|
|
44
|
-
return dateEqual(a, b);
|
|
45
|
-
} else if ('regexp' === type(a)) {
|
|
46
|
-
return regexpEqual(a, b);
|
|
47
|
-
} else if (Buffer.isBuffer(a)) {
|
|
48
|
-
return bufferEqual(a, b);
|
|
49
|
-
} else if ('arguments' === type(a)) {
|
|
50
|
-
return argumentsEqual(a, b, m);
|
|
51
|
-
} else if (!typeEqual(a, b)) {
|
|
52
|
-
return false;
|
|
53
|
-
} else if (('object' !== type(a) && 'object' !== type(b))
|
|
54
|
-
&& ('array' !== type(a) && 'array' !== type(b))) {
|
|
55
|
-
return sameValue(a, b);
|
|
56
|
-
} else {
|
|
57
|
-
return objectEqual(a, b, m);
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
/*!
|
|
62
|
-
* Strict (egal) equality test. Ensures that NaN always
|
|
63
|
-
* equals NaN and `-0` does not equal `+0`.
|
|
64
|
-
*
|
|
65
|
-
* @param {Mixed} a
|
|
66
|
-
* @param {Mixed} b
|
|
67
|
-
* @return {Boolean} equal match
|
|
68
|
-
*/
|
|
69
|
-
|
|
70
|
-
function sameValue(a, b) {
|
|
71
|
-
if (a === b) return a !== 0 || 1 / a === 1 / b;
|
|
72
|
-
return a !== a && b !== b;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
/*!
|
|
76
|
-
* Compare the types of two given objects and
|
|
77
|
-
* return if they are equal. Note that an Array
|
|
78
|
-
* has a type of `array` (not `object`) and arguments
|
|
79
|
-
* have a type of `arguments` (not `array`/`object`).
|
|
80
|
-
*
|
|
81
|
-
* @param {Mixed} a
|
|
82
|
-
* @param {Mixed} b
|
|
83
|
-
* @return {Boolean} result
|
|
84
|
-
*/
|
|
85
|
-
|
|
86
|
-
function typeEqual(a, b) {
|
|
87
|
-
return type(a) === type(b);
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
/*!
|
|
91
|
-
* Compare two Date objects by asserting that
|
|
92
|
-
* the time values are equal using `saveValue`.
|
|
93
|
-
*
|
|
94
|
-
* @param {Date} a
|
|
95
|
-
* @param {Date} b
|
|
96
|
-
* @return {Boolean} result
|
|
97
|
-
*/
|
|
98
|
-
|
|
99
|
-
function dateEqual(a, b) {
|
|
100
|
-
if ('date' !== type(b)) return false;
|
|
101
|
-
return sameValue(a.getTime(), b.getTime());
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
/*!
|
|
105
|
-
* Compare two regular expressions by converting them
|
|
106
|
-
* to string and checking for `sameValue`.
|
|
107
|
-
*
|
|
108
|
-
* @param {RegExp} a
|
|
109
|
-
* @param {RegExp} b
|
|
110
|
-
* @return {Boolean} result
|
|
111
|
-
*/
|
|
112
|
-
|
|
113
|
-
function regexpEqual(a, b) {
|
|
114
|
-
if ('regexp' !== type(b)) return false;
|
|
115
|
-
return sameValue(a.toString(), b.toString());
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
/*!
|
|
119
|
-
* Assert deep equality of two `arguments` objects.
|
|
120
|
-
* Unfortunately, these must be sliced to arrays
|
|
121
|
-
* prior to test to ensure no bad behavior.
|
|
122
|
-
*
|
|
123
|
-
* @param {Arguments} a
|
|
124
|
-
* @param {Arguments} b
|
|
125
|
-
* @param {Array} memoize (optional)
|
|
126
|
-
* @return {Boolean} result
|
|
127
|
-
*/
|
|
128
|
-
|
|
129
|
-
function argumentsEqual(a, b, m) {
|
|
130
|
-
if ('arguments' !== type(b)) return false;
|
|
131
|
-
a = [].slice.call(a);
|
|
132
|
-
b = [].slice.call(b);
|
|
133
|
-
return deepEqual(a, b, m);
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
/*!
|
|
137
|
-
* Get enumerable properties of a given object.
|
|
138
|
-
*
|
|
139
|
-
* @param {Object} a
|
|
140
|
-
* @return {Array} property names
|
|
141
|
-
*/
|
|
142
|
-
|
|
143
|
-
function enumerable(a) {
|
|
144
|
-
var res = [];
|
|
145
|
-
for (var key in a) res.push(key);
|
|
146
|
-
return res;
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
/*!
|
|
150
|
-
* Simple equality for flat iterable objects
|
|
151
|
-
* such as Arrays or Node.js buffers.
|
|
152
|
-
*
|
|
153
|
-
* @param {Iterable} a
|
|
154
|
-
* @param {Iterable} b
|
|
155
|
-
* @return {Boolean} result
|
|
156
|
-
*/
|
|
157
|
-
|
|
158
|
-
function iterableEqual(a, b) {
|
|
159
|
-
if (a.length !== b.length) return false;
|
|
160
|
-
|
|
161
|
-
var i = 0;
|
|
162
|
-
var match = true;
|
|
163
|
-
|
|
164
|
-
for (; i < a.length; i++) {
|
|
165
|
-
if (a[i] !== b[i]) {
|
|
166
|
-
match = false;
|
|
167
|
-
break;
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
return match;
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
/*!
|
|
175
|
-
* Extension to `iterableEqual` specifically
|
|
176
|
-
* for Node.js Buffers.
|
|
177
|
-
*
|
|
178
|
-
* @param {Buffer} a
|
|
179
|
-
* @param {Mixed} b
|
|
180
|
-
* @return {Boolean} result
|
|
181
|
-
*/
|
|
182
|
-
|
|
183
|
-
function bufferEqual(a, b) {
|
|
184
|
-
if (!Buffer.isBuffer(b)) return false;
|
|
185
|
-
return iterableEqual(a, b);
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
/*!
|
|
189
|
-
* Block for `objectEqual` ensuring non-existing
|
|
190
|
-
* values don't get in.
|
|
191
|
-
*
|
|
192
|
-
* @param {Mixed} object
|
|
193
|
-
* @return {Boolean} result
|
|
194
|
-
*/
|
|
195
|
-
|
|
196
|
-
function isValue(a) {
|
|
197
|
-
return a !== null && a !== undefined;
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
/*!
|
|
201
|
-
* Recursively check the equality of two objects.
|
|
202
|
-
* Once basic sameness has been established it will
|
|
203
|
-
* defer to `deepEqual` for each enumerable key
|
|
204
|
-
* in the object.
|
|
205
|
-
*
|
|
206
|
-
* @param {Mixed} a
|
|
207
|
-
* @param {Mixed} b
|
|
208
|
-
* @return {Boolean} result
|
|
209
|
-
*/
|
|
210
|
-
|
|
211
|
-
function objectEqual(a, b, m) {
|
|
212
|
-
if (!isValue(a) || !isValue(b)) {
|
|
213
|
-
return false;
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
if (a.prototype !== b.prototype) {
|
|
217
|
-
return false;
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
var i;
|
|
221
|
-
if (m) {
|
|
222
|
-
for (i = 0; i < m.length; i++) {
|
|
223
|
-
if ((m[i][0] === a && m[i][1] === b)
|
|
224
|
-
|| (m[i][0] === b && m[i][1] === a)) {
|
|
225
|
-
return true;
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
} else {
|
|
229
|
-
m = [];
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
try {
|
|
233
|
-
var ka = enumerable(a);
|
|
234
|
-
var kb = enumerable(b);
|
|
235
|
-
} catch (ex) {
|
|
236
|
-
return false;
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
ka.sort();
|
|
240
|
-
kb.sort();
|
|
241
|
-
|
|
242
|
-
if (!iterableEqual(ka, kb)) {
|
|
243
|
-
return false;
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
m.push([ a, b ]);
|
|
247
|
-
|
|
248
|
-
var key;
|
|
249
|
-
for (i = ka.length - 1; i >= 0; i--) {
|
|
250
|
-
key = ka[i];
|
|
251
|
-
if (!deepEqual(a[key], b[key], m)) {
|
|
252
|
-
return false;
|
|
253
|
-
}
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
return true;
|
|
257
|
-
}
|