@eva/plugin-evax 1.1.1-alpha.0 → 1.1.1-fix.1

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.
Files changed (51) hide show
  1. package/README.md +1 -2
  2. package/dist/plugin-evax.cjs.js +10 -8
  3. package/dist/plugin-evax.cjs.prod.js +1 -1
  4. package/dist/plugin-evax.esm.js +7 -6
  5. package/index.js +3 -3
  6. package/package.json +2 -2
  7. package/dist/EVA.plugin.EVAX.js +0 -2907
  8. package/dist/EVA.plugin.EVAX.min.js +0 -1
  9. package/dist/examples/index.d.ts +0 -2
  10. package/dist/examples/index.d.ts.map +0 -1
  11. package/dist/examples/src/a11y.d.ts +0 -3
  12. package/dist/examples/src/a11y.d.ts.map +0 -1
  13. package/dist/examples/src/component.d.ts +0 -3
  14. package/dist/examples/src/component.d.ts.map +0 -1
  15. package/dist/examples/src/compressed-texture.d.ts +0 -1
  16. package/dist/examples/src/compressed-texture.d.ts.map +0 -1
  17. package/dist/examples/src/dragonbone.d.ts +0 -3
  18. package/dist/examples/src/dragonbone.d.ts.map +0 -1
  19. package/dist/examples/src/event.d.ts +0 -3
  20. package/dist/examples/src/event.d.ts.map +0 -1
  21. package/dist/examples/src/graphics.d.ts +0 -3
  22. package/dist/examples/src/graphics.d.ts.map +0 -1
  23. package/dist/examples/src/image.d.ts +0 -3
  24. package/dist/examples/src/image.d.ts.map +0 -1
  25. package/dist/examples/src/loader.d.ts +0 -3
  26. package/dist/examples/src/loader.d.ts.map +0 -1
  27. package/dist/examples/src/lottie.d.ts +0 -3
  28. package/dist/examples/src/lottie.d.ts.map +0 -1
  29. package/dist/examples/src/mask.d.ts +0 -4
  30. package/dist/examples/src/mask.d.ts.map +0 -1
  31. package/dist/examples/src/matter.d.ts +0 -3
  32. package/dist/examples/src/matter.d.ts.map +0 -1
  33. package/dist/examples/src/multi-canvas.d.ts +0 -3
  34. package/dist/examples/src/multi-canvas.d.ts.map +0 -1
  35. package/dist/examples/src/ninePatch.d.ts +0 -3
  36. package/dist/examples/src/ninePatch.d.ts.map +0 -1
  37. package/dist/examples/src/sound.d.ts +0 -3
  38. package/dist/examples/src/sound.d.ts.map +0 -1
  39. package/dist/examples/src/spine.d.ts +0 -3
  40. package/dist/examples/src/spine.d.ts.map +0 -1
  41. package/dist/examples/src/sprite.d.ts +0 -3
  42. package/dist/examples/src/sprite.d.ts.map +0 -1
  43. package/dist/examples/src/spriteAnimation.d.ts +0 -3
  44. package/dist/examples/src/spriteAnimation.d.ts.map +0 -1
  45. package/dist/examples/src/text.d.ts +0 -3
  46. package/dist/examples/src/text.d.ts.map +0 -1
  47. package/dist/examples/src/tilingSprite.d.ts +0 -3
  48. package/dist/examples/src/tilingSprite.d.ts.map +0 -1
  49. package/dist/examples/src/transition.d.ts +0 -3
  50. package/dist/examples/src/transition.d.ts.map +0 -1
  51. package/dist/plugin-evax.d.ts +0 -57
@@ -1,2907 +0,0 @@
1
- (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@eva/eva.js')) :
3
- typeof define === 'function' && define.amd ? define(['exports', '@eva/eva.js'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.EVA = global.EVA || {}, global.EVA.plugin = global.EVA.plugin || {}, global.EVA.plugin.EVAX = {}), global.EVA));
5
- }(this, (function (exports, eva_js) { 'use strict';
6
-
7
- /*! *****************************************************************************
8
- Copyright (c) Microsoft Corporation.
9
-
10
- Permission to use, copy, modify, and/or distribute this software for any
11
- purpose with or without fee is hereby granted.
12
-
13
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
14
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
15
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
16
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
17
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
18
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
19
- PERFORMANCE OF THIS SOFTWARE.
20
- ***************************************************************************** */
21
- /* global Reflect, Promise */
22
-
23
- var extendStatics = function(d, b) {
24
- extendStatics = Object.setPrototypeOf ||
25
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
26
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
27
- return extendStatics(d, b);
28
- };
29
-
30
- function __extends(d, b) {
31
- extendStatics(d, b);
32
- function __() { this.constructor = d; }
33
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
34
- }
35
-
36
- function __decorate(decorators, target, key, desc) {
37
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
38
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
39
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
40
- return c > 3 && r && Object.defineProperty(target, key, r), r;
41
- }
42
-
43
- function __values(o) {
44
- var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
45
- if (m) return m.call(o);
46
- if (o && typeof o.length === "number") return {
47
- next: function () {
48
- if (o && i >= o.length) o = void 0;
49
- return { value: o && o[i++], done: !o };
50
- }
51
- };
52
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
53
- }
54
-
55
- function __read(o, n) {
56
- var m = typeof Symbol === "function" && o[Symbol.iterator];
57
- if (!m) return o;
58
- var i = m.call(o), r, ar = [], e;
59
- try {
60
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
61
- }
62
- catch (error) { e = { error: error }; }
63
- finally {
64
- try {
65
- if (r && !r.done && (m = i["return"])) m.call(i);
66
- }
67
- finally { if (e) throw e.error; }
68
- }
69
- return ar;
70
- }
71
-
72
- function __spread() {
73
- for (var ar = [], i = 0; i < arguments.length; i++)
74
- ar = ar.concat(__read(arguments[i]));
75
- return ar;
76
- }
77
-
78
- var EvaXComponent = (function (_super) {
79
- __extends(EvaXComponent, _super);
80
- function EvaXComponent(gameObject) {
81
- var _this = _super.call(this, gameObject) || this;
82
- _this.events = {};
83
- return _this;
84
- }
85
- EvaXComponent.prototype.init = function (option) {
86
- if (option === void 0) { option = { events: {} }; }
87
- var events = option.events;
88
- this.events = events || {};
89
- };
90
- EvaXComponent.componentName = 'EvaX';
91
- __decorate([
92
- eva_js.decorators.IDEProp
93
- ], EvaXComponent.prototype, "events", void 0);
94
- return EvaXComponent;
95
- }(eva_js.Component));
96
-
97
- function createCommonjsModule(fn) {
98
- var module = { exports: {} };
99
- return fn(module, module.exports), module.exports;
100
- }
101
-
102
- var eventemitter3 = createCommonjsModule(function (module) {
103
-
104
- var has = Object.prototype.hasOwnProperty
105
- , prefix = '~';
106
-
107
- /**
108
- * Constructor to create a storage for our `EE` objects.
109
- * An `Events` instance is a plain object whose properties are event names.
110
- *
111
- * @constructor
112
- * @private
113
- */
114
- function Events() {}
115
-
116
- //
117
- // We try to not inherit from `Object.prototype`. In some engines creating an
118
- // instance in this way is faster than calling `Object.create(null)` directly.
119
- // If `Object.create(null)` is not supported we prefix the event names with a
120
- // character to make sure that the built-in object properties are not
121
- // overridden or used as an attack vector.
122
- //
123
- if (Object.create) {
124
- Events.prototype = Object.create(null);
125
-
126
- //
127
- // This hack is needed because the `__proto__` property is still inherited in
128
- // some old browsers like Android 4, iPhone 5.1, Opera 11 and Safari 5.
129
- //
130
- if (!new Events().__proto__) prefix = false;
131
- }
132
-
133
- /**
134
- * Representation of a single event listener.
135
- *
136
- * @param {Function} fn The listener function.
137
- * @param {*} context The context to invoke the listener with.
138
- * @param {Boolean} [once=false] Specify if the listener is a one-time listener.
139
- * @constructor
140
- * @private
141
- */
142
- function EE(fn, context, once) {
143
- this.fn = fn;
144
- this.context = context;
145
- this.once = once || false;
146
- }
147
-
148
- /**
149
- * Add a listener for a given event.
150
- *
151
- * @param {EventEmitter} emitter Reference to the `EventEmitter` instance.
152
- * @param {(String|Symbol)} event The event name.
153
- * @param {Function} fn The listener function.
154
- * @param {*} context The context to invoke the listener with.
155
- * @param {Boolean} once Specify if the listener is a one-time listener.
156
- * @returns {EventEmitter}
157
- * @private
158
- */
159
- function addListener(emitter, event, fn, context, once) {
160
- if (typeof fn !== 'function') {
161
- throw new TypeError('The listener must be a function');
162
- }
163
-
164
- var listener = new EE(fn, context || emitter, once)
165
- , evt = prefix ? prefix + event : event;
166
-
167
- if (!emitter._events[evt]) emitter._events[evt] = listener, emitter._eventsCount++;
168
- else if (!emitter._events[evt].fn) emitter._events[evt].push(listener);
169
- else emitter._events[evt] = [emitter._events[evt], listener];
170
-
171
- return emitter;
172
- }
173
-
174
- /**
175
- * Clear event by name.
176
- *
177
- * @param {EventEmitter} emitter Reference to the `EventEmitter` instance.
178
- * @param {(String|Symbol)} evt The Event name.
179
- * @private
180
- */
181
- function clearEvent(emitter, evt) {
182
- if (--emitter._eventsCount === 0) emitter._events = new Events();
183
- else delete emitter._events[evt];
184
- }
185
-
186
- /**
187
- * Minimal `EventEmitter` interface that is molded against the Node.js
188
- * `EventEmitter` interface.
189
- *
190
- * @constructor
191
- * @public
192
- */
193
- function EventEmitter() {
194
- this._events = new Events();
195
- this._eventsCount = 0;
196
- }
197
-
198
- /**
199
- * Return an array listing the events for which the emitter has registered
200
- * listeners.
201
- *
202
- * @returns {Array}
203
- * @public
204
- */
205
- EventEmitter.prototype.eventNames = function eventNames() {
206
- var names = []
207
- , events
208
- , name;
209
-
210
- if (this._eventsCount === 0) return names;
211
-
212
- for (name in (events = this._events)) {
213
- if (has.call(events, name)) names.push(prefix ? name.slice(1) : name);
214
- }
215
-
216
- if (Object.getOwnPropertySymbols) {
217
- return names.concat(Object.getOwnPropertySymbols(events));
218
- }
219
-
220
- return names;
221
- };
222
-
223
- /**
224
- * Return the listeners registered for a given event.
225
- *
226
- * @param {(String|Symbol)} event The event name.
227
- * @returns {Array} The registered listeners.
228
- * @public
229
- */
230
- EventEmitter.prototype.listeners = function listeners(event) {
231
- var evt = prefix ? prefix + event : event
232
- , handlers = this._events[evt];
233
-
234
- if (!handlers) return [];
235
- if (handlers.fn) return [handlers.fn];
236
-
237
- for (var i = 0, l = handlers.length, ee = new Array(l); i < l; i++) {
238
- ee[i] = handlers[i].fn;
239
- }
240
-
241
- return ee;
242
- };
243
-
244
- /**
245
- * Return the number of listeners listening to a given event.
246
- *
247
- * @param {(String|Symbol)} event The event name.
248
- * @returns {Number} The number of listeners.
249
- * @public
250
- */
251
- EventEmitter.prototype.listenerCount = function listenerCount(event) {
252
- var evt = prefix ? prefix + event : event
253
- , listeners = this._events[evt];
254
-
255
- if (!listeners) return 0;
256
- if (listeners.fn) return 1;
257
- return listeners.length;
258
- };
259
-
260
- /**
261
- * Calls each of the listeners registered for a given event.
262
- *
263
- * @param {(String|Symbol)} event The event name.
264
- * @returns {Boolean} `true` if the event had listeners, else `false`.
265
- * @public
266
- */
267
- EventEmitter.prototype.emit = function emit(event, a1, a2, a3, a4, a5) {
268
- var evt = prefix ? prefix + event : event;
269
-
270
- if (!this._events[evt]) return false;
271
-
272
- var listeners = this._events[evt]
273
- , len = arguments.length
274
- , args
275
- , i;
276
-
277
- if (listeners.fn) {
278
- if (listeners.once) this.removeListener(event, listeners.fn, undefined, true);
279
-
280
- switch (len) {
281
- case 1: return listeners.fn.call(listeners.context), true;
282
- case 2: return listeners.fn.call(listeners.context, a1), true;
283
- case 3: return listeners.fn.call(listeners.context, a1, a2), true;
284
- case 4: return listeners.fn.call(listeners.context, a1, a2, a3), true;
285
- case 5: return listeners.fn.call(listeners.context, a1, a2, a3, a4), true;
286
- case 6: return listeners.fn.call(listeners.context, a1, a2, a3, a4, a5), true;
287
- }
288
-
289
- for (i = 1, args = new Array(len -1); i < len; i++) {
290
- args[i - 1] = arguments[i];
291
- }
292
-
293
- listeners.fn.apply(listeners.context, args);
294
- } else {
295
- var length = listeners.length
296
- , j;
297
-
298
- for (i = 0; i < length; i++) {
299
- if (listeners[i].once) this.removeListener(event, listeners[i].fn, undefined, true);
300
-
301
- switch (len) {
302
- case 1: listeners[i].fn.call(listeners[i].context); break;
303
- case 2: listeners[i].fn.call(listeners[i].context, a1); break;
304
- case 3: listeners[i].fn.call(listeners[i].context, a1, a2); break;
305
- case 4: listeners[i].fn.call(listeners[i].context, a1, a2, a3); break;
306
- default:
307
- if (!args) for (j = 1, args = new Array(len -1); j < len; j++) {
308
- args[j - 1] = arguments[j];
309
- }
310
-
311
- listeners[i].fn.apply(listeners[i].context, args);
312
- }
313
- }
314
- }
315
-
316
- return true;
317
- };
318
-
319
- /**
320
- * Add a listener for a given event.
321
- *
322
- * @param {(String|Symbol)} event The event name.
323
- * @param {Function} fn The listener function.
324
- * @param {*} [context=this] The context to invoke the listener with.
325
- * @returns {EventEmitter} `this`.
326
- * @public
327
- */
328
- EventEmitter.prototype.on = function on(event, fn, context) {
329
- return addListener(this, event, fn, context, false);
330
- };
331
-
332
- /**
333
- * Add a one-time listener for a given event.
334
- *
335
- * @param {(String|Symbol)} event The event name.
336
- * @param {Function} fn The listener function.
337
- * @param {*} [context=this] The context to invoke the listener with.
338
- * @returns {EventEmitter} `this`.
339
- * @public
340
- */
341
- EventEmitter.prototype.once = function once(event, fn, context) {
342
- return addListener(this, event, fn, context, true);
343
- };
344
-
345
- /**
346
- * Remove the listeners of a given event.
347
- *
348
- * @param {(String|Symbol)} event The event name.
349
- * @param {Function} fn Only remove the listeners that match this function.
350
- * @param {*} context Only remove the listeners that have this context.
351
- * @param {Boolean} once Only remove one-time listeners.
352
- * @returns {EventEmitter} `this`.
353
- * @public
354
- */
355
- EventEmitter.prototype.removeListener = function removeListener(event, fn, context, once) {
356
- var evt = prefix ? prefix + event : event;
357
-
358
- if (!this._events[evt]) return this;
359
- if (!fn) {
360
- clearEvent(this, evt);
361
- return this;
362
- }
363
-
364
- var listeners = this._events[evt];
365
-
366
- if (listeners.fn) {
367
- if (
368
- listeners.fn === fn &&
369
- (!once || listeners.once) &&
370
- (!context || listeners.context === context)
371
- ) {
372
- clearEvent(this, evt);
373
- }
374
- } else {
375
- for (var i = 0, events = [], length = listeners.length; i < length; i++) {
376
- if (
377
- listeners[i].fn !== fn ||
378
- (once && !listeners[i].once) ||
379
- (context && listeners[i].context !== context)
380
- ) {
381
- events.push(listeners[i]);
382
- }
383
- }
384
-
385
- //
386
- // Reset the array, or remove it completely if we have no more listeners.
387
- //
388
- if (events.length) this._events[evt] = events.length === 1 ? events[0] : events;
389
- else clearEvent(this, evt);
390
- }
391
-
392
- return this;
393
- };
394
-
395
- /**
396
- * Remove all listeners, or those of the specified event.
397
- *
398
- * @param {(String|Symbol)} [event] The event name.
399
- * @returns {EventEmitter} `this`.
400
- * @public
401
- */
402
- EventEmitter.prototype.removeAllListeners = function removeAllListeners(event) {
403
- var evt;
404
-
405
- if (event) {
406
- evt = prefix ? prefix + event : event;
407
- if (this._events[evt]) clearEvent(this, evt);
408
- } else {
409
- this._events = new Events();
410
- this._eventsCount = 0;
411
- }
412
-
413
- return this;
414
- };
415
-
416
- //
417
- // Alias methods names because people roll like that.
418
- //
419
- EventEmitter.prototype.off = EventEmitter.prototype.removeListener;
420
- EventEmitter.prototype.addListener = EventEmitter.prototype.on;
421
-
422
- //
423
- // Expose the prefix.
424
- //
425
- EventEmitter.prefixed = prefix;
426
-
427
- //
428
- // Allow `EventEmitter` to be imported as module namespace.
429
- //
430
- EventEmitter.EventEmitter = EventEmitter;
431
-
432
- //
433
- // Expose the module.
434
- //
435
- {
436
- module.exports = EventEmitter;
437
- }
438
- });
439
-
440
- /**
441
- * Removes all key-value entries from the list cache.
442
- *
443
- * @private
444
- * @name clear
445
- * @memberOf ListCache
446
- */
447
- function listCacheClear() {
448
- this.__data__ = [];
449
- this.size = 0;
450
- }
451
-
452
- /**
453
- * Performs a
454
- * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
455
- * comparison between two values to determine if they are equivalent.
456
- *
457
- * @static
458
- * @memberOf _
459
- * @since 4.0.0
460
- * @category Lang
461
- * @param {*} value The value to compare.
462
- * @param {*} other The other value to compare.
463
- * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
464
- * @example
465
- *
466
- * var object = { 'a': 1 };
467
- * var other = { 'a': 1 };
468
- *
469
- * _.eq(object, object);
470
- * // => true
471
- *
472
- * _.eq(object, other);
473
- * // => false
474
- *
475
- * _.eq('a', 'a');
476
- * // => true
477
- *
478
- * _.eq('a', Object('a'));
479
- * // => false
480
- *
481
- * _.eq(NaN, NaN);
482
- * // => true
483
- */
484
- function eq(value, other) {
485
- return value === other || (value !== value && other !== other);
486
- }
487
-
488
- /**
489
- * Gets the index at which the `key` is found in `array` of key-value pairs.
490
- *
491
- * @private
492
- * @param {Array} array The array to inspect.
493
- * @param {*} key The key to search for.
494
- * @returns {number} Returns the index of the matched value, else `-1`.
495
- */
496
- function assocIndexOf(array, key) {
497
- var length = array.length;
498
- while (length--) {
499
- if (eq(array[length][0], key)) {
500
- return length;
501
- }
502
- }
503
- return -1;
504
- }
505
-
506
- /** Used for built-in method references. */
507
- var arrayProto = Array.prototype;
508
-
509
- /** Built-in value references. */
510
- var splice = arrayProto.splice;
511
-
512
- /**
513
- * Removes `key` and its value from the list cache.
514
- *
515
- * @private
516
- * @name delete
517
- * @memberOf ListCache
518
- * @param {string} key The key of the value to remove.
519
- * @returns {boolean} Returns `true` if the entry was removed, else `false`.
520
- */
521
- function listCacheDelete(key) {
522
- var data = this.__data__,
523
- index = assocIndexOf(data, key);
524
-
525
- if (index < 0) {
526
- return false;
527
- }
528
- var lastIndex = data.length - 1;
529
- if (index == lastIndex) {
530
- data.pop();
531
- } else {
532
- splice.call(data, index, 1);
533
- }
534
- --this.size;
535
- return true;
536
- }
537
-
538
- /**
539
- * Gets the list cache value for `key`.
540
- *
541
- * @private
542
- * @name get
543
- * @memberOf ListCache
544
- * @param {string} key The key of the value to get.
545
- * @returns {*} Returns the entry value.
546
- */
547
- function listCacheGet(key) {
548
- var data = this.__data__,
549
- index = assocIndexOf(data, key);
550
-
551
- return index < 0 ? undefined : data[index][1];
552
- }
553
-
554
- /**
555
- * Checks if a list cache value for `key` exists.
556
- *
557
- * @private
558
- * @name has
559
- * @memberOf ListCache
560
- * @param {string} key The key of the entry to check.
561
- * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
562
- */
563
- function listCacheHas(key) {
564
- return assocIndexOf(this.__data__, key) > -1;
565
- }
566
-
567
- /**
568
- * Sets the list cache `key` to `value`.
569
- *
570
- * @private
571
- * @name set
572
- * @memberOf ListCache
573
- * @param {string} key The key of the value to set.
574
- * @param {*} value The value to set.
575
- * @returns {Object} Returns the list cache instance.
576
- */
577
- function listCacheSet(key, value) {
578
- var data = this.__data__,
579
- index = assocIndexOf(data, key);
580
-
581
- if (index < 0) {
582
- ++this.size;
583
- data.push([key, value]);
584
- } else {
585
- data[index][1] = value;
586
- }
587
- return this;
588
- }
589
-
590
- /**
591
- * Creates an list cache object.
592
- *
593
- * @private
594
- * @constructor
595
- * @param {Array} [entries] The key-value pairs to cache.
596
- */
597
- function ListCache(entries) {
598
- var index = -1,
599
- length = entries == null ? 0 : entries.length;
600
-
601
- this.clear();
602
- while (++index < length) {
603
- var entry = entries[index];
604
- this.set(entry[0], entry[1]);
605
- }
606
- }
607
-
608
- // Add methods to `ListCache`.
609
- ListCache.prototype.clear = listCacheClear;
610
- ListCache.prototype['delete'] = listCacheDelete;
611
- ListCache.prototype.get = listCacheGet;
612
- ListCache.prototype.has = listCacheHas;
613
- ListCache.prototype.set = listCacheSet;
614
-
615
- /**
616
- * Removes all key-value entries from the stack.
617
- *
618
- * @private
619
- * @name clear
620
- * @memberOf Stack
621
- */
622
- function stackClear() {
623
- this.__data__ = new ListCache;
624
- this.size = 0;
625
- }
626
-
627
- /**
628
- * Removes `key` and its value from the stack.
629
- *
630
- * @private
631
- * @name delete
632
- * @memberOf Stack
633
- * @param {string} key The key of the value to remove.
634
- * @returns {boolean} Returns `true` if the entry was removed, else `false`.
635
- */
636
- function stackDelete(key) {
637
- var data = this.__data__,
638
- result = data['delete'](key);
639
-
640
- this.size = data.size;
641
- return result;
642
- }
643
-
644
- /**
645
- * Gets the stack value for `key`.
646
- *
647
- * @private
648
- * @name get
649
- * @memberOf Stack
650
- * @param {string} key The key of the value to get.
651
- * @returns {*} Returns the entry value.
652
- */
653
- function stackGet(key) {
654
- return this.__data__.get(key);
655
- }
656
-
657
- /**
658
- * Checks if a stack value for `key` exists.
659
- *
660
- * @private
661
- * @name has
662
- * @memberOf Stack
663
- * @param {string} key The key of the entry to check.
664
- * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
665
- */
666
- function stackHas(key) {
667
- return this.__data__.has(key);
668
- }
669
-
670
- /** Detect free variable `global` from Node.js. */
671
- var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
672
-
673
- /** Detect free variable `self`. */
674
- var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
675
-
676
- /** Used as a reference to the global object. */
677
- var root = freeGlobal || freeSelf || Function('return this')();
678
-
679
- /** Built-in value references. */
680
- var Symbol$1 = root.Symbol;
681
-
682
- /** Used for built-in method references. */
683
- var objectProto$c = Object.prototype;
684
-
685
- /** Used to check objects for own properties. */
686
- var hasOwnProperty$9 = objectProto$c.hasOwnProperty;
687
-
688
- /**
689
- * Used to resolve the
690
- * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
691
- * of values.
692
- */
693
- var nativeObjectToString$1 = objectProto$c.toString;
694
-
695
- /** Built-in value references. */
696
- var symToStringTag$1 = Symbol$1 ? Symbol$1.toStringTag : undefined;
697
-
698
- /**
699
- * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
700
- *
701
- * @private
702
- * @param {*} value The value to query.
703
- * @returns {string} Returns the raw `toStringTag`.
704
- */
705
- function getRawTag(value) {
706
- var isOwn = hasOwnProperty$9.call(value, symToStringTag$1),
707
- tag = value[symToStringTag$1];
708
-
709
- try {
710
- value[symToStringTag$1] = undefined;
711
- var unmasked = true;
712
- } catch (e) {}
713
-
714
- var result = nativeObjectToString$1.call(value);
715
- if (unmasked) {
716
- if (isOwn) {
717
- value[symToStringTag$1] = tag;
718
- } else {
719
- delete value[symToStringTag$1];
720
- }
721
- }
722
- return result;
723
- }
724
-
725
- /** Used for built-in method references. */
726
- var objectProto$b = Object.prototype;
727
-
728
- /**
729
- * Used to resolve the
730
- * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
731
- * of values.
732
- */
733
- var nativeObjectToString = objectProto$b.toString;
734
-
735
- /**
736
- * Converts `value` to a string using `Object.prototype.toString`.
737
- *
738
- * @private
739
- * @param {*} value The value to convert.
740
- * @returns {string} Returns the converted string.
741
- */
742
- function objectToString(value) {
743
- return nativeObjectToString.call(value);
744
- }
745
-
746
- /** `Object#toString` result references. */
747
- var nullTag = '[object Null]',
748
- undefinedTag = '[object Undefined]';
749
-
750
- /** Built-in value references. */
751
- var symToStringTag = Symbol$1 ? Symbol$1.toStringTag : undefined;
752
-
753
- /**
754
- * The base implementation of `getTag` without fallbacks for buggy environments.
755
- *
756
- * @private
757
- * @param {*} value The value to query.
758
- * @returns {string} Returns the `toStringTag`.
759
- */
760
- function baseGetTag(value) {
761
- if (value == null) {
762
- return value === undefined ? undefinedTag : nullTag;
763
- }
764
- return (symToStringTag && symToStringTag in Object(value))
765
- ? getRawTag(value)
766
- : objectToString(value);
767
- }
768
-
769
- /**
770
- * Checks if `value` is the
771
- * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
772
- * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
773
- *
774
- * @static
775
- * @memberOf _
776
- * @since 0.1.0
777
- * @category Lang
778
- * @param {*} value The value to check.
779
- * @returns {boolean} Returns `true` if `value` is an object, else `false`.
780
- * @example
781
- *
782
- * _.isObject({});
783
- * // => true
784
- *
785
- * _.isObject([1, 2, 3]);
786
- * // => true
787
- *
788
- * _.isObject(_.noop);
789
- * // => true
790
- *
791
- * _.isObject(null);
792
- * // => false
793
- */
794
- function isObject(value) {
795
- var type = typeof value;
796
- return value != null && (type == 'object' || type == 'function');
797
- }
798
-
799
- /** `Object#toString` result references. */
800
- var asyncTag = '[object AsyncFunction]',
801
- funcTag$2 = '[object Function]',
802
- genTag$1 = '[object GeneratorFunction]',
803
- proxyTag = '[object Proxy]';
804
-
805
- /**
806
- * Checks if `value` is classified as a `Function` object.
807
- *
808
- * @static
809
- * @memberOf _
810
- * @since 0.1.0
811
- * @category Lang
812
- * @param {*} value The value to check.
813
- * @returns {boolean} Returns `true` if `value` is a function, else `false`.
814
- * @example
815
- *
816
- * _.isFunction(_);
817
- * // => true
818
- *
819
- * _.isFunction(/abc/);
820
- * // => false
821
- */
822
- function isFunction(value) {
823
- if (!isObject(value)) {
824
- return false;
825
- }
826
- // The use of `Object#toString` avoids issues with the `typeof` operator
827
- // in Safari 9 which returns 'object' for typed arrays and other constructors.
828
- var tag = baseGetTag(value);
829
- return tag == funcTag$2 || tag == genTag$1 || tag == asyncTag || tag == proxyTag;
830
- }
831
-
832
- /** Used to detect overreaching core-js shims. */
833
- var coreJsData = root['__core-js_shared__'];
834
-
835
- /** Used to detect methods masquerading as native. */
836
- var maskSrcKey = (function() {
837
- var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
838
- return uid ? ('Symbol(src)_1.' + uid) : '';
839
- }());
840
-
841
- /**
842
- * Checks if `func` has its source masked.
843
- *
844
- * @private
845
- * @param {Function} func The function to check.
846
- * @returns {boolean} Returns `true` if `func` is masked, else `false`.
847
- */
848
- function isMasked(func) {
849
- return !!maskSrcKey && (maskSrcKey in func);
850
- }
851
-
852
- /** Used for built-in method references. */
853
- var funcProto$1 = Function.prototype;
854
-
855
- /** Used to resolve the decompiled source of functions. */
856
- var funcToString$1 = funcProto$1.toString;
857
-
858
- /**
859
- * Converts `func` to its source code.
860
- *
861
- * @private
862
- * @param {Function} func The function to convert.
863
- * @returns {string} Returns the source code.
864
- */
865
- function toSource(func) {
866
- if (func != null) {
867
- try {
868
- return funcToString$1.call(func);
869
- } catch (e) {}
870
- try {
871
- return (func + '');
872
- } catch (e) {}
873
- }
874
- return '';
875
- }
876
-
877
- /**
878
- * Used to match `RegExp`
879
- * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
880
- */
881
- var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
882
-
883
- /** Used to detect host constructors (Safari). */
884
- var reIsHostCtor = /^\[object .+?Constructor\]$/;
885
-
886
- /** Used for built-in method references. */
887
- var funcProto = Function.prototype,
888
- objectProto$a = Object.prototype;
889
-
890
- /** Used to resolve the decompiled source of functions. */
891
- var funcToString = funcProto.toString;
892
-
893
- /** Used to check objects for own properties. */
894
- var hasOwnProperty$8 = objectProto$a.hasOwnProperty;
895
-
896
- /** Used to detect if a method is native. */
897
- var reIsNative = RegExp('^' +
898
- funcToString.call(hasOwnProperty$8).replace(reRegExpChar, '\\$&')
899
- .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
900
- );
901
-
902
- /**
903
- * The base implementation of `_.isNative` without bad shim checks.
904
- *
905
- * @private
906
- * @param {*} value The value to check.
907
- * @returns {boolean} Returns `true` if `value` is a native function,
908
- * else `false`.
909
- */
910
- function baseIsNative(value) {
911
- if (!isObject(value) || isMasked(value)) {
912
- return false;
913
- }
914
- var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
915
- return pattern.test(toSource(value));
916
- }
917
-
918
- /**
919
- * Gets the value at `key` of `object`.
920
- *
921
- * @private
922
- * @param {Object} [object] The object to query.
923
- * @param {string} key The key of the property to get.
924
- * @returns {*} Returns the property value.
925
- */
926
- function getValue(object, key) {
927
- return object == null ? undefined : object[key];
928
- }
929
-
930
- /**
931
- * Gets the native function at `key` of `object`.
932
- *
933
- * @private
934
- * @param {Object} object The object to query.
935
- * @param {string} key The key of the method to get.
936
- * @returns {*} Returns the function if it's native, else `undefined`.
937
- */
938
- function getNative(object, key) {
939
- var value = getValue(object, key);
940
- return baseIsNative(value) ? value : undefined;
941
- }
942
-
943
- /* Built-in method references that are verified to be native. */
944
- var Map$1 = getNative(root, 'Map');
945
-
946
- /* Built-in method references that are verified to be native. */
947
- var nativeCreate = getNative(Object, 'create');
948
-
949
- /**
950
- * Removes all key-value entries from the hash.
951
- *
952
- * @private
953
- * @name clear
954
- * @memberOf Hash
955
- */
956
- function hashClear() {
957
- this.__data__ = nativeCreate ? nativeCreate(null) : {};
958
- this.size = 0;
959
- }
960
-
961
- /**
962
- * Removes `key` and its value from the hash.
963
- *
964
- * @private
965
- * @name delete
966
- * @memberOf Hash
967
- * @param {Object} hash The hash to modify.
968
- * @param {string} key The key of the value to remove.
969
- * @returns {boolean} Returns `true` if the entry was removed, else `false`.
970
- */
971
- function hashDelete(key) {
972
- var result = this.has(key) && delete this.__data__[key];
973
- this.size -= result ? 1 : 0;
974
- return result;
975
- }
976
-
977
- /** Used to stand-in for `undefined` hash values. */
978
- var HASH_UNDEFINED$1 = '__lodash_hash_undefined__';
979
-
980
- /** Used for built-in method references. */
981
- var objectProto$9 = Object.prototype;
982
-
983
- /** Used to check objects for own properties. */
984
- var hasOwnProperty$7 = objectProto$9.hasOwnProperty;
985
-
986
- /**
987
- * Gets the hash value for `key`.
988
- *
989
- * @private
990
- * @name get
991
- * @memberOf Hash
992
- * @param {string} key The key of the value to get.
993
- * @returns {*} Returns the entry value.
994
- */
995
- function hashGet(key) {
996
- var data = this.__data__;
997
- if (nativeCreate) {
998
- var result = data[key];
999
- return result === HASH_UNDEFINED$1 ? undefined : result;
1000
- }
1001
- return hasOwnProperty$7.call(data, key) ? data[key] : undefined;
1002
- }
1003
-
1004
- /** Used for built-in method references. */
1005
- var objectProto$8 = Object.prototype;
1006
-
1007
- /** Used to check objects for own properties. */
1008
- var hasOwnProperty$6 = objectProto$8.hasOwnProperty;
1009
-
1010
- /**
1011
- * Checks if a hash value for `key` exists.
1012
- *
1013
- * @private
1014
- * @name has
1015
- * @memberOf Hash
1016
- * @param {string} key The key of the entry to check.
1017
- * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
1018
- */
1019
- function hashHas(key) {
1020
- var data = this.__data__;
1021
- return nativeCreate ? (data[key] !== undefined) : hasOwnProperty$6.call(data, key);
1022
- }
1023
-
1024
- /** Used to stand-in for `undefined` hash values. */
1025
- var HASH_UNDEFINED = '__lodash_hash_undefined__';
1026
-
1027
- /**
1028
- * Sets the hash `key` to `value`.
1029
- *
1030
- * @private
1031
- * @name set
1032
- * @memberOf Hash
1033
- * @param {string} key The key of the value to set.
1034
- * @param {*} value The value to set.
1035
- * @returns {Object} Returns the hash instance.
1036
- */
1037
- function hashSet(key, value) {
1038
- var data = this.__data__;
1039
- this.size += this.has(key) ? 0 : 1;
1040
- data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;
1041
- return this;
1042
- }
1043
-
1044
- /**
1045
- * Creates a hash object.
1046
- *
1047
- * @private
1048
- * @constructor
1049
- * @param {Array} [entries] The key-value pairs to cache.
1050
- */
1051
- function Hash(entries) {
1052
- var index = -1,
1053
- length = entries == null ? 0 : entries.length;
1054
-
1055
- this.clear();
1056
- while (++index < length) {
1057
- var entry = entries[index];
1058
- this.set(entry[0], entry[1]);
1059
- }
1060
- }
1061
-
1062
- // Add methods to `Hash`.
1063
- Hash.prototype.clear = hashClear;
1064
- Hash.prototype['delete'] = hashDelete;
1065
- Hash.prototype.get = hashGet;
1066
- Hash.prototype.has = hashHas;
1067
- Hash.prototype.set = hashSet;
1068
-
1069
- /**
1070
- * Removes all key-value entries from the map.
1071
- *
1072
- * @private
1073
- * @name clear
1074
- * @memberOf MapCache
1075
- */
1076
- function mapCacheClear() {
1077
- this.size = 0;
1078
- this.__data__ = {
1079
- 'hash': new Hash,
1080
- 'map': new (Map$1 || ListCache),
1081
- 'string': new Hash
1082
- };
1083
- }
1084
-
1085
- /**
1086
- * Checks if `value` is suitable for use as unique object key.
1087
- *
1088
- * @private
1089
- * @param {*} value The value to check.
1090
- * @returns {boolean} Returns `true` if `value` is suitable, else `false`.
1091
- */
1092
- function isKeyable(value) {
1093
- var type = typeof value;
1094
- return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
1095
- ? (value !== '__proto__')
1096
- : (value === null);
1097
- }
1098
-
1099
- /**
1100
- * Gets the data for `map`.
1101
- *
1102
- * @private
1103
- * @param {Object} map The map to query.
1104
- * @param {string} key The reference key.
1105
- * @returns {*} Returns the map data.
1106
- */
1107
- function getMapData(map, key) {
1108
- var data = map.__data__;
1109
- return isKeyable(key)
1110
- ? data[typeof key == 'string' ? 'string' : 'hash']
1111
- : data.map;
1112
- }
1113
-
1114
- /**
1115
- * Removes `key` and its value from the map.
1116
- *
1117
- * @private
1118
- * @name delete
1119
- * @memberOf MapCache
1120
- * @param {string} key The key of the value to remove.
1121
- * @returns {boolean} Returns `true` if the entry was removed, else `false`.
1122
- */
1123
- function mapCacheDelete(key) {
1124
- var result = getMapData(this, key)['delete'](key);
1125
- this.size -= result ? 1 : 0;
1126
- return result;
1127
- }
1128
-
1129
- /**
1130
- * Gets the map value for `key`.
1131
- *
1132
- * @private
1133
- * @name get
1134
- * @memberOf MapCache
1135
- * @param {string} key The key of the value to get.
1136
- * @returns {*} Returns the entry value.
1137
- */
1138
- function mapCacheGet(key) {
1139
- return getMapData(this, key).get(key);
1140
- }
1141
-
1142
- /**
1143
- * Checks if a map value for `key` exists.
1144
- *
1145
- * @private
1146
- * @name has
1147
- * @memberOf MapCache
1148
- * @param {string} key The key of the entry to check.
1149
- * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
1150
- */
1151
- function mapCacheHas(key) {
1152
- return getMapData(this, key).has(key);
1153
- }
1154
-
1155
- /**
1156
- * Sets the map `key` to `value`.
1157
- *
1158
- * @private
1159
- * @name set
1160
- * @memberOf MapCache
1161
- * @param {string} key The key of the value to set.
1162
- * @param {*} value The value to set.
1163
- * @returns {Object} Returns the map cache instance.
1164
- */
1165
- function mapCacheSet(key, value) {
1166
- var data = getMapData(this, key),
1167
- size = data.size;
1168
-
1169
- data.set(key, value);
1170
- this.size += data.size == size ? 0 : 1;
1171
- return this;
1172
- }
1173
-
1174
- /**
1175
- * Creates a map cache object to store key-value pairs.
1176
- *
1177
- * @private
1178
- * @constructor
1179
- * @param {Array} [entries] The key-value pairs to cache.
1180
- */
1181
- function MapCache(entries) {
1182
- var index = -1,
1183
- length = entries == null ? 0 : entries.length;
1184
-
1185
- this.clear();
1186
- while (++index < length) {
1187
- var entry = entries[index];
1188
- this.set(entry[0], entry[1]);
1189
- }
1190
- }
1191
-
1192
- // Add methods to `MapCache`.
1193
- MapCache.prototype.clear = mapCacheClear;
1194
- MapCache.prototype['delete'] = mapCacheDelete;
1195
- MapCache.prototype.get = mapCacheGet;
1196
- MapCache.prototype.has = mapCacheHas;
1197
- MapCache.prototype.set = mapCacheSet;
1198
-
1199
- /** Used as the size to enable large array optimizations. */
1200
- var LARGE_ARRAY_SIZE = 200;
1201
-
1202
- /**
1203
- * Sets the stack `key` to `value`.
1204
- *
1205
- * @private
1206
- * @name set
1207
- * @memberOf Stack
1208
- * @param {string} key The key of the value to set.
1209
- * @param {*} value The value to set.
1210
- * @returns {Object} Returns the stack cache instance.
1211
- */
1212
- function stackSet(key, value) {
1213
- var data = this.__data__;
1214
- if (data instanceof ListCache) {
1215
- var pairs = data.__data__;
1216
- if (!Map$1 || (pairs.length < LARGE_ARRAY_SIZE - 1)) {
1217
- pairs.push([key, value]);
1218
- this.size = ++data.size;
1219
- return this;
1220
- }
1221
- data = this.__data__ = new MapCache(pairs);
1222
- }
1223
- data.set(key, value);
1224
- this.size = data.size;
1225
- return this;
1226
- }
1227
-
1228
- /**
1229
- * Creates a stack cache object to store key-value pairs.
1230
- *
1231
- * @private
1232
- * @constructor
1233
- * @param {Array} [entries] The key-value pairs to cache.
1234
- */
1235
- function Stack(entries) {
1236
- var data = this.__data__ = new ListCache(entries);
1237
- this.size = data.size;
1238
- }
1239
-
1240
- // Add methods to `Stack`.
1241
- Stack.prototype.clear = stackClear;
1242
- Stack.prototype['delete'] = stackDelete;
1243
- Stack.prototype.get = stackGet;
1244
- Stack.prototype.has = stackHas;
1245
- Stack.prototype.set = stackSet;
1246
-
1247
- /**
1248
- * A specialized version of `_.forEach` for arrays without support for
1249
- * iteratee shorthands.
1250
- *
1251
- * @private
1252
- * @param {Array} [array] The array to iterate over.
1253
- * @param {Function} iteratee The function invoked per iteration.
1254
- * @returns {Array} Returns `array`.
1255
- */
1256
- function arrayEach(array, iteratee) {
1257
- var index = -1,
1258
- length = array == null ? 0 : array.length;
1259
-
1260
- while (++index < length) {
1261
- if (iteratee(array[index], index, array) === false) {
1262
- break;
1263
- }
1264
- }
1265
- return array;
1266
- }
1267
-
1268
- var defineProperty$1 = (function() {
1269
- try {
1270
- var func = getNative(Object, 'defineProperty');
1271
- func({}, '', {});
1272
- return func;
1273
- } catch (e) {}
1274
- }());
1275
-
1276
- /**
1277
- * The base implementation of `assignValue` and `assignMergeValue` without
1278
- * value checks.
1279
- *
1280
- * @private
1281
- * @param {Object} object The object to modify.
1282
- * @param {string} key The key of the property to assign.
1283
- * @param {*} value The value to assign.
1284
- */
1285
- function baseAssignValue(object, key, value) {
1286
- if (key == '__proto__' && defineProperty$1) {
1287
- defineProperty$1(object, key, {
1288
- 'configurable': true,
1289
- 'enumerable': true,
1290
- 'value': value,
1291
- 'writable': true
1292
- });
1293
- } else {
1294
- object[key] = value;
1295
- }
1296
- }
1297
-
1298
- /** Used for built-in method references. */
1299
- var objectProto$7 = Object.prototype;
1300
-
1301
- /** Used to check objects for own properties. */
1302
- var hasOwnProperty$5 = objectProto$7.hasOwnProperty;
1303
-
1304
- /**
1305
- * Assigns `value` to `key` of `object` if the existing value is not equivalent
1306
- * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
1307
- * for equality comparisons.
1308
- *
1309
- * @private
1310
- * @param {Object} object The object to modify.
1311
- * @param {string} key The key of the property to assign.
1312
- * @param {*} value The value to assign.
1313
- */
1314
- function assignValue(object, key, value) {
1315
- var objValue = object[key];
1316
- if (!(hasOwnProperty$5.call(object, key) && eq(objValue, value)) ||
1317
- (value === undefined && !(key in object))) {
1318
- baseAssignValue(object, key, value);
1319
- }
1320
- }
1321
-
1322
- /**
1323
- * Copies properties of `source` to `object`.
1324
- *
1325
- * @private
1326
- * @param {Object} source The object to copy properties from.
1327
- * @param {Array} props The property identifiers to copy.
1328
- * @param {Object} [object={}] The object to copy properties to.
1329
- * @param {Function} [customizer] The function to customize copied values.
1330
- * @returns {Object} Returns `object`.
1331
- */
1332
- function copyObject(source, props, object, customizer) {
1333
- var isNew = !object;
1334
- object || (object = {});
1335
-
1336
- var index = -1,
1337
- length = props.length;
1338
-
1339
- while (++index < length) {
1340
- var key = props[index];
1341
-
1342
- var newValue = customizer
1343
- ? customizer(object[key], source[key], key, object, source)
1344
- : undefined;
1345
-
1346
- if (newValue === undefined) {
1347
- newValue = source[key];
1348
- }
1349
- if (isNew) {
1350
- baseAssignValue(object, key, newValue);
1351
- } else {
1352
- assignValue(object, key, newValue);
1353
- }
1354
- }
1355
- return object;
1356
- }
1357
-
1358
- /**
1359
- * The base implementation of `_.times` without support for iteratee shorthands
1360
- * or max array length checks.
1361
- *
1362
- * @private
1363
- * @param {number} n The number of times to invoke `iteratee`.
1364
- * @param {Function} iteratee The function invoked per iteration.
1365
- * @returns {Array} Returns the array of results.
1366
- */
1367
- function baseTimes(n, iteratee) {
1368
- var index = -1,
1369
- result = Array(n);
1370
-
1371
- while (++index < n) {
1372
- result[index] = iteratee(index);
1373
- }
1374
- return result;
1375
- }
1376
-
1377
- /**
1378
- * Checks if `value` is object-like. A value is object-like if it's not `null`
1379
- * and has a `typeof` result of "object".
1380
- *
1381
- * @static
1382
- * @memberOf _
1383
- * @since 4.0.0
1384
- * @category Lang
1385
- * @param {*} value The value to check.
1386
- * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
1387
- * @example
1388
- *
1389
- * _.isObjectLike({});
1390
- * // => true
1391
- *
1392
- * _.isObjectLike([1, 2, 3]);
1393
- * // => true
1394
- *
1395
- * _.isObjectLike(_.noop);
1396
- * // => false
1397
- *
1398
- * _.isObjectLike(null);
1399
- * // => false
1400
- */
1401
- function isObjectLike(value) {
1402
- return value != null && typeof value == 'object';
1403
- }
1404
-
1405
- /** `Object#toString` result references. */
1406
- var argsTag$2 = '[object Arguments]';
1407
-
1408
- /**
1409
- * The base implementation of `_.isArguments`.
1410
- *
1411
- * @private
1412
- * @param {*} value The value to check.
1413
- * @returns {boolean} Returns `true` if `value` is an `arguments` object,
1414
- */
1415
- function baseIsArguments(value) {
1416
- return isObjectLike(value) && baseGetTag(value) == argsTag$2;
1417
- }
1418
-
1419
- /** Used for built-in method references. */
1420
- var objectProto$6 = Object.prototype;
1421
-
1422
- /** Used to check objects for own properties. */
1423
- var hasOwnProperty$4 = objectProto$6.hasOwnProperty;
1424
-
1425
- /** Built-in value references. */
1426
- var propertyIsEnumerable$1 = objectProto$6.propertyIsEnumerable;
1427
-
1428
- /**
1429
- * Checks if `value` is likely an `arguments` object.
1430
- *
1431
- * @static
1432
- * @memberOf _
1433
- * @since 0.1.0
1434
- * @category Lang
1435
- * @param {*} value The value to check.
1436
- * @returns {boolean} Returns `true` if `value` is an `arguments` object,
1437
- * else `false`.
1438
- * @example
1439
- *
1440
- * _.isArguments(function() { return arguments; }());
1441
- * // => true
1442
- *
1443
- * _.isArguments([1, 2, 3]);
1444
- * // => false
1445
- */
1446
- var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {
1447
- return isObjectLike(value) && hasOwnProperty$4.call(value, 'callee') &&
1448
- !propertyIsEnumerable$1.call(value, 'callee');
1449
- };
1450
-
1451
- /**
1452
- * Checks if `value` is classified as an `Array` object.
1453
- *
1454
- * @static
1455
- * @memberOf _
1456
- * @since 0.1.0
1457
- * @category Lang
1458
- * @param {*} value The value to check.
1459
- * @returns {boolean} Returns `true` if `value` is an array, else `false`.
1460
- * @example
1461
- *
1462
- * _.isArray([1, 2, 3]);
1463
- * // => true
1464
- *
1465
- * _.isArray(document.body.children);
1466
- * // => false
1467
- *
1468
- * _.isArray('abc');
1469
- * // => false
1470
- *
1471
- * _.isArray(_.noop);
1472
- * // => false
1473
- */
1474
- var isArray = Array.isArray;
1475
-
1476
- /**
1477
- * This method returns `false`.
1478
- *
1479
- * @static
1480
- * @memberOf _
1481
- * @since 4.13.0
1482
- * @category Util
1483
- * @returns {boolean} Returns `false`.
1484
- * @example
1485
- *
1486
- * _.times(2, _.stubFalse);
1487
- * // => [false, false]
1488
- */
1489
- function stubFalse() {
1490
- return false;
1491
- }
1492
-
1493
- /** Detect free variable `exports`. */
1494
- var freeExports$2 = typeof exports == 'object' && exports && !exports.nodeType && exports;
1495
-
1496
- /** Detect free variable `module`. */
1497
- var freeModule$2 = freeExports$2 && typeof module == 'object' && module && !module.nodeType && module;
1498
-
1499
- /** Detect the popular CommonJS extension `module.exports`. */
1500
- var moduleExports$2 = freeModule$2 && freeModule$2.exports === freeExports$2;
1501
-
1502
- /** Built-in value references. */
1503
- var Buffer$1 = moduleExports$2 ? root.Buffer : undefined;
1504
-
1505
- /* Built-in method references for those with the same name as other `lodash` methods. */
1506
- var nativeIsBuffer = Buffer$1 ? Buffer$1.isBuffer : undefined;
1507
-
1508
- /**
1509
- * Checks if `value` is a buffer.
1510
- *
1511
- * @static
1512
- * @memberOf _
1513
- * @since 4.3.0
1514
- * @category Lang
1515
- * @param {*} value The value to check.
1516
- * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
1517
- * @example
1518
- *
1519
- * _.isBuffer(new Buffer(2));
1520
- * // => true
1521
- *
1522
- * _.isBuffer(new Uint8Array(2));
1523
- * // => false
1524
- */
1525
- var isBuffer = nativeIsBuffer || stubFalse;
1526
-
1527
- /** Used as references for various `Number` constants. */
1528
- var MAX_SAFE_INTEGER$1 = 9007199254740991;
1529
-
1530
- /** Used to detect unsigned integer values. */
1531
- var reIsUint = /^(?:0|[1-9]\d*)$/;
1532
-
1533
- /**
1534
- * Checks if `value` is a valid array-like index.
1535
- *
1536
- * @private
1537
- * @param {*} value The value to check.
1538
- * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
1539
- * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
1540
- */
1541
- function isIndex(value, length) {
1542
- var type = typeof value;
1543
- length = length == null ? MAX_SAFE_INTEGER$1 : length;
1544
-
1545
- return !!length &&
1546
- (type == 'number' ||
1547
- (type != 'symbol' && reIsUint.test(value))) &&
1548
- (value > -1 && value % 1 == 0 && value < length);
1549
- }
1550
-
1551
- /** Used as references for various `Number` constants. */
1552
- var MAX_SAFE_INTEGER = 9007199254740991;
1553
-
1554
- /**
1555
- * Checks if `value` is a valid array-like length.
1556
- *
1557
- * **Note:** This method is loosely based on
1558
- * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
1559
- *
1560
- * @static
1561
- * @memberOf _
1562
- * @since 4.0.0
1563
- * @category Lang
1564
- * @param {*} value The value to check.
1565
- * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
1566
- * @example
1567
- *
1568
- * _.isLength(3);
1569
- * // => true
1570
- *
1571
- * _.isLength(Number.MIN_VALUE);
1572
- * // => false
1573
- *
1574
- * _.isLength(Infinity);
1575
- * // => false
1576
- *
1577
- * _.isLength('3');
1578
- * // => false
1579
- */
1580
- function isLength(value) {
1581
- return typeof value == 'number' &&
1582
- value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
1583
- }
1584
-
1585
- /** `Object#toString` result references. */
1586
- var argsTag$1 = '[object Arguments]',
1587
- arrayTag$1 = '[object Array]',
1588
- boolTag$2 = '[object Boolean]',
1589
- dateTag$2 = '[object Date]',
1590
- errorTag$1 = '[object Error]',
1591
- funcTag$1 = '[object Function]',
1592
- mapTag$4 = '[object Map]',
1593
- numberTag$2 = '[object Number]',
1594
- objectTag$2 = '[object Object]',
1595
- regexpTag$2 = '[object RegExp]',
1596
- setTag$4 = '[object Set]',
1597
- stringTag$2 = '[object String]',
1598
- weakMapTag$2 = '[object WeakMap]';
1599
-
1600
- var arrayBufferTag$2 = '[object ArrayBuffer]',
1601
- dataViewTag$3 = '[object DataView]',
1602
- float32Tag$2 = '[object Float32Array]',
1603
- float64Tag$2 = '[object Float64Array]',
1604
- int8Tag$2 = '[object Int8Array]',
1605
- int16Tag$2 = '[object Int16Array]',
1606
- int32Tag$2 = '[object Int32Array]',
1607
- uint8Tag$2 = '[object Uint8Array]',
1608
- uint8ClampedTag$2 = '[object Uint8ClampedArray]',
1609
- uint16Tag$2 = '[object Uint16Array]',
1610
- uint32Tag$2 = '[object Uint32Array]';
1611
-
1612
- /** Used to identify `toStringTag` values of typed arrays. */
1613
- var typedArrayTags = {};
1614
- typedArrayTags[float32Tag$2] = typedArrayTags[float64Tag$2] =
1615
- typedArrayTags[int8Tag$2] = typedArrayTags[int16Tag$2] =
1616
- typedArrayTags[int32Tag$2] = typedArrayTags[uint8Tag$2] =
1617
- typedArrayTags[uint8ClampedTag$2] = typedArrayTags[uint16Tag$2] =
1618
- typedArrayTags[uint32Tag$2] = true;
1619
- typedArrayTags[argsTag$1] = typedArrayTags[arrayTag$1] =
1620
- typedArrayTags[arrayBufferTag$2] = typedArrayTags[boolTag$2] =
1621
- typedArrayTags[dataViewTag$3] = typedArrayTags[dateTag$2] =
1622
- typedArrayTags[errorTag$1] = typedArrayTags[funcTag$1] =
1623
- typedArrayTags[mapTag$4] = typedArrayTags[numberTag$2] =
1624
- typedArrayTags[objectTag$2] = typedArrayTags[regexpTag$2] =
1625
- typedArrayTags[setTag$4] = typedArrayTags[stringTag$2] =
1626
- typedArrayTags[weakMapTag$2] = false;
1627
-
1628
- /**
1629
- * The base implementation of `_.isTypedArray` without Node.js optimizations.
1630
- *
1631
- * @private
1632
- * @param {*} value The value to check.
1633
- * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
1634
- */
1635
- function baseIsTypedArray(value) {
1636
- return isObjectLike(value) &&
1637
- isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
1638
- }
1639
-
1640
- /**
1641
- * The base implementation of `_.unary` without support for storing metadata.
1642
- *
1643
- * @private
1644
- * @param {Function} func The function to cap arguments for.
1645
- * @returns {Function} Returns the new capped function.
1646
- */
1647
- function baseUnary(func) {
1648
- return function(value) {
1649
- return func(value);
1650
- };
1651
- }
1652
-
1653
- /** Detect free variable `exports`. */
1654
- var freeExports$1 = typeof exports == 'object' && exports && !exports.nodeType && exports;
1655
-
1656
- /** Detect free variable `module`. */
1657
- var freeModule$1 = freeExports$1 && typeof module == 'object' && module && !module.nodeType && module;
1658
-
1659
- /** Detect the popular CommonJS extension `module.exports`. */
1660
- var moduleExports$1 = freeModule$1 && freeModule$1.exports === freeExports$1;
1661
-
1662
- /** Detect free variable `process` from Node.js. */
1663
- var freeProcess = moduleExports$1 && freeGlobal.process;
1664
-
1665
- /** Used to access faster Node.js helpers. */
1666
- var nodeUtil = (function() {
1667
- try {
1668
- // Use `util.types` for Node.js 10+.
1669
- var types = freeModule$1 && freeModule$1.require && freeModule$1.require('util').types;
1670
-
1671
- if (types) {
1672
- return types;
1673
- }
1674
-
1675
- // Legacy `process.binding('util')` for Node.js < 10.
1676
- return freeProcess && freeProcess.binding && freeProcess.binding('util');
1677
- } catch (e) {}
1678
- }());
1679
-
1680
- /* Node.js helper references. */
1681
- var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
1682
-
1683
- /**
1684
- * Checks if `value` is classified as a typed array.
1685
- *
1686
- * @static
1687
- * @memberOf _
1688
- * @since 3.0.0
1689
- * @category Lang
1690
- * @param {*} value The value to check.
1691
- * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
1692
- * @example
1693
- *
1694
- * _.isTypedArray(new Uint8Array);
1695
- * // => true
1696
- *
1697
- * _.isTypedArray([]);
1698
- * // => false
1699
- */
1700
- var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
1701
-
1702
- /** Used for built-in method references. */
1703
- var objectProto$5 = Object.prototype;
1704
-
1705
- /** Used to check objects for own properties. */
1706
- var hasOwnProperty$3 = objectProto$5.hasOwnProperty;
1707
-
1708
- /**
1709
- * Creates an array of the enumerable property names of the array-like `value`.
1710
- *
1711
- * @private
1712
- * @param {*} value The value to query.
1713
- * @param {boolean} inherited Specify returning inherited property names.
1714
- * @returns {Array} Returns the array of property names.
1715
- */
1716
- function arrayLikeKeys(value, inherited) {
1717
- var isArr = isArray(value),
1718
- isArg = !isArr && isArguments(value),
1719
- isBuff = !isArr && !isArg && isBuffer(value),
1720
- isType = !isArr && !isArg && !isBuff && isTypedArray(value),
1721
- skipIndexes = isArr || isArg || isBuff || isType,
1722
- result = skipIndexes ? baseTimes(value.length, String) : [],
1723
- length = result.length;
1724
-
1725
- for (var key in value) {
1726
- if ((inherited || hasOwnProperty$3.call(value, key)) &&
1727
- !(skipIndexes && (
1728
- // Safari 9 has enumerable `arguments.length` in strict mode.
1729
- key == 'length' ||
1730
- // Node.js 0.10 has enumerable non-index properties on buffers.
1731
- (isBuff && (key == 'offset' || key == 'parent')) ||
1732
- // PhantomJS 2 has enumerable non-index properties on typed arrays.
1733
- (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||
1734
- // Skip index properties.
1735
- isIndex(key, length)
1736
- ))) {
1737
- result.push(key);
1738
- }
1739
- }
1740
- return result;
1741
- }
1742
-
1743
- /** Used for built-in method references. */
1744
- var objectProto$4 = Object.prototype;
1745
-
1746
- /**
1747
- * Checks if `value` is likely a prototype object.
1748
- *
1749
- * @private
1750
- * @param {*} value The value to check.
1751
- * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
1752
- */
1753
- function isPrototype(value) {
1754
- var Ctor = value && value.constructor,
1755
- proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto$4;
1756
-
1757
- return value === proto;
1758
- }
1759
-
1760
- /**
1761
- * Creates a unary function that invokes `func` with its argument transformed.
1762
- *
1763
- * @private
1764
- * @param {Function} func The function to wrap.
1765
- * @param {Function} transform The argument transform.
1766
- * @returns {Function} Returns the new function.
1767
- */
1768
- function overArg(func, transform) {
1769
- return function(arg) {
1770
- return func(transform(arg));
1771
- };
1772
- }
1773
-
1774
- /* Built-in method references for those with the same name as other `lodash` methods. */
1775
- var nativeKeys = overArg(Object.keys, Object);
1776
-
1777
- /** Used for built-in method references. */
1778
- var objectProto$3 = Object.prototype;
1779
-
1780
- /** Used to check objects for own properties. */
1781
- var hasOwnProperty$2 = objectProto$3.hasOwnProperty;
1782
-
1783
- /**
1784
- * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
1785
- *
1786
- * @private
1787
- * @param {Object} object The object to query.
1788
- * @returns {Array} Returns the array of property names.
1789
- */
1790
- function baseKeys(object) {
1791
- if (!isPrototype(object)) {
1792
- return nativeKeys(object);
1793
- }
1794
- var result = [];
1795
- for (var key in Object(object)) {
1796
- if (hasOwnProperty$2.call(object, key) && key != 'constructor') {
1797
- result.push(key);
1798
- }
1799
- }
1800
- return result;
1801
- }
1802
-
1803
- /**
1804
- * Checks if `value` is array-like. A value is considered array-like if it's
1805
- * not a function and has a `value.length` that's an integer greater than or
1806
- * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
1807
- *
1808
- * @static
1809
- * @memberOf _
1810
- * @since 4.0.0
1811
- * @category Lang
1812
- * @param {*} value The value to check.
1813
- * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
1814
- * @example
1815
- *
1816
- * _.isArrayLike([1, 2, 3]);
1817
- * // => true
1818
- *
1819
- * _.isArrayLike(document.body.children);
1820
- * // => true
1821
- *
1822
- * _.isArrayLike('abc');
1823
- * // => true
1824
- *
1825
- * _.isArrayLike(_.noop);
1826
- * // => false
1827
- */
1828
- function isArrayLike(value) {
1829
- return value != null && isLength(value.length) && !isFunction(value);
1830
- }
1831
-
1832
- /**
1833
- * Creates an array of the own enumerable property names of `object`.
1834
- *
1835
- * **Note:** Non-object values are coerced to objects. See the
1836
- * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
1837
- * for more details.
1838
- *
1839
- * @static
1840
- * @since 0.1.0
1841
- * @memberOf _
1842
- * @category Object
1843
- * @param {Object} object The object to query.
1844
- * @returns {Array} Returns the array of property names.
1845
- * @example
1846
- *
1847
- * function Foo() {
1848
- * this.a = 1;
1849
- * this.b = 2;
1850
- * }
1851
- *
1852
- * Foo.prototype.c = 3;
1853
- *
1854
- * _.keys(new Foo);
1855
- * // => ['a', 'b'] (iteration order is not guaranteed)
1856
- *
1857
- * _.keys('hi');
1858
- * // => ['0', '1']
1859
- */
1860
- function keys(object) {
1861
- return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
1862
- }
1863
-
1864
- /**
1865
- * The base implementation of `_.assign` without support for multiple sources
1866
- * or `customizer` functions.
1867
- *
1868
- * @private
1869
- * @param {Object} object The destination object.
1870
- * @param {Object} source The source object.
1871
- * @returns {Object} Returns `object`.
1872
- */
1873
- function baseAssign(object, source) {
1874
- return object && copyObject(source, keys(source), object);
1875
- }
1876
-
1877
- /**
1878
- * This function is like
1879
- * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
1880
- * except that it includes inherited enumerable properties.
1881
- *
1882
- * @private
1883
- * @param {Object} object The object to query.
1884
- * @returns {Array} Returns the array of property names.
1885
- */
1886
- function nativeKeysIn(object) {
1887
- var result = [];
1888
- if (object != null) {
1889
- for (var key in Object(object)) {
1890
- result.push(key);
1891
- }
1892
- }
1893
- return result;
1894
- }
1895
-
1896
- /** Used for built-in method references. */
1897
- var objectProto$2 = Object.prototype;
1898
-
1899
- /** Used to check objects for own properties. */
1900
- var hasOwnProperty$1 = objectProto$2.hasOwnProperty;
1901
-
1902
- /**
1903
- * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense.
1904
- *
1905
- * @private
1906
- * @param {Object} object The object to query.
1907
- * @returns {Array} Returns the array of property names.
1908
- */
1909
- function baseKeysIn(object) {
1910
- if (!isObject(object)) {
1911
- return nativeKeysIn(object);
1912
- }
1913
- var isProto = isPrototype(object),
1914
- result = [];
1915
-
1916
- for (var key in object) {
1917
- if (!(key == 'constructor' && (isProto || !hasOwnProperty$1.call(object, key)))) {
1918
- result.push(key);
1919
- }
1920
- }
1921
- return result;
1922
- }
1923
-
1924
- /**
1925
- * Creates an array of the own and inherited enumerable property names of `object`.
1926
- *
1927
- * **Note:** Non-object values are coerced to objects.
1928
- *
1929
- * @static
1930
- * @memberOf _
1931
- * @since 3.0.0
1932
- * @category Object
1933
- * @param {Object} object The object to query.
1934
- * @returns {Array} Returns the array of property names.
1935
- * @example
1936
- *
1937
- * function Foo() {
1938
- * this.a = 1;
1939
- * this.b = 2;
1940
- * }
1941
- *
1942
- * Foo.prototype.c = 3;
1943
- *
1944
- * _.keysIn(new Foo);
1945
- * // => ['a', 'b', 'c'] (iteration order is not guaranteed)
1946
- */
1947
- function keysIn(object) {
1948
- return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);
1949
- }
1950
-
1951
- /**
1952
- * The base implementation of `_.assignIn` without support for multiple sources
1953
- * or `customizer` functions.
1954
- *
1955
- * @private
1956
- * @param {Object} object The destination object.
1957
- * @param {Object} source The source object.
1958
- * @returns {Object} Returns `object`.
1959
- */
1960
- function baseAssignIn(object, source) {
1961
- return object && copyObject(source, keysIn(source), object);
1962
- }
1963
-
1964
- /** Detect free variable `exports`. */
1965
- var freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;
1966
-
1967
- /** Detect free variable `module`. */
1968
- var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;
1969
-
1970
- /** Detect the popular CommonJS extension `module.exports`. */
1971
- var moduleExports = freeModule && freeModule.exports === freeExports;
1972
-
1973
- /** Built-in value references. */
1974
- var Buffer = moduleExports ? root.Buffer : undefined,
1975
- allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined;
1976
-
1977
- /**
1978
- * Creates a clone of `buffer`.
1979
- *
1980
- * @private
1981
- * @param {Buffer} buffer The buffer to clone.
1982
- * @param {boolean} [isDeep] Specify a deep clone.
1983
- * @returns {Buffer} Returns the cloned buffer.
1984
- */
1985
- function cloneBuffer(buffer, isDeep) {
1986
- if (isDeep) {
1987
- return buffer.slice();
1988
- }
1989
- var length = buffer.length,
1990
- result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);
1991
-
1992
- buffer.copy(result);
1993
- return result;
1994
- }
1995
-
1996
- /**
1997
- * Copies the values of `source` to `array`.
1998
- *
1999
- * @private
2000
- * @param {Array} source The array to copy values from.
2001
- * @param {Array} [array=[]] The array to copy values to.
2002
- * @returns {Array} Returns `array`.
2003
- */
2004
- function copyArray(source, array) {
2005
- var index = -1,
2006
- length = source.length;
2007
-
2008
- array || (array = Array(length));
2009
- while (++index < length) {
2010
- array[index] = source[index];
2011
- }
2012
- return array;
2013
- }
2014
-
2015
- /**
2016
- * A specialized version of `_.filter` for arrays without support for
2017
- * iteratee shorthands.
2018
- *
2019
- * @private
2020
- * @param {Array} [array] The array to iterate over.
2021
- * @param {Function} predicate The function invoked per iteration.
2022
- * @returns {Array} Returns the new filtered array.
2023
- */
2024
- function arrayFilter(array, predicate) {
2025
- var index = -1,
2026
- length = array == null ? 0 : array.length,
2027
- resIndex = 0,
2028
- result = [];
2029
-
2030
- while (++index < length) {
2031
- var value = array[index];
2032
- if (predicate(value, index, array)) {
2033
- result[resIndex++] = value;
2034
- }
2035
- }
2036
- return result;
2037
- }
2038
-
2039
- /**
2040
- * This method returns a new empty array.
2041
- *
2042
- * @static
2043
- * @memberOf _
2044
- * @since 4.13.0
2045
- * @category Util
2046
- * @returns {Array} Returns the new empty array.
2047
- * @example
2048
- *
2049
- * var arrays = _.times(2, _.stubArray);
2050
- *
2051
- * console.log(arrays);
2052
- * // => [[], []]
2053
- *
2054
- * console.log(arrays[0] === arrays[1]);
2055
- * // => false
2056
- */
2057
- function stubArray() {
2058
- return [];
2059
- }
2060
-
2061
- /** Used for built-in method references. */
2062
- var objectProto$1 = Object.prototype;
2063
-
2064
- /** Built-in value references. */
2065
- var propertyIsEnumerable = objectProto$1.propertyIsEnumerable;
2066
-
2067
- /* Built-in method references for those with the same name as other `lodash` methods. */
2068
- var nativeGetSymbols$1 = Object.getOwnPropertySymbols;
2069
-
2070
- /**
2071
- * Creates an array of the own enumerable symbols of `object`.
2072
- *
2073
- * @private
2074
- * @param {Object} object The object to query.
2075
- * @returns {Array} Returns the array of symbols.
2076
- */
2077
- var getSymbols = !nativeGetSymbols$1 ? stubArray : function(object) {
2078
- if (object == null) {
2079
- return [];
2080
- }
2081
- object = Object(object);
2082
- return arrayFilter(nativeGetSymbols$1(object), function(symbol) {
2083
- return propertyIsEnumerable.call(object, symbol);
2084
- });
2085
- };
2086
-
2087
- /**
2088
- * Copies own symbols of `source` to `object`.
2089
- *
2090
- * @private
2091
- * @param {Object} source The object to copy symbols from.
2092
- * @param {Object} [object={}] The object to copy symbols to.
2093
- * @returns {Object} Returns `object`.
2094
- */
2095
- function copySymbols(source, object) {
2096
- return copyObject(source, getSymbols(source), object);
2097
- }
2098
-
2099
- /**
2100
- * Appends the elements of `values` to `array`.
2101
- *
2102
- * @private
2103
- * @param {Array} array The array to modify.
2104
- * @param {Array} values The values to append.
2105
- * @returns {Array} Returns `array`.
2106
- */
2107
- function arrayPush(array, values) {
2108
- var index = -1,
2109
- length = values.length,
2110
- offset = array.length;
2111
-
2112
- while (++index < length) {
2113
- array[offset + index] = values[index];
2114
- }
2115
- return array;
2116
- }
2117
-
2118
- /** Built-in value references. */
2119
- var getPrototype = overArg(Object.getPrototypeOf, Object);
2120
-
2121
- /* Built-in method references for those with the same name as other `lodash` methods. */
2122
- var nativeGetSymbols = Object.getOwnPropertySymbols;
2123
-
2124
- /**
2125
- * Creates an array of the own and inherited enumerable symbols of `object`.
2126
- *
2127
- * @private
2128
- * @param {Object} object The object to query.
2129
- * @returns {Array} Returns the array of symbols.
2130
- */
2131
- var getSymbolsIn = !nativeGetSymbols ? stubArray : function(object) {
2132
- var result = [];
2133
- while (object) {
2134
- arrayPush(result, getSymbols(object));
2135
- object = getPrototype(object);
2136
- }
2137
- return result;
2138
- };
2139
-
2140
- /**
2141
- * Copies own and inherited symbols of `source` to `object`.
2142
- *
2143
- * @private
2144
- * @param {Object} source The object to copy symbols from.
2145
- * @param {Object} [object={}] The object to copy symbols to.
2146
- * @returns {Object} Returns `object`.
2147
- */
2148
- function copySymbolsIn(source, object) {
2149
- return copyObject(source, getSymbolsIn(source), object);
2150
- }
2151
-
2152
- /**
2153
- * The base implementation of `getAllKeys` and `getAllKeysIn` which uses
2154
- * `keysFunc` and `symbolsFunc` to get the enumerable property names and
2155
- * symbols of `object`.
2156
- *
2157
- * @private
2158
- * @param {Object} object The object to query.
2159
- * @param {Function} keysFunc The function to get the keys of `object`.
2160
- * @param {Function} symbolsFunc The function to get the symbols of `object`.
2161
- * @returns {Array} Returns the array of property names and symbols.
2162
- */
2163
- function baseGetAllKeys(object, keysFunc, symbolsFunc) {
2164
- var result = keysFunc(object);
2165
- return isArray(object) ? result : arrayPush(result, symbolsFunc(object));
2166
- }
2167
-
2168
- /**
2169
- * Creates an array of own enumerable property names and symbols of `object`.
2170
- *
2171
- * @private
2172
- * @param {Object} object The object to query.
2173
- * @returns {Array} Returns the array of property names and symbols.
2174
- */
2175
- function getAllKeys(object) {
2176
- return baseGetAllKeys(object, keys, getSymbols);
2177
- }
2178
-
2179
- /**
2180
- * Creates an array of own and inherited enumerable property names and
2181
- * symbols of `object`.
2182
- *
2183
- * @private
2184
- * @param {Object} object The object to query.
2185
- * @returns {Array} Returns the array of property names and symbols.
2186
- */
2187
- function getAllKeysIn(object) {
2188
- return baseGetAllKeys(object, keysIn, getSymbolsIn);
2189
- }
2190
-
2191
- /* Built-in method references that are verified to be native. */
2192
- var DataView = getNative(root, 'DataView');
2193
-
2194
- /* Built-in method references that are verified to be native. */
2195
- var Promise$1 = getNative(root, 'Promise');
2196
-
2197
- /* Built-in method references that are verified to be native. */
2198
- var Set = getNative(root, 'Set');
2199
-
2200
- /* Built-in method references that are verified to be native. */
2201
- var WeakMap = getNative(root, 'WeakMap');
2202
-
2203
- /** `Object#toString` result references. */
2204
- var mapTag$3 = '[object Map]',
2205
- objectTag$1 = '[object Object]',
2206
- promiseTag = '[object Promise]',
2207
- setTag$3 = '[object Set]',
2208
- weakMapTag$1 = '[object WeakMap]';
2209
-
2210
- var dataViewTag$2 = '[object DataView]';
2211
-
2212
- /** Used to detect maps, sets, and weakmaps. */
2213
- var dataViewCtorString = toSource(DataView),
2214
- mapCtorString = toSource(Map$1),
2215
- promiseCtorString = toSource(Promise$1),
2216
- setCtorString = toSource(Set),
2217
- weakMapCtorString = toSource(WeakMap);
2218
-
2219
- /**
2220
- * Gets the `toStringTag` of `value`.
2221
- *
2222
- * @private
2223
- * @param {*} value The value to query.
2224
- * @returns {string} Returns the `toStringTag`.
2225
- */
2226
- var getTag = baseGetTag;
2227
-
2228
- // Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.
2229
- if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag$2) ||
2230
- (Map$1 && getTag(new Map$1) != mapTag$3) ||
2231
- (Promise$1 && getTag(Promise$1.resolve()) != promiseTag) ||
2232
- (Set && getTag(new Set) != setTag$3) ||
2233
- (WeakMap && getTag(new WeakMap) != weakMapTag$1)) {
2234
- getTag = function(value) {
2235
- var result = baseGetTag(value),
2236
- Ctor = result == objectTag$1 ? value.constructor : undefined,
2237
- ctorString = Ctor ? toSource(Ctor) : '';
2238
-
2239
- if (ctorString) {
2240
- switch (ctorString) {
2241
- case dataViewCtorString: return dataViewTag$2;
2242
- case mapCtorString: return mapTag$3;
2243
- case promiseCtorString: return promiseTag;
2244
- case setCtorString: return setTag$3;
2245
- case weakMapCtorString: return weakMapTag$1;
2246
- }
2247
- }
2248
- return result;
2249
- };
2250
- }
2251
-
2252
- var getTag$1 = getTag;
2253
-
2254
- /** Used for built-in method references. */
2255
- var objectProto = Object.prototype;
2256
-
2257
- /** Used to check objects for own properties. */
2258
- var hasOwnProperty = objectProto.hasOwnProperty;
2259
-
2260
- /**
2261
- * Initializes an array clone.
2262
- *
2263
- * @private
2264
- * @param {Array} array The array to clone.
2265
- * @returns {Array} Returns the initialized clone.
2266
- */
2267
- function initCloneArray(array) {
2268
- var length = array.length,
2269
- result = new array.constructor(length);
2270
-
2271
- // Add properties assigned by `RegExp#exec`.
2272
- if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) {
2273
- result.index = array.index;
2274
- result.input = array.input;
2275
- }
2276
- return result;
2277
- }
2278
-
2279
- /** Built-in value references. */
2280
- var Uint8Array = root.Uint8Array;
2281
-
2282
- /**
2283
- * Creates a clone of `arrayBuffer`.
2284
- *
2285
- * @private
2286
- * @param {ArrayBuffer} arrayBuffer The array buffer to clone.
2287
- * @returns {ArrayBuffer} Returns the cloned array buffer.
2288
- */
2289
- function cloneArrayBuffer(arrayBuffer) {
2290
- var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
2291
- new Uint8Array(result).set(new Uint8Array(arrayBuffer));
2292
- return result;
2293
- }
2294
-
2295
- /**
2296
- * Creates a clone of `dataView`.
2297
- *
2298
- * @private
2299
- * @param {Object} dataView The data view to clone.
2300
- * @param {boolean} [isDeep] Specify a deep clone.
2301
- * @returns {Object} Returns the cloned data view.
2302
- */
2303
- function cloneDataView(dataView, isDeep) {
2304
- var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer;
2305
- return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
2306
- }
2307
-
2308
- /** Used to match `RegExp` flags from their coerced string values. */
2309
- var reFlags = /\w*$/;
2310
-
2311
- /**
2312
- * Creates a clone of `regexp`.
2313
- *
2314
- * @private
2315
- * @param {Object} regexp The regexp to clone.
2316
- * @returns {Object} Returns the cloned regexp.
2317
- */
2318
- function cloneRegExp(regexp) {
2319
- var result = new regexp.constructor(regexp.source, reFlags.exec(regexp));
2320
- result.lastIndex = regexp.lastIndex;
2321
- return result;
2322
- }
2323
-
2324
- /** Used to convert symbols to primitives and strings. */
2325
- var symbolProto = Symbol$1 ? Symbol$1.prototype : undefined,
2326
- symbolValueOf = symbolProto ? symbolProto.valueOf : undefined;
2327
-
2328
- /**
2329
- * Creates a clone of the `symbol` object.
2330
- *
2331
- * @private
2332
- * @param {Object} symbol The symbol object to clone.
2333
- * @returns {Object} Returns the cloned symbol object.
2334
- */
2335
- function cloneSymbol(symbol) {
2336
- return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {};
2337
- }
2338
-
2339
- /**
2340
- * Creates a clone of `typedArray`.
2341
- *
2342
- * @private
2343
- * @param {Object} typedArray The typed array to clone.
2344
- * @param {boolean} [isDeep] Specify a deep clone.
2345
- * @returns {Object} Returns the cloned typed array.
2346
- */
2347
- function cloneTypedArray(typedArray, isDeep) {
2348
- var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
2349
- return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
2350
- }
2351
-
2352
- /** `Object#toString` result references. */
2353
- var boolTag$1 = '[object Boolean]',
2354
- dateTag$1 = '[object Date]',
2355
- mapTag$2 = '[object Map]',
2356
- numberTag$1 = '[object Number]',
2357
- regexpTag$1 = '[object RegExp]',
2358
- setTag$2 = '[object Set]',
2359
- stringTag$1 = '[object String]',
2360
- symbolTag$1 = '[object Symbol]';
2361
-
2362
- var arrayBufferTag$1 = '[object ArrayBuffer]',
2363
- dataViewTag$1 = '[object DataView]',
2364
- float32Tag$1 = '[object Float32Array]',
2365
- float64Tag$1 = '[object Float64Array]',
2366
- int8Tag$1 = '[object Int8Array]',
2367
- int16Tag$1 = '[object Int16Array]',
2368
- int32Tag$1 = '[object Int32Array]',
2369
- uint8Tag$1 = '[object Uint8Array]',
2370
- uint8ClampedTag$1 = '[object Uint8ClampedArray]',
2371
- uint16Tag$1 = '[object Uint16Array]',
2372
- uint32Tag$1 = '[object Uint32Array]';
2373
-
2374
- /**
2375
- * Initializes an object clone based on its `toStringTag`.
2376
- *
2377
- * **Note:** This function only supports cloning values with tags of
2378
- * `Boolean`, `Date`, `Error`, `Map`, `Number`, `RegExp`, `Set`, or `String`.
2379
- *
2380
- * @private
2381
- * @param {Object} object The object to clone.
2382
- * @param {string} tag The `toStringTag` of the object to clone.
2383
- * @param {boolean} [isDeep] Specify a deep clone.
2384
- * @returns {Object} Returns the initialized clone.
2385
- */
2386
- function initCloneByTag(object, tag, isDeep) {
2387
- var Ctor = object.constructor;
2388
- switch (tag) {
2389
- case arrayBufferTag$1:
2390
- return cloneArrayBuffer(object);
2391
-
2392
- case boolTag$1:
2393
- case dateTag$1:
2394
- return new Ctor(+object);
2395
-
2396
- case dataViewTag$1:
2397
- return cloneDataView(object, isDeep);
2398
-
2399
- case float32Tag$1: case float64Tag$1:
2400
- case int8Tag$1: case int16Tag$1: case int32Tag$1:
2401
- case uint8Tag$1: case uint8ClampedTag$1: case uint16Tag$1: case uint32Tag$1:
2402
- return cloneTypedArray(object, isDeep);
2403
-
2404
- case mapTag$2:
2405
- return new Ctor;
2406
-
2407
- case numberTag$1:
2408
- case stringTag$1:
2409
- return new Ctor(object);
2410
-
2411
- case regexpTag$1:
2412
- return cloneRegExp(object);
2413
-
2414
- case setTag$2:
2415
- return new Ctor;
2416
-
2417
- case symbolTag$1:
2418
- return cloneSymbol(object);
2419
- }
2420
- }
2421
-
2422
- /** Built-in value references. */
2423
- var objectCreate = Object.create;
2424
-
2425
- /**
2426
- * The base implementation of `_.create` without support for assigning
2427
- * properties to the created object.
2428
- *
2429
- * @private
2430
- * @param {Object} proto The object to inherit from.
2431
- * @returns {Object} Returns the new object.
2432
- */
2433
- var baseCreate = (function() {
2434
- function object() {}
2435
- return function(proto) {
2436
- if (!isObject(proto)) {
2437
- return {};
2438
- }
2439
- if (objectCreate) {
2440
- return objectCreate(proto);
2441
- }
2442
- object.prototype = proto;
2443
- var result = new object;
2444
- object.prototype = undefined;
2445
- return result;
2446
- };
2447
- }());
2448
-
2449
- /**
2450
- * Initializes an object clone.
2451
- *
2452
- * @private
2453
- * @param {Object} object The object to clone.
2454
- * @returns {Object} Returns the initialized clone.
2455
- */
2456
- function initCloneObject(object) {
2457
- return (typeof object.constructor == 'function' && !isPrototype(object))
2458
- ? baseCreate(getPrototype(object))
2459
- : {};
2460
- }
2461
-
2462
- /** `Object#toString` result references. */
2463
- var mapTag$1 = '[object Map]';
2464
-
2465
- /**
2466
- * The base implementation of `_.isMap` without Node.js optimizations.
2467
- *
2468
- * @private
2469
- * @param {*} value The value to check.
2470
- * @returns {boolean} Returns `true` if `value` is a map, else `false`.
2471
- */
2472
- function baseIsMap(value) {
2473
- return isObjectLike(value) && getTag$1(value) == mapTag$1;
2474
- }
2475
-
2476
- /* Node.js helper references. */
2477
- var nodeIsMap = nodeUtil && nodeUtil.isMap;
2478
-
2479
- /**
2480
- * Checks if `value` is classified as a `Map` object.
2481
- *
2482
- * @static
2483
- * @memberOf _
2484
- * @since 4.3.0
2485
- * @category Lang
2486
- * @param {*} value The value to check.
2487
- * @returns {boolean} Returns `true` if `value` is a map, else `false`.
2488
- * @example
2489
- *
2490
- * _.isMap(new Map);
2491
- * // => true
2492
- *
2493
- * _.isMap(new WeakMap);
2494
- * // => false
2495
- */
2496
- var isMap = nodeIsMap ? baseUnary(nodeIsMap) : baseIsMap;
2497
-
2498
- /** `Object#toString` result references. */
2499
- var setTag$1 = '[object Set]';
2500
-
2501
- /**
2502
- * The base implementation of `_.isSet` without Node.js optimizations.
2503
- *
2504
- * @private
2505
- * @param {*} value The value to check.
2506
- * @returns {boolean} Returns `true` if `value` is a set, else `false`.
2507
- */
2508
- function baseIsSet(value) {
2509
- return isObjectLike(value) && getTag$1(value) == setTag$1;
2510
- }
2511
-
2512
- /* Node.js helper references. */
2513
- var nodeIsSet = nodeUtil && nodeUtil.isSet;
2514
-
2515
- /**
2516
- * Checks if `value` is classified as a `Set` object.
2517
- *
2518
- * @static
2519
- * @memberOf _
2520
- * @since 4.3.0
2521
- * @category Lang
2522
- * @param {*} value The value to check.
2523
- * @returns {boolean} Returns `true` if `value` is a set, else `false`.
2524
- * @example
2525
- *
2526
- * _.isSet(new Set);
2527
- * // => true
2528
- *
2529
- * _.isSet(new WeakSet);
2530
- * // => false
2531
- */
2532
- var isSet = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet;
2533
-
2534
- /** Used to compose bitmasks for cloning. */
2535
- var CLONE_DEEP_FLAG$1 = 1,
2536
- CLONE_FLAT_FLAG = 2,
2537
- CLONE_SYMBOLS_FLAG$1 = 4;
2538
-
2539
- /** `Object#toString` result references. */
2540
- var argsTag = '[object Arguments]',
2541
- arrayTag = '[object Array]',
2542
- boolTag = '[object Boolean]',
2543
- dateTag = '[object Date]',
2544
- errorTag = '[object Error]',
2545
- funcTag = '[object Function]',
2546
- genTag = '[object GeneratorFunction]',
2547
- mapTag = '[object Map]',
2548
- numberTag = '[object Number]',
2549
- objectTag = '[object Object]',
2550
- regexpTag = '[object RegExp]',
2551
- setTag = '[object Set]',
2552
- stringTag = '[object String]',
2553
- symbolTag = '[object Symbol]',
2554
- weakMapTag = '[object WeakMap]';
2555
-
2556
- var arrayBufferTag = '[object ArrayBuffer]',
2557
- dataViewTag = '[object DataView]',
2558
- float32Tag = '[object Float32Array]',
2559
- float64Tag = '[object Float64Array]',
2560
- int8Tag = '[object Int8Array]',
2561
- int16Tag = '[object Int16Array]',
2562
- int32Tag = '[object Int32Array]',
2563
- uint8Tag = '[object Uint8Array]',
2564
- uint8ClampedTag = '[object Uint8ClampedArray]',
2565
- uint16Tag = '[object Uint16Array]',
2566
- uint32Tag = '[object Uint32Array]';
2567
-
2568
- /** Used to identify `toStringTag` values supported by `_.clone`. */
2569
- var cloneableTags = {};
2570
- cloneableTags[argsTag] = cloneableTags[arrayTag] =
2571
- cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] =
2572
- cloneableTags[boolTag] = cloneableTags[dateTag] =
2573
- cloneableTags[float32Tag] = cloneableTags[float64Tag] =
2574
- cloneableTags[int8Tag] = cloneableTags[int16Tag] =
2575
- cloneableTags[int32Tag] = cloneableTags[mapTag] =
2576
- cloneableTags[numberTag] = cloneableTags[objectTag] =
2577
- cloneableTags[regexpTag] = cloneableTags[setTag] =
2578
- cloneableTags[stringTag] = cloneableTags[symbolTag] =
2579
- cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] =
2580
- cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;
2581
- cloneableTags[errorTag] = cloneableTags[funcTag] =
2582
- cloneableTags[weakMapTag] = false;
2583
-
2584
- /**
2585
- * The base implementation of `_.clone` and `_.cloneDeep` which tracks
2586
- * traversed objects.
2587
- *
2588
- * @private
2589
- * @param {*} value The value to clone.
2590
- * @param {boolean} bitmask The bitmask flags.
2591
- * 1 - Deep clone
2592
- * 2 - Flatten inherited properties
2593
- * 4 - Clone symbols
2594
- * @param {Function} [customizer] The function to customize cloning.
2595
- * @param {string} [key] The key of `value`.
2596
- * @param {Object} [object] The parent object of `value`.
2597
- * @param {Object} [stack] Tracks traversed objects and their clone counterparts.
2598
- * @returns {*} Returns the cloned value.
2599
- */
2600
- function baseClone(value, bitmask, customizer, key, object, stack) {
2601
- var result,
2602
- isDeep = bitmask & CLONE_DEEP_FLAG$1,
2603
- isFlat = bitmask & CLONE_FLAT_FLAG,
2604
- isFull = bitmask & CLONE_SYMBOLS_FLAG$1;
2605
-
2606
- if (customizer) {
2607
- result = object ? customizer(value, key, object, stack) : customizer(value);
2608
- }
2609
- if (result !== undefined) {
2610
- return result;
2611
- }
2612
- if (!isObject(value)) {
2613
- return value;
2614
- }
2615
- var isArr = isArray(value);
2616
- if (isArr) {
2617
- result = initCloneArray(value);
2618
- if (!isDeep) {
2619
- return copyArray(value, result);
2620
- }
2621
- } else {
2622
- var tag = getTag$1(value),
2623
- isFunc = tag == funcTag || tag == genTag;
2624
-
2625
- if (isBuffer(value)) {
2626
- return cloneBuffer(value, isDeep);
2627
- }
2628
- if (tag == objectTag || tag == argsTag || (isFunc && !object)) {
2629
- result = (isFlat || isFunc) ? {} : initCloneObject(value);
2630
- if (!isDeep) {
2631
- return isFlat
2632
- ? copySymbolsIn(value, baseAssignIn(result, value))
2633
- : copySymbols(value, baseAssign(result, value));
2634
- }
2635
- } else {
2636
- if (!cloneableTags[tag]) {
2637
- return object ? value : {};
2638
- }
2639
- result = initCloneByTag(value, tag, isDeep);
2640
- }
2641
- }
2642
- // Check for circular references and return its corresponding clone.
2643
- stack || (stack = new Stack);
2644
- var stacked = stack.get(value);
2645
- if (stacked) {
2646
- return stacked;
2647
- }
2648
- stack.set(value, result);
2649
-
2650
- if (isSet(value)) {
2651
- value.forEach(function(subValue) {
2652
- result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack));
2653
- });
2654
- } else if (isMap(value)) {
2655
- value.forEach(function(subValue, key) {
2656
- result.set(key, baseClone(subValue, bitmask, customizer, key, value, stack));
2657
- });
2658
- }
2659
-
2660
- var keysFunc = isFull
2661
- ? (isFlat ? getAllKeysIn : getAllKeys)
2662
- : (isFlat ? keysIn : keys);
2663
-
2664
- var props = isArr ? undefined : keysFunc(value);
2665
- arrayEach(props || value, function(subValue, key) {
2666
- if (props) {
2667
- key = subValue;
2668
- subValue = value[key];
2669
- }
2670
- // Recursively populate clone (susceptible to call stack limits).
2671
- assignValue(result, key, baseClone(subValue, bitmask, customizer, key, value, stack));
2672
- });
2673
- return result;
2674
- }
2675
-
2676
- /** Used to compose bitmasks for cloning. */
2677
- var CLONE_DEEP_FLAG = 1,
2678
- CLONE_SYMBOLS_FLAG = 4;
2679
-
2680
- /**
2681
- * This method is like `_.clone` except that it recursively clones `value`.
2682
- *
2683
- * @static
2684
- * @memberOf _
2685
- * @since 1.0.0
2686
- * @category Lang
2687
- * @param {*} value The value to recursively clone.
2688
- * @returns {*} Returns the deep cloned value.
2689
- * @see _.clone
2690
- * @example
2691
- *
2692
- * var objects = [{ 'a': 1 }, { 'b': 2 }];
2693
- *
2694
- * var deep = _.cloneDeep(objects);
2695
- * console.log(deep[0] === objects[0]);
2696
- * // => false
2697
- */
2698
- function cloneDeep(value) {
2699
- return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG);
2700
- }
2701
-
2702
- var _defineCache = new Map();
2703
- function defineProperty(key, deep, store, originKey, originStore, callback) {
2704
- if (!_defineCache.has(store)) {
2705
- _defineCache.set(store, []);
2706
- }
2707
- if (_defineCache.get(store).indexOf(key) > -1) {
2708
- return;
2709
- }
2710
- _defineCache.get(store).push(key);
2711
- var props = key.split('.');
2712
- var obj = store;
2713
- var length = props.length;
2714
- for (var i = 0; i < length - 1; i++) {
2715
- if (obj[props[i]] === undefined) {
2716
- return;
2717
- }
2718
- obj = obj[props[i]];
2719
- }
2720
- var value = obj[props[length - 1]];
2721
- if (deep && isObject(value)) {
2722
- for (var key_1 in value) {
2723
- defineProperty(key_1, deep, value, originKey, originStore, callback);
2724
- }
2725
- }
2726
- var _key = "_" + props[length - 1];
2727
- obj[_key] = value;
2728
- Object.defineProperty(obj, _key, {
2729
- enumerable: false,
2730
- });
2731
- Object.defineProperty(obj, props[length - 1], {
2732
- set: function (val) {
2733
- var oldStore = cloneDeep(originStore);
2734
- obj["_" + props[length - 1]] = val;
2735
- callback(originKey, oldStore);
2736
- if (deep && isObject(val)) {
2737
- _defineCache.delete(obj);
2738
- for (var key_2 in val) {
2739
- defineProperty(key_2, deep, val, originKey, originStore, callback);
2740
- }
2741
- }
2742
- },
2743
- get: function () {
2744
- return obj["_" + props[length - 1]];
2745
- },
2746
- });
2747
- }
2748
- function updateStore(store, newStore, force) {
2749
- for (var key in store) {
2750
- if (!(key in newStore)) {
2751
- continue;
2752
- }
2753
- if (typeof store[key] === 'object') {
2754
- updateStore(store[key], newStore[key], force);
2755
- }
2756
- else {
2757
- if (force || store[key] !== newStore[key]) {
2758
- store[key] = newStore[key];
2759
- }
2760
- }
2761
- }
2762
- }
2763
-
2764
- var EvaXSystem = (function (_super) {
2765
- __extends(EvaXSystem, _super);
2766
- function EvaXSystem() {
2767
- var _this = _super !== null && _super.apply(this, arguments) || this;
2768
- _this.changeList = [];
2769
- return _this;
2770
- }
2771
- EvaXSystem.prototype.init = function (_a) {
2772
- var _b = (_a === void 0 ? { store: {} } : _a).store, store = _b === void 0 ? {} : _b;
2773
- this.ee = new eventemitter3();
2774
- this.store = store;
2775
- this.bindDefaultListener();
2776
- };
2777
- EvaXSystem.prototype.bindDefaultListener = function () {
2778
- var _this = this;
2779
- this.ee.on('evax.updateStore', function (store) {
2780
- _this.updateStore(store);
2781
- });
2782
- this.ee.on('evax.forceUpdateStore', function (store) {
2783
- _this.forceUpdateStore(store);
2784
- });
2785
- };
2786
- EvaXSystem.prototype.changeCallback = function (key, oldStore) {
2787
- this.changeList.push({
2788
- key: key,
2789
- oldStore: oldStore,
2790
- });
2791
- };
2792
- EvaXSystem.prototype.updateStore = function (store) {
2793
- updateStore(this.store, store, false);
2794
- };
2795
- EvaXSystem.prototype.forceUpdateStore = function (store) {
2796
- updateStore(this.store, store, true);
2797
- };
2798
- EvaXSystem.prototype.bindListener = function (key, deep) {
2799
- var _this = this;
2800
- if (key.indexOf('store.') === -1) {
2801
- return;
2802
- }
2803
- var realKey = key.split('.').slice(1).join('.');
2804
- defineProperty(realKey, deep, this.store, key, this.store, function (key, oldStore) { return _this.changeCallback(key, oldStore); });
2805
- };
2806
- EvaXSystem.prototype.update = function () {
2807
- var e_1, _a;
2808
- var changes = this.componentObserver.clear();
2809
- try {
2810
- for (var changes_1 = __values(changes), changes_1_1 = changes_1.next(); !changes_1_1.done; changes_1_1 = changes_1.next()) {
2811
- var changed = changes_1_1.value;
2812
- switch (changed.type) {
2813
- case eva_js.OBSERVER_TYPE.ADD:
2814
- this.add(changed);
2815
- break;
2816
- case eva_js.OBSERVER_TYPE.REMOVE:
2817
- this.remove(changed);
2818
- break;
2819
- }
2820
- }
2821
- }
2822
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
2823
- finally {
2824
- try {
2825
- if (changes_1_1 && !changes_1_1.done && (_a = changes_1.return)) _a.call(changes_1);
2826
- }
2827
- finally { if (e_1) throw e_1.error; }
2828
- }
2829
- };
2830
- EvaXSystem.prototype.lateUpdate = function () {
2831
- var e_2, _a;
2832
- try {
2833
- for (var _b = __values(this.changeList), _c = _b.next(); !_c.done; _c = _b.next()) {
2834
- var item = _c.value;
2835
- this.ee.emit(item.key, this.store, item.oldStore);
2836
- }
2837
- }
2838
- catch (e_2_1) { e_2 = { error: e_2_1 }; }
2839
- finally {
2840
- try {
2841
- if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
2842
- }
2843
- finally { if (e_2) throw e_2.error; }
2844
- }
2845
- this.changeList = [];
2846
- };
2847
- EvaXSystem.prototype.add = function (changed) {
2848
- var component = changed.component;
2849
- component.evax = this;
2850
- for (var key in component.events) {
2851
- if (component.events[key]) {
2852
- this.bindListener(key, !!component.events[key].deep);
2853
- var func = void 0;
2854
- if (component.events[key] instanceof Function) {
2855
- func = component.events[key];
2856
- }
2857
- else {
2858
- func = component.events[key].handler;
2859
- }
2860
- this.ee.on(key, func.bind(component));
2861
- }
2862
- }
2863
- };
2864
- EvaXSystem.prototype.remove = function (changed) {
2865
- var component = changed.component;
2866
- for (var key in component.events) {
2867
- if (component.events[key] instanceof Function) {
2868
- this.ee.off(key, component.events[key].bind(component));
2869
- }
2870
- }
2871
- };
2872
- EvaXSystem.prototype.on = function (eventName, func) {
2873
- return this.ee.on(eventName, func, this);
2874
- };
2875
- EvaXSystem.prototype.off = function (eventName, func) {
2876
- return this.ee.off(eventName, func);
2877
- };
2878
- EvaXSystem.prototype.emit = function (eventName) {
2879
- var _a;
2880
- var args = [];
2881
- for (var _i = 1; _i < arguments.length; _i++) {
2882
- args[_i - 1] = arguments[_i];
2883
- }
2884
- return (_a = this.ee).emit.apply(_a, __spread([eventName], args));
2885
- };
2886
- EvaXSystem.prototype.onDestroy = function () { };
2887
- EvaXSystem.systemName = 'EvaX';
2888
- EvaXSystem = __decorate([
2889
- eva_js.decorators.componentObserver({
2890
- EvaX: [],
2891
- })
2892
- ], EvaXSystem);
2893
- return EvaXSystem;
2894
- }(eva_js.System));
2895
-
2896
- var index = {
2897
- Components: [EvaXComponent],
2898
- Systems: [EvaXSystem],
2899
- };
2900
-
2901
- exports.EvaX = EvaXComponent;
2902
- exports.EvaXSystem = EvaXSystem;
2903
- exports.default = index;
2904
-
2905
- Object.defineProperty(exports, '__esModule', { value: true });
2906
-
2907
- })));