ende 0.1.5 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/component.json +1 -1
- data/lib/assets/javascripts/aura/extensions/devise.js.coffee +7 -4
- data/lib/assets/javascripts/aura/extensions/routes.js.coffee +16 -8
- data/lib/assets/javascripts/aura/extensions/widget/lifecycleable.js.coffee +10 -5
- data/lib/assets/javascripts/widgets/authenticator/main.js.coffee +4 -8
- data/lib/assets/javascripts/widgets/authenticator/presenter.js.coffee +4 -4
- data/lib/assets/javascripts/widgets/authenticator/states/default.html +1 -1
- data/lib/assets/javascripts/widgets/tray/main.js.coffee +26 -0
- data/lib/ende/version.rb +1 -1
- data/lib/tasks/component.thor +1 -1
- data/vendor/assets/javascripts/ende/build.js +10008 -8202
- data/vendor/components/KapIT-observe-utils/component.json +16 -0
- data/vendor/components/KapIT-observe-utils/lib/observe-utils.js +780 -0
- data/vendor/components/chaijs-assertion-error/component.json +18 -0
- data/vendor/components/chaijs-assertion-error/index.js +110 -0
- data/vendor/components/chaijs-chai/component.json +47 -0
- data/vendor/components/chaijs-chai/index.js +1 -0
- data/vendor/components/chaijs-chai/lib/chai/assertion.js +130 -0
- data/vendor/components/chaijs-chai/lib/chai/core/assertions.js +1270 -0
- data/vendor/components/chaijs-chai/lib/chai/interface/assert.js +1080 -0
- data/vendor/components/chaijs-chai/lib/chai/interface/expect.js +12 -0
- data/vendor/components/chaijs-chai/lib/chai/interface/should.js +76 -0
- data/vendor/components/chaijs-chai/lib/chai/utils/addChainableMethod.js +94 -0
- data/vendor/components/chaijs-chai/lib/chai/utils/addMethod.js +37 -0
- data/vendor/components/chaijs-chai/lib/chai/utils/addProperty.js +40 -0
- data/vendor/components/chaijs-chai/lib/chai/utils/flag.js +32 -0
- data/vendor/components/chaijs-chai/lib/chai/utils/getActual.js +19 -0
- data/vendor/components/chaijs-chai/lib/chai/utils/getEnumerableProperties.js +25 -0
- data/vendor/components/chaijs-chai/lib/chai/utils/getMessage.js +49 -0
- data/vendor/components/chaijs-chai/lib/chai/utils/getName.js +20 -0
- data/vendor/components/chaijs-chai/lib/chai/utils/getPathValue.js +102 -0
- data/vendor/components/chaijs-chai/lib/chai/utils/getProperties.js +35 -0
- data/vendor/components/chaijs-chai/lib/chai/utils/index.js +108 -0
- data/vendor/components/chaijs-chai/lib/chai/utils/inspect.js +320 -0
- data/vendor/components/chaijs-chai/lib/chai/utils/objDisplay.js +48 -0
- data/vendor/components/chaijs-chai/lib/chai/utils/overwriteMethod.js +51 -0
- data/vendor/components/chaijs-chai/lib/chai/utils/overwriteProperty.js +54 -0
- data/vendor/components/chaijs-chai/lib/chai/utils/test.js +26 -0
- data/vendor/components/chaijs-chai/lib/chai/utils/transferFlags.js +44 -0
- data/vendor/components/chaijs-chai/lib/chai/utils/type.js +45 -0
- data/vendor/components/chaijs-chai/lib/chai.js +80 -0
- data/vendor/components/chaijs-deep-eql/component.json +18 -0
- data/vendor/components/chaijs-deep-eql/lib/eql.js +257 -0
- data/vendor/components/chaijs-type-detect/component.json +16 -0
- data/vendor/components/chaijs-type-detect/lib/type.js +142 -0
- data/vendor/components/component-bind/component.json +14 -0
- data/vendor/components/component-bind/index.js +24 -0
- data/vendor/components/component-delegate/component.json +19 -0
- data/vendor/components/component-delegate/index.js +42 -0
- data/vendor/components/component-event/component.json +13 -0
- data/vendor/components/component-event/index.js +40 -0
- data/vendor/components/component-jquery/component.json +14 -0
- data/vendor/components/component-jquery/index.js +9601 -0
- data/vendor/components/component-link-delegate/component.json +23 -0
- data/vendor/components/component-link-delegate/index.js +60 -0
- data/vendor/components/component-matches-selector/component.json +20 -0
- data/vendor/components/component-matches-selector/index.js +45 -0
- data/vendor/components/component-query/component.json +21 -0
- data/vendor/components/component-query/index.js +21 -0
- data/vendor/components/component-type/component.json +18 -0
- data/vendor/components/component-type/index.js +32 -0
- data/vendor/components/component-url/component.json +17 -0
- data/vendor/components/component-url/index.js +63 -0
- data/vendor/components/components-modernizr/component.json +18 -0
- data/vendor/components/components-modernizr/modernizr.js +1393 -0
- data/vendor/components/discore-closest/component.json +14 -0
- data/vendor/components/discore-closest/index.js +18 -0
- data/vendor/components/indefinido-advisable/component.json +21 -0
- data/vendor/components/indefinido-advisable/index.js +1 -0
- data/vendor/components/indefinido-advisable/lib/advisable.js +60 -0
- data/vendor/components/indefinido-indemma/component.json +40 -0
- data/vendor/components/indefinido-indemma/index.js +1 -0
- data/vendor/components/indefinido-indemma/lib/extensions/rivets.js +23 -0
- data/vendor/components/indefinido-indemma/lib/record/associable.js +217 -0
- data/vendor/components/indefinido-indemma/lib/record/maid.js +24 -0
- data/vendor/components/indefinido-indemma/lib/record/resource.js +104 -0
- data/vendor/components/indefinido-indemma/lib/record/rest.js +36 -0
- data/vendor/components/indefinido-indemma/lib/record/restfulable.js +326 -0
- data/vendor/components/indefinido-indemma/lib/record/scopable.js +279 -0
- data/vendor/components/indefinido-indemma/lib/record/translationable.js +19 -0
- data/vendor/components/indefinido-indemma/lib/record/validatable.js +216 -0
- data/vendor/components/indefinido-indemma/lib/record/validations/associated.js +30 -0
- data/vendor/components/indefinido-indemma/lib/record/validations/confirmation.js +19 -0
- data/vendor/components/indefinido-indemma/lib/record/validations/cpf.js +60 -0
- data/vendor/components/indefinido-indemma/lib/record/validations/presence.js +19 -0
- data/vendor/components/indefinido-indemma/lib/record/validations/remote.js +71 -0
- data/vendor/components/indefinido-indemma/lib/record.js +167 -0
- data/vendor/components/indefinido-indemma/vendor/sinon.js +4290 -0
- data/vendor/components/indefinido-indemma/vendor/stampit.js +392 -0
- data/vendor/components/indefinido-observable/component.json +25 -0
- data/vendor/components/indefinido-observable/components/cjohansen-sinon/sinon.js +4290 -0
- data/vendor/components/indefinido-observable/index.js +1 -0
- data/vendor/components/indefinido-observable/lib/adapters/rivets.js +26 -0
- data/vendor/components/indefinido-observable/lib/observable.js +320 -0
- data/vendor/components/indefinido-observable/vendor/shims/accessors-legacy.js +92 -0
- data/vendor/components/indefinido-observable/vendor/shims/accessors.js +173 -0
- data/vendor/components/indefinido-observable/vendor/shims/array.indexOf.js +8 -0
- data/vendor/components/indefinido-observable/vendor/shims/object.create.js +77 -0
- data/vendor/components/mikeric-rivets/component.json +15 -0
- data/vendor/components/mikeric-rivets/dist/rivets.js +1239 -0
- data/vendor/components/paulmillr-es6-shim/component.json +17 -0
- data/vendor/components/paulmillr-es6-shim/es6-shim.js +985 -0
- data/vendor/components/pluma-assimilate/component.json +25 -0
- data/vendor/components/pluma-assimilate/dist/assimilate.js +87 -0
- data/vendor/components/segmentio-extend/component.json +13 -0
- data/vendor/components/segmentio-extend/index.js +15 -0
- metadata +98 -2
@@ -0,0 +1,985 @@
|
|
1
|
+
// ES6-shim 0.9.0 (c) 2013 Paul Miller (paulmillr.com)
|
2
|
+
// ES6-shim may be freely distributed under the MIT license.
|
3
|
+
// For more details and documentation:
|
4
|
+
// https://github.com/paulmillr/es6-shim/
|
5
|
+
|
6
|
+
(function(undefined) {
|
7
|
+
'use strict';
|
8
|
+
|
9
|
+
var arePropertyDescriptorsSupported = function() {
|
10
|
+
try {
|
11
|
+
Object.defineProperty({}, 'x', {});
|
12
|
+
return true;
|
13
|
+
} catch (e) { /* this is IE 8. */
|
14
|
+
return false;
|
15
|
+
}
|
16
|
+
};
|
17
|
+
|
18
|
+
var main = function() {
|
19
|
+
var globals = (typeof global === 'undefined') ? window : global;
|
20
|
+
var global_isFinite = globals.isFinite;
|
21
|
+
var supportsDescriptors = !!Object.defineProperty && arePropertyDescriptorsSupported();
|
22
|
+
var _slice = Array.prototype.slice;
|
23
|
+
var _indexOf = String.prototype.indexOf;
|
24
|
+
var _toString = Object.prototype.toString;
|
25
|
+
var _hasOwnProperty = Object.prototype.hasOwnProperty;
|
26
|
+
|
27
|
+
// Define configurable, writable and non-enumerable props
|
28
|
+
// if they don’t exist.
|
29
|
+
var defineProperties = function(object, map) {
|
30
|
+
Object.keys(map).forEach(function(name) {
|
31
|
+
var method = map[name];
|
32
|
+
if (name in object) return;
|
33
|
+
if (supportsDescriptors) {
|
34
|
+
Object.defineProperty(object, name, {
|
35
|
+
configurable: true,
|
36
|
+
enumerable: false,
|
37
|
+
writable: true,
|
38
|
+
value: method
|
39
|
+
});
|
40
|
+
} else {
|
41
|
+
object[name] = method;
|
42
|
+
}
|
43
|
+
});
|
44
|
+
};
|
45
|
+
|
46
|
+
var ES = {
|
47
|
+
ToInt32: function(x) {
|
48
|
+
return x >> 0;
|
49
|
+
},
|
50
|
+
|
51
|
+
ToUint32: function(x) {
|
52
|
+
return x >>> 0;
|
53
|
+
},
|
54
|
+
|
55
|
+
toInteger: function(value) {
|
56
|
+
var number = +value;
|
57
|
+
if (Number.isNaN(number)) return 0;
|
58
|
+
if (number === 0 || !Number.isFinite(number)) return number;
|
59
|
+
return Math.sign(number) * Math.floor(Math.abs(number));
|
60
|
+
}
|
61
|
+
};
|
62
|
+
|
63
|
+
defineProperties(String, {
|
64
|
+
fromCodePoint: function() {
|
65
|
+
var points = _slice.call(arguments, 0);
|
66
|
+
var result = [];
|
67
|
+
var next;
|
68
|
+
for (var i = 0, length = points.length; i < length; i++) {
|
69
|
+
next = Number(points[i]);
|
70
|
+
if (!Object.is(next, ES.toInteger(next)) ||
|
71
|
+
next < 0 || next > 0x10FFFF) {
|
72
|
+
throw new RangeError('Invalid code point ' + next);
|
73
|
+
}
|
74
|
+
|
75
|
+
if (next < 0x10000) {
|
76
|
+
result.push(String.fromCharCode(next));
|
77
|
+
} else {
|
78
|
+
next -= 0x10000;
|
79
|
+
result.push(String.fromCharCode((next >> 10) + 0xD800));
|
80
|
+
result.push(String.fromCharCode((next % 0x400) + 0xDC00));
|
81
|
+
}
|
82
|
+
}
|
83
|
+
return result.join('');
|
84
|
+
},
|
85
|
+
|
86
|
+
raw: function() {
|
87
|
+
var callSite = arguments[0];
|
88
|
+
var substitutions = _slice.call(arguments, 1);
|
89
|
+
var cooked = Object(callSite);
|
90
|
+
var rawValue = cooked.raw;
|
91
|
+
var raw = Object(rawValue);
|
92
|
+
var len = Object.keys(raw).length;
|
93
|
+
var literalsegments = ES.ToUint32(len);
|
94
|
+
if (literalsegments === 0) {
|
95
|
+
return '';
|
96
|
+
}
|
97
|
+
|
98
|
+
var stringElements = [];
|
99
|
+
var nextIndex = 0;
|
100
|
+
var nextKey, next, nextSeg, nextSub;
|
101
|
+
while (nextIndex < literalsegments) {
|
102
|
+
nextKey = String(nextIndex);
|
103
|
+
next = raw[nextKey];
|
104
|
+
nextSeg = String(next);
|
105
|
+
stringElements.push(nextSeg);
|
106
|
+
if (nextIndex + 1 >= literalsegments) {
|
107
|
+
break;
|
108
|
+
}
|
109
|
+
next = substitutions[nextKey];
|
110
|
+
if (next === undefined) {
|
111
|
+
break;
|
112
|
+
}
|
113
|
+
nextSub = String(next);
|
114
|
+
stringElements.push(nextSub);
|
115
|
+
nextIndex++;
|
116
|
+
}
|
117
|
+
return stringElements.join('');
|
118
|
+
}
|
119
|
+
});
|
120
|
+
|
121
|
+
defineProperties(String.prototype, {
|
122
|
+
// Fast repeat, uses the `Exponentiation by squaring` algorithm.
|
123
|
+
// Perf: http://jsperf.com/string-repeat2/2
|
124
|
+
repeat: (function() {
|
125
|
+
var repeat = function(s, times) {
|
126
|
+
if (times < 1) return '';
|
127
|
+
if (times % 2) return repeat(s, times - 1) + s;
|
128
|
+
var half = repeat(s, times / 2);
|
129
|
+
return half + half;
|
130
|
+
};
|
131
|
+
|
132
|
+
return function(times) {
|
133
|
+
times = ES.toInteger(times);
|
134
|
+
if (times < 0 || times === Infinity) {
|
135
|
+
throw new RangeError();
|
136
|
+
}
|
137
|
+
return repeat(String(this), times);
|
138
|
+
};
|
139
|
+
})(),
|
140
|
+
|
141
|
+
startsWith: function(searchStr) {
|
142
|
+
if (this == null) throw new TypeError("Cannot call method 'startsWith' of " + this);
|
143
|
+
var thisStr = String(this);
|
144
|
+
searchStr = String(searchStr);
|
145
|
+
var start = Math.max(ES.toInteger(arguments[1]), 0);
|
146
|
+
return thisStr.slice(start, start + searchStr.length) === searchStr;
|
147
|
+
},
|
148
|
+
|
149
|
+
endsWith: function(searchStr) {
|
150
|
+
if (this == null) throw new TypeError("Cannot call method 'endsWith' of " + this);
|
151
|
+
var thisStr = String(this);
|
152
|
+
searchStr = String(searchStr);
|
153
|
+
var thisLen = thisStr.length;
|
154
|
+
var pos = (arguments[1] === undefined) ?
|
155
|
+
thisLen : ES.toInteger(arguments[1]);
|
156
|
+
var end = Math.min(pos, thisLen);
|
157
|
+
return thisStr.slice(end - searchStr.length, end) === searchStr;
|
158
|
+
},
|
159
|
+
|
160
|
+
contains: function(searchString) {
|
161
|
+
var position = arguments[1];
|
162
|
+
|
163
|
+
// Somehow this trick makes method 100% compat with the spec.
|
164
|
+
return _indexOf.call(this, searchString, position) !== -1;
|
165
|
+
},
|
166
|
+
|
167
|
+
codePointAt: function(pos) {
|
168
|
+
var s = String(this);
|
169
|
+
var position = ES.toInteger(pos);
|
170
|
+
var length = s.length;
|
171
|
+
if (position < 0 || position >= length) return undefined;
|
172
|
+
var first = s.charCodeAt(position);
|
173
|
+
var isEnd = (position + 1 === length);
|
174
|
+
if (first < 0xD800 || first > 0xDBFF || isEnd) return first;
|
175
|
+
var second = s.charCodeAt(position + 1);
|
176
|
+
if (second < 0xDC00 || second > 0xDFFF) return first;
|
177
|
+
return ((first - 0xD800) * 1024) + (second - 0xDC00) + 0x10000;
|
178
|
+
}
|
179
|
+
});
|
180
|
+
|
181
|
+
defineProperties(Array, {
|
182
|
+
from: function(iterable) {
|
183
|
+
var mapFn = arguments[1];
|
184
|
+
var thisArg = arguments[2];
|
185
|
+
|
186
|
+
if (mapFn !== undefined && _toString.call(mapFn) !== '[object Function]') {
|
187
|
+
throw new TypeError('when provided, the second argument must be a function');
|
188
|
+
}
|
189
|
+
|
190
|
+
var list = Object(iterable);
|
191
|
+
var length = ES.ToUint32(list.length);
|
192
|
+
var result = typeof this === 'function' ? Object(new this(length)) : new Array(length);
|
193
|
+
|
194
|
+
for (var i = 0; i < length; i++) {
|
195
|
+
var value = list[i];
|
196
|
+
if (mapFn !== undefined) {
|
197
|
+
result[i] = thisArg ? mapFn.call(thisArg, value) : mapFn(value);
|
198
|
+
} else {
|
199
|
+
result[i] = value;
|
200
|
+
}
|
201
|
+
}
|
202
|
+
|
203
|
+
result.length = length;
|
204
|
+
return result;
|
205
|
+
},
|
206
|
+
|
207
|
+
of: function() {
|
208
|
+
return Array.from(arguments);
|
209
|
+
}
|
210
|
+
});
|
211
|
+
|
212
|
+
defineProperties(globals, {
|
213
|
+
ArrayIterator: function(array, kind) {
|
214
|
+
this.i = 0;
|
215
|
+
this.array = array;
|
216
|
+
this.kind = kind;
|
217
|
+
}
|
218
|
+
});
|
219
|
+
|
220
|
+
defineProperties(ArrayIterator.prototype, {
|
221
|
+
next: function() {
|
222
|
+
var i = this.i;
|
223
|
+
this.i = i + 1;
|
224
|
+
var array = this.array;
|
225
|
+
|
226
|
+
if (i >= array.length) {
|
227
|
+
throw new Error();
|
228
|
+
}
|
229
|
+
|
230
|
+
if (array.hasOwnProperty(i)) {
|
231
|
+
var kind = this.kind;
|
232
|
+
var retval;
|
233
|
+
if (kind === "key") {
|
234
|
+
retval = i;
|
235
|
+
}
|
236
|
+
if (kind === "value") {
|
237
|
+
retval = array[i];
|
238
|
+
}
|
239
|
+
if (kind === "entry") {
|
240
|
+
retval = [i, array[i]];
|
241
|
+
}
|
242
|
+
} else {
|
243
|
+
retval = this.next();
|
244
|
+
}
|
245
|
+
return retval;
|
246
|
+
}
|
247
|
+
});
|
248
|
+
|
249
|
+
defineProperties(Array.prototype, {
|
250
|
+
copyWithin: function(target, start) {
|
251
|
+
var o = Object(this);
|
252
|
+
var len = Math.max(ES.toInteger(o.length), 0);
|
253
|
+
var to = target < 0 ? Math.max(len + target, 0) : Math.min(target, len);
|
254
|
+
var from = start < 0 ? Math.max(len + start, 0) : Math.min(start, len);
|
255
|
+
var end = arguments.length > 2 ? arguments[2] : len;
|
256
|
+
var final = end < 0 ? Math.max(len + end, 0) : Math.min(end, len);
|
257
|
+
var count = Math.min(final - from, len - to);
|
258
|
+
var direction = 1;
|
259
|
+
if (from < to && to < (from + count)) {
|
260
|
+
direction = -1;
|
261
|
+
from += count - 1;
|
262
|
+
to += count - 1;
|
263
|
+
}
|
264
|
+
while (count > 0) {
|
265
|
+
if (_hasOwnProperty.call(o, from)) {
|
266
|
+
o[to] = o[from];
|
267
|
+
} else {
|
268
|
+
delete o[from];
|
269
|
+
}
|
270
|
+
from += direction;
|
271
|
+
to += direction;
|
272
|
+
count -= 1;
|
273
|
+
}
|
274
|
+
return o;
|
275
|
+
},
|
276
|
+
fill: function(value) {
|
277
|
+
var len = this.length;
|
278
|
+
var start = arguments.length > 1 ? ES.toInteger(arguments[1]) : 0;
|
279
|
+
var end = arguments.length > 2 ? ES.toInteger(arguments[2]) : len;
|
280
|
+
|
281
|
+
var relativeStart = start < 0 ? Math.max(len + start, 0) : Math.min(start, len);
|
282
|
+
|
283
|
+
for (var i = relativeStart; i < len && i < end; ++i) {
|
284
|
+
this[i] = value;
|
285
|
+
}
|
286
|
+
return this;
|
287
|
+
},
|
288
|
+
|
289
|
+
find: function(predicate) {
|
290
|
+
var list = Object(this);
|
291
|
+
var length = ES.ToUint32(list.length);
|
292
|
+
if (length === 0) return undefined;
|
293
|
+
if (typeof predicate !== 'function') {
|
294
|
+
throw new TypeError('Array#find: predicate must be a function');
|
295
|
+
}
|
296
|
+
var thisArg = arguments[1];
|
297
|
+
for (var i = 0, value; i < length && i in list; i++) {
|
298
|
+
value = list[i];
|
299
|
+
if (predicate.call(thisArg, value, i, list)) return value;
|
300
|
+
}
|
301
|
+
return undefined;
|
302
|
+
},
|
303
|
+
|
304
|
+
findIndex: function(predicate) {
|
305
|
+
var list = Object(this);
|
306
|
+
var length = ES.ToUint32(list.length);
|
307
|
+
if (length === 0) return -1;
|
308
|
+
if (typeof predicate !== 'function') {
|
309
|
+
throw new TypeError('Array#findIndex: predicate must be a function');
|
310
|
+
}
|
311
|
+
var thisArg = arguments[1];
|
312
|
+
for (var i = 0, value; i < length && i in list; i++) {
|
313
|
+
value = list[i];
|
314
|
+
if (predicate.call(thisArg, value, i, list)) return i;
|
315
|
+
}
|
316
|
+
return -1;
|
317
|
+
},
|
318
|
+
|
319
|
+
keys: function() {
|
320
|
+
return new ArrayIterator(this, "key");
|
321
|
+
},
|
322
|
+
|
323
|
+
values: function() {
|
324
|
+
return new ArrayIterator(this, "value");
|
325
|
+
},
|
326
|
+
|
327
|
+
entries: function() {
|
328
|
+
return new ArrayIterator(this, "entry");
|
329
|
+
}
|
330
|
+
});
|
331
|
+
|
332
|
+
var maxSafeInteger = Math.pow(2, 53) - 1;
|
333
|
+
defineProperties(Number, {
|
334
|
+
MAX_SAFE_INTEGER: maxSafeInteger,
|
335
|
+
MIN_SAFE_INTEGER: -maxSafeInteger,
|
336
|
+
EPSILON: 2.220446049250313e-16,
|
337
|
+
|
338
|
+
parseInt: globals.parseInt,
|
339
|
+
parseFloat: globals.parseFloat,
|
340
|
+
|
341
|
+
isFinite: function(value) {
|
342
|
+
return typeof value === 'number' && global_isFinite(value);
|
343
|
+
},
|
344
|
+
|
345
|
+
isSafeInteger: function(value) {
|
346
|
+
return typeof value === 'number' &&
|
347
|
+
!Number.isNaN(value) &&
|
348
|
+
Number.isFinite(value) &&
|
349
|
+
parseInt(value, 10) === value &&
|
350
|
+
Math.abs(value) <= Number.MAX_SAFE_INTEGER;
|
351
|
+
},
|
352
|
+
|
353
|
+
isNaN: function(value) {
|
354
|
+
// NaN !== NaN, but they are identical.
|
355
|
+
// NaNs are the only non-reflexive value, i.e., if x !== x,
|
356
|
+
// then x is NaN.
|
357
|
+
// isNaN is broken: it converts its argument to number, so
|
358
|
+
// isNaN('foo') => true
|
359
|
+
return value !== value;
|
360
|
+
},
|
361
|
+
|
362
|
+
});
|
363
|
+
|
364
|
+
defineProperties(Number.prototype, {
|
365
|
+
clz: function() {
|
366
|
+
var number = +this;
|
367
|
+
if (!number || !Number.isFinite(number)) return 32;
|
368
|
+
number = number < 0 ? Math.ceil(number) : Math.floor(number);
|
369
|
+
number = number - Math.floor(number / 0x100000000) * 0x100000000;
|
370
|
+
return 32 - (number).toString(2).length;
|
371
|
+
}
|
372
|
+
});
|
373
|
+
|
374
|
+
if (supportsDescriptors) {
|
375
|
+
defineProperties(Object, {
|
376
|
+
getOwnPropertyDescriptors: function(subject) {
|
377
|
+
var descs = {};
|
378
|
+
Object.getOwnPropertyNames(subject).forEach(function(propName) {
|
379
|
+
descs[propName] = Object.getOwnPropertyDescriptor(subject, propName);
|
380
|
+
});
|
381
|
+
return descs;
|
382
|
+
},
|
383
|
+
|
384
|
+
getPropertyDescriptor: function(subject, name) {
|
385
|
+
var pd = Object.getOwnPropertyDescriptor(subject, name);
|
386
|
+
var proto = Object.getPrototypeOf(subject);
|
387
|
+
while (pd === undefined && proto !== null) {
|
388
|
+
pd = Object.getOwnPropertyDescriptor(proto, name);
|
389
|
+
proto = Object.getPrototypeOf(proto);
|
390
|
+
}
|
391
|
+
return pd;
|
392
|
+
},
|
393
|
+
|
394
|
+
getPropertyNames: function(subject) {
|
395
|
+
var result = Object.getOwnPropertyNames(subject);
|
396
|
+
var proto = Object.getPrototypeOf(subject);
|
397
|
+
|
398
|
+
var addProperty = function(property) {
|
399
|
+
if (result.indexOf(property) === -1) {
|
400
|
+
result.push(property);
|
401
|
+
}
|
402
|
+
};
|
403
|
+
|
404
|
+
while (proto !== null) {
|
405
|
+
Object.getOwnPropertyNames(proto).forEach(addProperty);
|
406
|
+
proto = Object.getPrototypeOf(proto);
|
407
|
+
}
|
408
|
+
return result;
|
409
|
+
},
|
410
|
+
|
411
|
+
// 19.1.3.1
|
412
|
+
assign: function(target, source) {
|
413
|
+
return Object.keys(source).reduce(function(target, key) {
|
414
|
+
target[key] = source[key];
|
415
|
+
return target;
|
416
|
+
}, target);
|
417
|
+
},
|
418
|
+
|
419
|
+
// 19.1.3.15
|
420
|
+
mixin: function(target, source) {
|
421
|
+
var props = Object.getOwnPropertyNames(source);
|
422
|
+
return props.reduce(function(target, property) {
|
423
|
+
var descriptor = Object.getOwnPropertyDescriptor(source, property);
|
424
|
+
return Object.defineProperty(target, property, descriptor);
|
425
|
+
}, target);
|
426
|
+
}
|
427
|
+
});
|
428
|
+
|
429
|
+
// 19.1.3.9
|
430
|
+
// shim from https://gist.github.com/WebReflection/5593554
|
431
|
+
defineProperties(Object, {
|
432
|
+
setPrototypeOf: (function(Object, magic) {
|
433
|
+
var set;
|
434
|
+
|
435
|
+
var checkArgs = function(O, proto) {
|
436
|
+
if (typeof O !== 'object' || O === null) {
|
437
|
+
throw new TypeError('cannot set prototype on a non-object');
|
438
|
+
}
|
439
|
+
if (typeof proto !== 'object') {
|
440
|
+
throw new TypeError('can only set prototype to an object or null');
|
441
|
+
}
|
442
|
+
};
|
443
|
+
|
444
|
+
var setPrototypeOf = function(O, proto) {
|
445
|
+
checkArgs(O, proto);
|
446
|
+
set.call(O, proto);
|
447
|
+
return O;
|
448
|
+
};
|
449
|
+
|
450
|
+
try {
|
451
|
+
// this works already in Firefox and Safari
|
452
|
+
set = Object.getOwnPropertyDescriptor(Object.prototype, magic).set;
|
453
|
+
set.call({}, null);
|
454
|
+
} catch (e) {
|
455
|
+
if (Object.prototype !== {}[magic]) {
|
456
|
+
// IE < 11 cannot be shimmed
|
457
|
+
return;
|
458
|
+
}
|
459
|
+
// probably Chrome or some old Mobile stock browser
|
460
|
+
set = function(proto) {
|
461
|
+
this[magic] = proto;
|
462
|
+
};
|
463
|
+
// please note that this will **not** work
|
464
|
+
// in those browsers that do not inherit
|
465
|
+
// __proto__ by mistake from Object.prototype
|
466
|
+
// in these cases we should probably throw an error
|
467
|
+
// or at least be informed about the issue
|
468
|
+
setPrototypeOf.polyfill = setPrototypeOf(
|
469
|
+
setPrototypeOf({}, null),
|
470
|
+
Object.prototype
|
471
|
+
) instanceof Object;
|
472
|
+
// setPrototypeOf.polyfill === true means it works as meant
|
473
|
+
// setPrototypeOf.polyfill === false means it's not 100% reliable
|
474
|
+
// setPrototypeOf.polyfill === undefined
|
475
|
+
// or
|
476
|
+
// setPrototypeOf.polyfill == null means it's not a polyfill
|
477
|
+
// which means it works as expected
|
478
|
+
// we can even delete Object.prototype.__proto__;
|
479
|
+
}
|
480
|
+
return setPrototypeOf;
|
481
|
+
})(Object, '__proto__')
|
482
|
+
});
|
483
|
+
}
|
484
|
+
|
485
|
+
defineProperties(Object, {
|
486
|
+
getOwnPropertyKeys: function(subject) {
|
487
|
+
return Object.keys(subject);
|
488
|
+
},
|
489
|
+
|
490
|
+
is: function(a, b) {
|
491
|
+
if (a === b) {
|
492
|
+
// 0 === -0, but they are not identical.
|
493
|
+
if (a === 0) return 1 / a === 1 / b;
|
494
|
+
return true;
|
495
|
+
}
|
496
|
+
return Number.isNaN(a) && Number.isNaN(b);
|
497
|
+
}
|
498
|
+
});
|
499
|
+
|
500
|
+
defineProperties(Math, {
|
501
|
+
acosh: function(value) {
|
502
|
+
value = Number(value);
|
503
|
+
if (Number.isNaN(value) || value < 1) return NaN;
|
504
|
+
if (value === 1) return 0;
|
505
|
+
if (value === Infinity) return value;
|
506
|
+
return Math.log(value + Math.sqrt(value * value - 1));
|
507
|
+
},
|
508
|
+
|
509
|
+
asinh: function(value) {
|
510
|
+
value = Number(value);
|
511
|
+
if (value === 0 || !global_isFinite(value)) {
|
512
|
+
return value;
|
513
|
+
}
|
514
|
+
return Math.log(value + Math.sqrt(value * value + 1));
|
515
|
+
},
|
516
|
+
|
517
|
+
atanh: function(value) {
|
518
|
+
value = Number(value);
|
519
|
+
if (Number.isNaN(value) || value < -1 || value > 1) {
|
520
|
+
return NaN;
|
521
|
+
}
|
522
|
+
if (value === -1) return -Infinity;
|
523
|
+
if (value === 1) return Infinity;
|
524
|
+
if (value === 0) return value;
|
525
|
+
return 0.5 * Math.log((1 + value) / (1 - value));
|
526
|
+
},
|
527
|
+
|
528
|
+
cbrt: function(value) {
|
529
|
+
value = Number(value);
|
530
|
+
if (value === 0) return value;
|
531
|
+
var negate = value < 0, result;
|
532
|
+
if (negate) value = -value;
|
533
|
+
result = Math.pow(value, 1/3);
|
534
|
+
return negate ? -result : result;
|
535
|
+
},
|
536
|
+
|
537
|
+
cosh: function(value) {
|
538
|
+
value = Number(value);
|
539
|
+
if (value === 0) return 1; // +0 or -0
|
540
|
+
if (!global_isFinite(value)) return value;
|
541
|
+
if (value < 0) value = -value;
|
542
|
+
if (value > 21) return Math.exp(value) / 2;
|
543
|
+
return (Math.exp(value) + Math.exp(-value)) / 2;
|
544
|
+
},
|
545
|
+
|
546
|
+
expm1: function(value) {
|
547
|
+
value = Number(value);
|
548
|
+
if (value === -Infinity) return -1;
|
549
|
+
if (!global_isFinite(value) || value === 0) return value;
|
550
|
+
var result = 0;
|
551
|
+
var n = 50;
|
552
|
+
for (var i = 1; i < n; i++) {
|
553
|
+
for (var j = 2, factorial = 1; j <= i; j++) {
|
554
|
+
factorial *= j;
|
555
|
+
}
|
556
|
+
result += Math.pow(value, i) / factorial;
|
557
|
+
}
|
558
|
+
return result;
|
559
|
+
},
|
560
|
+
|
561
|
+
hypot: function(x, y) {
|
562
|
+
var anyNaN = false;
|
563
|
+
var allZero = true;
|
564
|
+
var z = arguments.length > 2 ? arguments[2] : 0;
|
565
|
+
if ([x, y, z].some(function(num) {
|
566
|
+
if (Number.isNaN(num)) anyNaN = true;
|
567
|
+
else if (num === Infinity || num === -Infinity) return true;
|
568
|
+
else if (num !== 0) allZero = false;
|
569
|
+
})) return Infinity;
|
570
|
+
if (anyNaN) return NaN;
|
571
|
+
if (allZero) return 0;
|
572
|
+
if (x == null) x = 0;
|
573
|
+
if (y == null) y = 0;
|
574
|
+
if (z == null) z = 0;
|
575
|
+
return Math.sqrt(x * x + y * y + z * z);
|
576
|
+
},
|
577
|
+
|
578
|
+
log2: function(value) {
|
579
|
+
return Math.log(value) * Math.LOG2E;
|
580
|
+
},
|
581
|
+
|
582
|
+
log10: function(value) {
|
583
|
+
return Math.log(value) * Math.LOG10E;
|
584
|
+
},
|
585
|
+
|
586
|
+
log1p: function(value) {
|
587
|
+
value = Number(value);
|
588
|
+
if (value < -1 || Number.isNaN(value)) return NaN;
|
589
|
+
if (value === 0 || value === Infinity) return value;
|
590
|
+
if (value === -1) return -Infinity;
|
591
|
+
var result = 0;
|
592
|
+
var n = 50;
|
593
|
+
|
594
|
+
if (value < 0 || value > 1) return Math.log(1 + value);
|
595
|
+
for (var i = 1; i < n; i++) {
|
596
|
+
if ((i % 2) === 0) {
|
597
|
+
result -= Math.pow(value, i) / i;
|
598
|
+
} else {
|
599
|
+
result += Math.pow(value, i) / i;
|
600
|
+
}
|
601
|
+
}
|
602
|
+
|
603
|
+
return result;
|
604
|
+
},
|
605
|
+
|
606
|
+
sign: function(value) {
|
607
|
+
var number = +value;
|
608
|
+
if (number === 0) return number;
|
609
|
+
if (Number.isNaN(number)) return number;
|
610
|
+
return number < 0 ? -1 : 1;
|
611
|
+
},
|
612
|
+
|
613
|
+
sinh: function(value) {
|
614
|
+
value = Number(value);
|
615
|
+
if (!global_isFinite(value) || value === 0) return value;
|
616
|
+
return (Math.exp(value) - Math.exp(-value)) / 2;
|
617
|
+
},
|
618
|
+
|
619
|
+
tanh: function(value) {
|
620
|
+
value = Number(value);
|
621
|
+
if (Number.isNaN(value) || value === 0) return value;
|
622
|
+
if (value === Infinity) return 1;
|
623
|
+
if (value === -Infinity) return -1;
|
624
|
+
return (Math.exp(value) - Math.exp(-value)) / (Math.exp(value) + Math.exp(-value));
|
625
|
+
},
|
626
|
+
|
627
|
+
trunc: function(value) {
|
628
|
+
var number = Number(value);
|
629
|
+
return number < 0 ? -Math.floor(-number) : Math.floor(number);
|
630
|
+
},
|
631
|
+
|
632
|
+
imul: function(x, y) {
|
633
|
+
// taken from https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/imul
|
634
|
+
var ah = (x >>> 16) & 0xffff;
|
635
|
+
var al = x & 0xffff;
|
636
|
+
var bh = (y >>> 16) & 0xffff;
|
637
|
+
var bl = y & 0xffff;
|
638
|
+
// the shift by 0 fixes the sign on the high part
|
639
|
+
// the final |0 converts the unsigned value into a signed value
|
640
|
+
return ((al * bl) + (((ah * bl + al * bh) << 16) >>> 0)|0);
|
641
|
+
}
|
642
|
+
});
|
643
|
+
|
644
|
+
// Map and Set require a true ES5 environment
|
645
|
+
if (supportsDescriptors) {
|
646
|
+
|
647
|
+
var fastkey = function fastkey(key) {
|
648
|
+
var type = typeof key;
|
649
|
+
if (type === 'string') {
|
650
|
+
return '$' + key;
|
651
|
+
} else if (type === 'number' && !Object.is(key, -0)) {
|
652
|
+
return key;
|
653
|
+
}
|
654
|
+
return null;
|
655
|
+
};
|
656
|
+
|
657
|
+
var emptyObject = function emptyObject() {
|
658
|
+
// accomodate some older not-quite-ES5 browsers
|
659
|
+
return Object.create ? Object.create(null) : {};
|
660
|
+
};
|
661
|
+
|
662
|
+
var collectionShims = {
|
663
|
+
Map: (function() {
|
664
|
+
|
665
|
+
var empty = {};
|
666
|
+
|
667
|
+
function MapEntry(key, value) {
|
668
|
+
this.key = key;
|
669
|
+
this.value = value;
|
670
|
+
this.next = null;
|
671
|
+
this.prev = null;
|
672
|
+
}
|
673
|
+
|
674
|
+
MapEntry.prototype.isRemoved = function() {
|
675
|
+
return this.key === empty;
|
676
|
+
};
|
677
|
+
|
678
|
+
function MapIterator(map, kind) {
|
679
|
+
this.head = map._head;
|
680
|
+
this.i = this.head.next;
|
681
|
+
this.kind = kind;
|
682
|
+
}
|
683
|
+
|
684
|
+
MapIterator.prototype = {
|
685
|
+
next: function() {
|
686
|
+
var i = this.i, kind = this.kind, head = this.head, result;
|
687
|
+
while (i !== head) {
|
688
|
+
this.i = i.next;
|
689
|
+
if (!i.isRemoved()) {
|
690
|
+
if (kind === "key") {
|
691
|
+
result = i.key;
|
692
|
+
} else if (kind === "value") {
|
693
|
+
result = i.value;
|
694
|
+
} else {
|
695
|
+
result = [i.key, i.value];
|
696
|
+
}
|
697
|
+
return { value: result, done: false };
|
698
|
+
}
|
699
|
+
i = this.i;
|
700
|
+
}
|
701
|
+
return { value: undefined, done: true };
|
702
|
+
}
|
703
|
+
};
|
704
|
+
|
705
|
+
function Map() {
|
706
|
+
if (!(this instanceof Map)) throw new TypeError('Map must be called with "new"');
|
707
|
+
|
708
|
+
var head = new MapEntry(null, null);
|
709
|
+
// circular doubly-linked list.
|
710
|
+
head.next = head.prev = head;
|
711
|
+
|
712
|
+
defineProperties(this, {
|
713
|
+
'_head': head,
|
714
|
+
'_storage': emptyObject(),
|
715
|
+
'_size': 0
|
716
|
+
});
|
717
|
+
}
|
718
|
+
|
719
|
+
Object.defineProperty(Map.prototype, 'size', {
|
720
|
+
configurable: true,
|
721
|
+
enumerable: false,
|
722
|
+
get: function() {
|
723
|
+
return this._size;
|
724
|
+
}
|
725
|
+
});
|
726
|
+
|
727
|
+
defineProperties(Map.prototype, {
|
728
|
+
get: function(key) {
|
729
|
+
var fkey = fastkey(key);
|
730
|
+
if (fkey !== null) {
|
731
|
+
// fast O(1) path
|
732
|
+
var entry = this._storage[fkey];
|
733
|
+
return entry ? entry.value : undefined;
|
734
|
+
}
|
735
|
+
var head = this._head, i = head;
|
736
|
+
while ((i = i.next) !== head) {
|
737
|
+
if (Object.is(i.key, key)) {
|
738
|
+
return i.value;
|
739
|
+
}
|
740
|
+
}
|
741
|
+
return undefined;
|
742
|
+
},
|
743
|
+
|
744
|
+
has: function(key) {
|
745
|
+
var fkey = fastkey(key);
|
746
|
+
if (fkey !== null) {
|
747
|
+
// fast O(1) path
|
748
|
+
return fkey in this._storage;
|
749
|
+
}
|
750
|
+
var head = this._head, i = head;
|
751
|
+
while ((i = i.next) !== head) {
|
752
|
+
if (Object.is(i.key, key)) {
|
753
|
+
return true;
|
754
|
+
}
|
755
|
+
}
|
756
|
+
return false;
|
757
|
+
},
|
758
|
+
|
759
|
+
set: function(key, value) {
|
760
|
+
var head = this._head, i = head, entry;
|
761
|
+
var fkey = fastkey(key);
|
762
|
+
if (fkey !== null) {
|
763
|
+
// fast O(1) path
|
764
|
+
if (fkey in this._storage) {
|
765
|
+
this._storage[fkey].value = value;
|
766
|
+
return;
|
767
|
+
} else {
|
768
|
+
entry = this._storage[fkey] = new MapEntry(key, value);
|
769
|
+
i = head.prev;
|
770
|
+
// fall through
|
771
|
+
}
|
772
|
+
}
|
773
|
+
while ((i = i.next) !== head) {
|
774
|
+
if (Object.is(i.key, key)) {
|
775
|
+
i.value = value;
|
776
|
+
return;
|
777
|
+
}
|
778
|
+
}
|
779
|
+
entry = entry ? entry : new MapEntry(key, value);
|
780
|
+
entry.next = this._head;
|
781
|
+
entry.prev = this._head.prev;
|
782
|
+
entry.prev.next = entry;
|
783
|
+
entry.next.prev = entry;
|
784
|
+
this._size += 1;
|
785
|
+
},
|
786
|
+
|
787
|
+
'delete': function(key) {
|
788
|
+
var head = this._head, i = head;
|
789
|
+
var fkey = fastkey(key);
|
790
|
+
if (fkey !== null) {
|
791
|
+
// fast O(1) path
|
792
|
+
if (!(fkey in this._storage)) {
|
793
|
+
return false;
|
794
|
+
}
|
795
|
+
i = this._storage[fkey].prev;
|
796
|
+
delete this._storage[fkey];
|
797
|
+
// fall through
|
798
|
+
}
|
799
|
+
while ((i = i.next) !== head) {
|
800
|
+
if (Object.is(i.key, key)) {
|
801
|
+
i.key = i.value = empty;
|
802
|
+
i.prev.next = i.next;
|
803
|
+
i.next.prev = i.prev;
|
804
|
+
this._size -= 1;
|
805
|
+
return true;
|
806
|
+
}
|
807
|
+
}
|
808
|
+
return false;
|
809
|
+
},
|
810
|
+
|
811
|
+
clear: function() {
|
812
|
+
this._size = 0;
|
813
|
+
this._storage = emptyObject();
|
814
|
+
var head = this._head, i = head, p = i.next;
|
815
|
+
while ((i = p) !== head) {
|
816
|
+
i.key = i.value = empty;
|
817
|
+
p = i.next;
|
818
|
+
i.next = i.prev = head;
|
819
|
+
}
|
820
|
+
head.next = head.prev = head;
|
821
|
+
},
|
822
|
+
|
823
|
+
keys: function() {
|
824
|
+
return new MapIterator(this, "key");
|
825
|
+
},
|
826
|
+
|
827
|
+
values: function() {
|
828
|
+
return new MapIterator(this, "value");
|
829
|
+
},
|
830
|
+
|
831
|
+
entries: function() {
|
832
|
+
return new MapIterator(this, "key+value");
|
833
|
+
},
|
834
|
+
|
835
|
+
forEach: function(callback) {
|
836
|
+
var context = arguments.length > 1 ? arguments[1] : null;
|
837
|
+
var entireMap = this;
|
838
|
+
|
839
|
+
var head = this._head, i = head;
|
840
|
+
while ((i = i.next) !== head) {
|
841
|
+
if (!i.isRemoved()) {
|
842
|
+
callback.call(context, i.value, i.key, entireMap);
|
843
|
+
}
|
844
|
+
}
|
845
|
+
}
|
846
|
+
});
|
847
|
+
|
848
|
+
return Map;
|
849
|
+
})(),
|
850
|
+
|
851
|
+
Set: (function() {
|
852
|
+
// Creating a Map is expensive. To speed up the common case of
|
853
|
+
// Sets containing only string or numeric keys, we use an object
|
854
|
+
// as backing storage and lazily create a full Map only when
|
855
|
+
// required.
|
856
|
+
var SetShim = function Set() {
|
857
|
+
if (!(this instanceof SetShim)) throw new TypeError('Set must be called with "new"');
|
858
|
+
defineProperties(this, {
|
859
|
+
'[[SetData]]': null,
|
860
|
+
'_storage': emptyObject()
|
861
|
+
});
|
862
|
+
};
|
863
|
+
|
864
|
+
// Switch from the object backing storage to a full Map.
|
865
|
+
var ensureMap = function ensureMap(set) {
|
866
|
+
if (!set['[[SetData]]']) {
|
867
|
+
var m = set['[[SetData]]'] = new collectionShims.Map();
|
868
|
+
Object.keys(set._storage).forEach(function(k) {
|
869
|
+
// fast check for leading '$'
|
870
|
+
if (k.charCodeAt(0) === 36) {
|
871
|
+
k = k.substring(1);
|
872
|
+
} else {
|
873
|
+
k = +k;
|
874
|
+
}
|
875
|
+
m.set(k, k);
|
876
|
+
});
|
877
|
+
set._storage = null; // free old backing storage
|
878
|
+
}
|
879
|
+
};
|
880
|
+
|
881
|
+
Object.defineProperty(SetShim.prototype, 'size', {
|
882
|
+
configurable: true,
|
883
|
+
enumerable: false,
|
884
|
+
get: function() {
|
885
|
+
ensureMap(this);
|
886
|
+
return this['[[SetData]]'].size;
|
887
|
+
}
|
888
|
+
});
|
889
|
+
|
890
|
+
defineProperties(SetShim.prototype, {
|
891
|
+
has: function(key) {
|
892
|
+
var fkey;
|
893
|
+
if (this._storage && (fkey = fastkey(key)) !== null) {
|
894
|
+
return !!this._storage[fkey];
|
895
|
+
}
|
896
|
+
ensureMap(this);
|
897
|
+
return this['[[SetData]]'].has(key);
|
898
|
+
},
|
899
|
+
|
900
|
+
add: function(key) {
|
901
|
+
var fkey;
|
902
|
+
if (this._storage && (fkey = fastkey(key)) !== null) {
|
903
|
+
this._storage[fkey]=true;
|
904
|
+
return;
|
905
|
+
}
|
906
|
+
ensureMap(this);
|
907
|
+
return this['[[SetData]]'].set(key, key);
|
908
|
+
},
|
909
|
+
|
910
|
+
'delete': function(key) {
|
911
|
+
var fkey;
|
912
|
+
if (this._storage && (fkey = fastkey(key)) !== null) {
|
913
|
+
delete this._storage[fkey];
|
914
|
+
return;
|
915
|
+
}
|
916
|
+
ensureMap(this);
|
917
|
+
return this['[[SetData]]']['delete'](key);
|
918
|
+
},
|
919
|
+
|
920
|
+
clear: function() {
|
921
|
+
if (this._storage) {
|
922
|
+
this._storage = emptyObject();
|
923
|
+
return;
|
924
|
+
}
|
925
|
+
return this['[[SetData]]'].clear();
|
926
|
+
},
|
927
|
+
|
928
|
+
keys: function() {
|
929
|
+
ensureMap(this);
|
930
|
+
return this['[[SetData]]'].keys();
|
931
|
+
},
|
932
|
+
|
933
|
+
values: function() {
|
934
|
+
ensureMap(this);
|
935
|
+
return this['[[SetData]]'].values();
|
936
|
+
},
|
937
|
+
|
938
|
+
entries: function() {
|
939
|
+
ensureMap(this);
|
940
|
+
return this['[[SetData]]'].entries();
|
941
|
+
},
|
942
|
+
|
943
|
+
forEach: function(callback) {
|
944
|
+
var context = arguments.length > 1 ? arguments[1] : null;
|
945
|
+
var entireSet = this;
|
946
|
+
ensureMap(this);
|
947
|
+
this['[[SetData]]'].forEach(function(value, key) {
|
948
|
+
callback.call(context, key, key, entireSet);
|
949
|
+
});
|
950
|
+
}
|
951
|
+
});
|
952
|
+
|
953
|
+
return SetShim;
|
954
|
+
})()
|
955
|
+
};
|
956
|
+
defineProperties(globals, collectionShims);
|
957
|
+
|
958
|
+
if (globals.Map || globals.Set) {
|
959
|
+
/*
|
960
|
+
- In Firefox < 23, Map#size is a function.
|
961
|
+
- In all current Firefox, Set#entries/keys/values & Map#clear do not exist
|
962
|
+
- https://bugzilla.mozilla.org/show_bug.cgi?id=869996
|
963
|
+
- In Firefox 24, Map and Set do not implement forEach
|
964
|
+
*/
|
965
|
+
if (
|
966
|
+
typeof globals.Map.prototype.clear !== 'function' ||
|
967
|
+
new globals.Set().size !== 0 ||
|
968
|
+
new globals.Map().size !== 0 ||
|
969
|
+
typeof globals.Set.prototype.keys !== 'function' ||
|
970
|
+
typeof globals.Map.prototype.forEach !== 'function' ||
|
971
|
+
typeof globals.Set.prototype.forEach !== 'function'
|
972
|
+
) {
|
973
|
+
globals.Map = collectionShims.Map;
|
974
|
+
globals.Set = collectionShims.Set;
|
975
|
+
}
|
976
|
+
}
|
977
|
+
}
|
978
|
+
};
|
979
|
+
|
980
|
+
if (typeof define === 'function' && typeof define.amd === 'object' && define.amd) {
|
981
|
+
define(main); // RequireJS
|
982
|
+
} else {
|
983
|
+
main(); // CommonJS and <script>
|
984
|
+
}
|
985
|
+
})();
|