UNPKG

123 kBJavaScriptView Raw
1require=(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
2'use strict';
3var numberIsNan = require('number-is-nan');
4
5module.exports = Number.isFinite || function (val) {
6 return !(typeof val !== 'number' || numberIsNan(val) || val === Infinity || val === -Infinity);
7};
8
9},{"number-is-nan":6}],2:[function(require,module,exports){
10// https://github.com/paulmillr/es6-shim
11// http://people.mozilla.org/~jorendorff/es6-draft.html#sec-number.isinteger
12var isFinite = require("is-finite");
13module.exports = Number.isInteger || function(val) {
14 return typeof val === "number" &&
15 isFinite(val) &&
16 Math.floor(val) === val;
17};
18
19},{"is-finite":1}],3:[function(require,module,exports){
20(function (global){
21/**
22 * lodash (Custom Build) <https://lodash.com/>
23 * Build: `lodash modularize exports="npm" -o ./`
24 * Copyright jQuery Foundation and other contributors <https://jquery.org/>
25 * Released under MIT license <https://lodash.com/license>
26 * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
27 * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
28 */
29
30/** Used as the size to enable large array optimizations. */
31var LARGE_ARRAY_SIZE = 200;
32
33/** Used to stand-in for `undefined` hash values. */
34var HASH_UNDEFINED = '__lodash_hash_undefined__';
35
36/** Used to compose bitmasks for comparison styles. */
37var UNORDERED_COMPARE_FLAG = 1,
38 PARTIAL_COMPARE_FLAG = 2;
39
40/** Used as references for various `Number` constants. */
41var MAX_SAFE_INTEGER = 9007199254740991;
42
43/** `Object#toString` result references. */
44var argsTag = '[object Arguments]',
45 arrayTag = '[object Array]',
46 boolTag = '[object Boolean]',
47 dateTag = '[object Date]',
48 errorTag = '[object Error]',
49 funcTag = '[object Function]',
50 genTag = '[object GeneratorFunction]',
51 mapTag = '[object Map]',
52 numberTag = '[object Number]',
53 objectTag = '[object Object]',
54 promiseTag = '[object Promise]',
55 regexpTag = '[object RegExp]',
56 setTag = '[object Set]',
57 stringTag = '[object String]',
58 symbolTag = '[object Symbol]',
59 weakMapTag = '[object WeakMap]';
60
61var arrayBufferTag = '[object ArrayBuffer]',
62 dataViewTag = '[object DataView]',
63 float32Tag = '[object Float32Array]',
64 float64Tag = '[object Float64Array]',
65 int8Tag = '[object Int8Array]',
66 int16Tag = '[object Int16Array]',
67 int32Tag = '[object Int32Array]',
68 uint8Tag = '[object Uint8Array]',
69 uint8ClampedTag = '[object Uint8ClampedArray]',
70 uint16Tag = '[object Uint16Array]',
71 uint32Tag = '[object Uint32Array]';
72
73/**
74 * Used to match `RegExp`
75 * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
76 */
77var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
78
79/** Used to detect host constructors (Safari). */
80var reIsHostCtor = /^\[object .+?Constructor\]$/;
81
82/** Used to detect unsigned integer values. */
83var reIsUint = /^(?:0|[1-9]\d*)$/;
84
85/** Used to identify `toStringTag` values of typed arrays. */
86var typedArrayTags = {};
87typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
88typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
89typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
90typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
91typedArrayTags[uint32Tag] = true;
92typedArrayTags[argsTag] = typedArrayTags[arrayTag] =
93typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
94typedArrayTags[dataViewTag] = typedArrayTags[dateTag] =
95typedArrayTags[errorTag] = typedArrayTags[funcTag] =
96typedArrayTags[mapTag] = typedArrayTags[numberTag] =
97typedArrayTags[objectTag] = typedArrayTags[regexpTag] =
98typedArrayTags[setTag] = typedArrayTags[stringTag] =
99typedArrayTags[weakMapTag] = false;
100
101/** Detect free variable `global` from Node.js. */
102var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
103
104/** Detect free variable `self`. */
105var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
106
107/** Used as a reference to the global object. */
108var root = freeGlobal || freeSelf || Function('return this')();
109
110/** Detect free variable `exports`. */
111var freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;
112
113/** Detect free variable `module`. */
114var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;
115
116/** Detect the popular CommonJS extension `module.exports`. */
117var moduleExports = freeModule && freeModule.exports === freeExports;
118
119/** Detect free variable `process` from Node.js. */
120var freeProcess = moduleExports && freeGlobal.process;
121
122/** Used to access faster Node.js helpers. */
123var nodeUtil = (function() {
124 try {
125 return freeProcess && freeProcess.binding('util');
126 } catch (e) {}
127}());
128
129/* Node.js helper references. */
130var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
131
132/**
133 * A specialized version of `_.some` for arrays without support for iteratee
134 * shorthands.
135 *
136 * @private
137 * @param {Array} [array] The array to iterate over.
138 * @param {Function} predicate The function invoked per iteration.
139 * @returns {boolean} Returns `true` if any element passes the predicate check,
140 * else `false`.
141 */
142function arraySome(array, predicate) {
143 var index = -1,
144 length = array ? array.length : 0;
145
146 while (++index < length) {
147 if (predicate(array[index], index, array)) {
148 return true;
149 }
150 }
151 return false;
152}
153
154/**
155 * The base implementation of `_.times` without support for iteratee shorthands
156 * or max array length checks.
157 *
158 * @private
159 * @param {number} n The number of times to invoke `iteratee`.
160 * @param {Function} iteratee The function invoked per iteration.
161 * @returns {Array} Returns the array of results.
162 */
163function baseTimes(n, iteratee) {
164 var index = -1,
165 result = Array(n);
166
167 while (++index < n) {
168 result[index] = iteratee(index);
169 }
170 return result;
171}
172
173/**
174 * The base implementation of `_.unary` without support for storing metadata.
175 *
176 * @private
177 * @param {Function} func The function to cap arguments for.
178 * @returns {Function} Returns the new capped function.
179 */
180function baseUnary(func) {
181 return function(value) {
182 return func(value);
183 };
184}
185
186/**
187 * Gets the value at `key` of `object`.
188 *
189 * @private
190 * @param {Object} [object] The object to query.
191 * @param {string} key The key of the property to get.
192 * @returns {*} Returns the property value.
193 */
194function getValue(object, key) {
195 return object == null ? undefined : object[key];
196}
197
198/**
199 * Checks if `value` is a host object in IE < 9.
200 *
201 * @private
202 * @param {*} value The value to check.
203 * @returns {boolean} Returns `true` if `value` is a host object, else `false`.
204 */
205function isHostObject(value) {
206 // Many host objects are `Object` objects that can coerce to strings
207 // despite having improperly defined `toString` methods.
208 var result = false;
209 if (value != null && typeof value.toString != 'function') {
210 try {
211 result = !!(value + '');
212 } catch (e) {}
213 }
214 return result;
215}
216
217/**
218 * Converts `map` to its key-value pairs.
219 *
220 * @private
221 * @param {Object} map The map to convert.
222 * @returns {Array} Returns the key-value pairs.
223 */
224function mapToArray(map) {
225 var index = -1,
226 result = Array(map.size);
227
228 map.forEach(function(value, key) {
229 result[++index] = [key, value];
230 });
231 return result;
232}
233
234/**
235 * Creates a unary function that invokes `func` with its argument transformed.
236 *
237 * @private
238 * @param {Function} func The function to wrap.
239 * @param {Function} transform The argument transform.
240 * @returns {Function} Returns the new function.
241 */
242function overArg(func, transform) {
243 return function(arg) {
244 return func(transform(arg));
245 };
246}
247
248/**
249 * Converts `set` to an array of its values.
250 *
251 * @private
252 * @param {Object} set The set to convert.
253 * @returns {Array} Returns the values.
254 */
255function setToArray(set) {
256 var index = -1,
257 result = Array(set.size);
258
259 set.forEach(function(value) {
260 result[++index] = value;
261 });
262 return result;
263}
264
265/** Used for built-in method references. */
266var arrayProto = Array.prototype,
267 funcProto = Function.prototype,
268 objectProto = Object.prototype;
269
270/** Used to detect overreaching core-js shims. */
271var coreJsData = root['__core-js_shared__'];
272
273/** Used to detect methods masquerading as native. */
274var maskSrcKey = (function() {
275 var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
276 return uid ? ('Symbol(src)_1.' + uid) : '';
277}());
278
279/** Used to resolve the decompiled source of functions. */
280var funcToString = funcProto.toString;
281
282/** Used to check objects for own properties. */
283var hasOwnProperty = objectProto.hasOwnProperty;
284
285/**
286 * Used to resolve the
287 * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
288 * of values.
289 */
290var objectToString = objectProto.toString;
291
292/** Used to detect if a method is native. */
293var reIsNative = RegExp('^' +
294 funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&')
295 .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
296);
297
298/** Built-in value references. */
299var Symbol = root.Symbol,
300 Uint8Array = root.Uint8Array,
301 propertyIsEnumerable = objectProto.propertyIsEnumerable,
302 splice = arrayProto.splice;
303
304/* Built-in method references for those with the same name as other `lodash` methods. */
305var nativeKeys = overArg(Object.keys, Object);
306
307/* Built-in method references that are verified to be native. */
308var DataView = getNative(root, 'DataView'),
309 Map = getNative(root, 'Map'),
310 Promise = getNative(root, 'Promise'),
311 Set = getNative(root, 'Set'),
312 WeakMap = getNative(root, 'WeakMap'),
313 nativeCreate = getNative(Object, 'create');
314
315/** Used to detect maps, sets, and weakmaps. */
316var dataViewCtorString = toSource(DataView),
317 mapCtorString = toSource(Map),
318 promiseCtorString = toSource(Promise),
319 setCtorString = toSource(Set),
320 weakMapCtorString = toSource(WeakMap);
321
322/** Used to convert symbols to primitives and strings. */
323var symbolProto = Symbol ? Symbol.prototype : undefined,
324 symbolValueOf = symbolProto ? symbolProto.valueOf : undefined;
325
326/**
327 * Creates a hash object.
328 *
329 * @private
330 * @constructor
331 * @param {Array} [entries] The key-value pairs to cache.
332 */
333function Hash(entries) {
334 var index = -1,
335 length = entries ? entries.length : 0;
336
337 this.clear();
338 while (++index < length) {
339 var entry = entries[index];
340 this.set(entry[0], entry[1]);
341 }
342}
343
344/**
345 * Removes all key-value entries from the hash.
346 *
347 * @private
348 * @name clear
349 * @memberOf Hash
350 */
351function hashClear() {
352 this.__data__ = nativeCreate ? nativeCreate(null) : {};
353}
354
355/**
356 * Removes `key` and its value from the hash.
357 *
358 * @private
359 * @name delete
360 * @memberOf Hash
361 * @param {Object} hash The hash to modify.
362 * @param {string} key The key of the value to remove.
363 * @returns {boolean} Returns `true` if the entry was removed, else `false`.
364 */
365function hashDelete(key) {
366 return this.has(key) && delete this.__data__[key];
367}
368
369/**
370 * Gets the hash value for `key`.
371 *
372 * @private
373 * @name get
374 * @memberOf Hash
375 * @param {string} key The key of the value to get.
376 * @returns {*} Returns the entry value.
377 */
378function hashGet(key) {
379 var data = this.__data__;
380 if (nativeCreate) {
381 var result = data[key];
382 return result === HASH_UNDEFINED ? undefined : result;
383 }
384 return hasOwnProperty.call(data, key) ? data[key] : undefined;
385}
386
387/**
388 * Checks if a hash value for `key` exists.
389 *
390 * @private
391 * @name has
392 * @memberOf Hash
393 * @param {string} key The key of the entry to check.
394 * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
395 */
396function hashHas(key) {
397 var data = this.__data__;
398 return nativeCreate ? data[key] !== undefined : hasOwnProperty.call(data, key);
399}
400
401/**
402 * Sets the hash `key` to `value`.
403 *
404 * @private
405 * @name set
406 * @memberOf Hash
407 * @param {string} key The key of the value to set.
408 * @param {*} value The value to set.
409 * @returns {Object} Returns the hash instance.
410 */
411function hashSet(key, value) {
412 var data = this.__data__;
413 data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;
414 return this;
415}
416
417// Add methods to `Hash`.
418Hash.prototype.clear = hashClear;
419Hash.prototype['delete'] = hashDelete;
420Hash.prototype.get = hashGet;
421Hash.prototype.has = hashHas;
422Hash.prototype.set = hashSet;
423
424/**
425 * Creates an list cache object.
426 *
427 * @private
428 * @constructor
429 * @param {Array} [entries] The key-value pairs to cache.
430 */
431function ListCache(entries) {
432 var index = -1,
433 length = entries ? entries.length : 0;
434
435 this.clear();
436 while (++index < length) {
437 var entry = entries[index];
438 this.set(entry[0], entry[1]);
439 }
440}
441
442/**
443 * Removes all key-value entries from the list cache.
444 *
445 * @private
446 * @name clear
447 * @memberOf ListCache
448 */
449function listCacheClear() {
450 this.__data__ = [];
451}
452
453/**
454 * Removes `key` and its value from the list cache.
455 *
456 * @private
457 * @name delete
458 * @memberOf ListCache
459 * @param {string} key The key of the value to remove.
460 * @returns {boolean} Returns `true` if the entry was removed, else `false`.
461 */
462function listCacheDelete(key) {
463 var data = this.__data__,
464 index = assocIndexOf(data, key);
465
466 if (index < 0) {
467 return false;
468 }
469 var lastIndex = data.length - 1;
470 if (index == lastIndex) {
471 data.pop();
472 } else {
473 splice.call(data, index, 1);
474 }
475 return true;
476}
477
478/**
479 * Gets the list cache value for `key`.
480 *
481 * @private
482 * @name get
483 * @memberOf ListCache
484 * @param {string} key The key of the value to get.
485 * @returns {*} Returns the entry value.
486 */
487function listCacheGet(key) {
488 var data = this.__data__,
489 index = assocIndexOf(data, key);
490
491 return index < 0 ? undefined : data[index][1];
492}
493
494/**
495 * Checks if a list cache value for `key` exists.
496 *
497 * @private
498 * @name has
499 * @memberOf ListCache
500 * @param {string} key The key of the entry to check.
501 * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
502 */
503function listCacheHas(key) {
504 return assocIndexOf(this.__data__, key) > -1;
505}
506
507/**
508 * Sets the list cache `key` to `value`.
509 *
510 * @private
511 * @name set
512 * @memberOf ListCache
513 * @param {string} key The key of the value to set.
514 * @param {*} value The value to set.
515 * @returns {Object} Returns the list cache instance.
516 */
517function listCacheSet(key, value) {
518 var data = this.__data__,
519 index = assocIndexOf(data, key);
520
521 if (index < 0) {
522 data.push([key, value]);
523 } else {
524 data[index][1] = value;
525 }
526 return this;
527}
528
529// Add methods to `ListCache`.
530ListCache.prototype.clear = listCacheClear;
531ListCache.prototype['delete'] = listCacheDelete;
532ListCache.prototype.get = listCacheGet;
533ListCache.prototype.has = listCacheHas;
534ListCache.prototype.set = listCacheSet;
535
536/**
537 * Creates a map cache object to store key-value pairs.
538 *
539 * @private
540 * @constructor
541 * @param {Array} [entries] The key-value pairs to cache.
542 */
543function MapCache(entries) {
544 var index = -1,
545 length = entries ? entries.length : 0;
546
547 this.clear();
548 while (++index < length) {
549 var entry = entries[index];
550 this.set(entry[0], entry[1]);
551 }
552}
553
554/**
555 * Removes all key-value entries from the map.
556 *
557 * @private
558 * @name clear
559 * @memberOf MapCache
560 */
561function mapCacheClear() {
562 this.__data__ = {
563 'hash': new Hash,
564 'map': new (Map || ListCache),
565 'string': new Hash
566 };
567}
568
569/**
570 * Removes `key` and its value from the map.
571 *
572 * @private
573 * @name delete
574 * @memberOf MapCache
575 * @param {string} key The key of the value to remove.
576 * @returns {boolean} Returns `true` if the entry was removed, else `false`.
577 */
578function mapCacheDelete(key) {
579 return getMapData(this, key)['delete'](key);
580}
581
582/**
583 * Gets the map value for `key`.
584 *
585 * @private
586 * @name get
587 * @memberOf MapCache
588 * @param {string} key The key of the value to get.
589 * @returns {*} Returns the entry value.
590 */
591function mapCacheGet(key) {
592 return getMapData(this, key).get(key);
593}
594
595/**
596 * Checks if a map value for `key` exists.
597 *
598 * @private
599 * @name has
600 * @memberOf MapCache
601 * @param {string} key The key of the entry to check.
602 * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
603 */
604function mapCacheHas(key) {
605 return getMapData(this, key).has(key);
606}
607
608/**
609 * Sets the map `key` to `value`.
610 *
611 * @private
612 * @name set
613 * @memberOf MapCache
614 * @param {string} key The key of the value to set.
615 * @param {*} value The value to set.
616 * @returns {Object} Returns the map cache instance.
617 */
618function mapCacheSet(key, value) {
619 getMapData(this, key).set(key, value);
620 return this;
621}
622
623// Add methods to `MapCache`.
624MapCache.prototype.clear = mapCacheClear;
625MapCache.prototype['delete'] = mapCacheDelete;
626MapCache.prototype.get = mapCacheGet;
627MapCache.prototype.has = mapCacheHas;
628MapCache.prototype.set = mapCacheSet;
629
630/**
631 *
632 * Creates an array cache object to store unique values.
633 *
634 * @private
635 * @constructor
636 * @param {Array} [values] The values to cache.
637 */
638function SetCache(values) {
639 var index = -1,
640 length = values ? values.length : 0;
641
642 this.__data__ = new MapCache;
643 while (++index < length) {
644 this.add(values[index]);
645 }
646}
647
648/**
649 * Adds `value` to the array cache.
650 *
651 * @private
652 * @name add
653 * @memberOf SetCache
654 * @alias push
655 * @param {*} value The value to cache.
656 * @returns {Object} Returns the cache instance.
657 */
658function setCacheAdd(value) {
659 this.__data__.set(value, HASH_UNDEFINED);
660 return this;
661}
662
663/**
664 * Checks if `value` is in the array cache.
665 *
666 * @private
667 * @name has
668 * @memberOf SetCache
669 * @param {*} value The value to search for.
670 * @returns {number} Returns `true` if `value` is found, else `false`.
671 */
672function setCacheHas(value) {
673 return this.__data__.has(value);
674}
675
676// Add methods to `SetCache`.
677SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
678SetCache.prototype.has = setCacheHas;
679
680/**
681 * Creates a stack cache object to store key-value pairs.
682 *
683 * @private
684 * @constructor
685 * @param {Array} [entries] The key-value pairs to cache.
686 */
687function Stack(entries) {
688 this.__data__ = new ListCache(entries);
689}
690
691/**
692 * Removes all key-value entries from the stack.
693 *
694 * @private
695 * @name clear
696 * @memberOf Stack
697 */
698function stackClear() {
699 this.__data__ = new ListCache;
700}
701
702/**
703 * Removes `key` and its value from the stack.
704 *
705 * @private
706 * @name delete
707 * @memberOf Stack
708 * @param {string} key The key of the value to remove.
709 * @returns {boolean} Returns `true` if the entry was removed, else `false`.
710 */
711function stackDelete(key) {
712 return this.__data__['delete'](key);
713}
714
715/**
716 * Gets the stack value for `key`.
717 *
718 * @private
719 * @name get
720 * @memberOf Stack
721 * @param {string} key The key of the value to get.
722 * @returns {*} Returns the entry value.
723 */
724function stackGet(key) {
725 return this.__data__.get(key);
726}
727
728/**
729 * Checks if a stack value for `key` exists.
730 *
731 * @private
732 * @name has
733 * @memberOf Stack
734 * @param {string} key The key of the entry to check.
735 * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
736 */
737function stackHas(key) {
738 return this.__data__.has(key);
739}
740
741/**
742 * Sets the stack `key` to `value`.
743 *
744 * @private
745 * @name set
746 * @memberOf Stack
747 * @param {string} key The key of the value to set.
748 * @param {*} value The value to set.
749 * @returns {Object} Returns the stack cache instance.
750 */
751function stackSet(key, value) {
752 var cache = this.__data__;
753 if (cache instanceof ListCache) {
754 var pairs = cache.__data__;
755 if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {
756 pairs.push([key, value]);
757 return this;
758 }
759 cache = this.__data__ = new MapCache(pairs);
760 }
761 cache.set(key, value);
762 return this;
763}
764
765// Add methods to `Stack`.
766Stack.prototype.clear = stackClear;
767Stack.prototype['delete'] = stackDelete;
768Stack.prototype.get = stackGet;
769Stack.prototype.has = stackHas;
770Stack.prototype.set = stackSet;
771
772/**
773 * Creates an array of the enumerable property names of the array-like `value`.
774 *
775 * @private
776 * @param {*} value The value to query.
777 * @param {boolean} inherited Specify returning inherited property names.
778 * @returns {Array} Returns the array of property names.
779 */
780function arrayLikeKeys(value, inherited) {
781 // Safari 8.1 makes `arguments.callee` enumerable in strict mode.
782 // Safari 9 makes `arguments.length` enumerable in strict mode.
783 var result = (isArray(value) || isArguments(value))
784 ? baseTimes(value.length, String)
785 : [];
786
787 var length = result.length,
788 skipIndexes = !!length;
789
790 for (var key in value) {
791 if ((inherited || hasOwnProperty.call(value, key)) &&
792 !(skipIndexes && (key == 'length' || isIndex(key, length)))) {
793 result.push(key);
794 }
795 }
796 return result;
797}
798
799/**
800 * Gets the index at which the `key` is found in `array` of key-value pairs.
801 *
802 * @private
803 * @param {Array} array The array to inspect.
804 * @param {*} key The key to search for.
805 * @returns {number} Returns the index of the matched value, else `-1`.
806 */
807function assocIndexOf(array, key) {
808 var length = array.length;
809 while (length--) {
810 if (eq(array[length][0], key)) {
811 return length;
812 }
813 }
814 return -1;
815}
816
817/**
818 * The base implementation of `getTag`.
819 *
820 * @private
821 * @param {*} value The value to query.
822 * @returns {string} Returns the `toStringTag`.
823 */
824function baseGetTag(value) {
825 return objectToString.call(value);
826}
827
828/**
829 * The base implementation of `_.isEqual` which supports partial comparisons
830 * and tracks traversed objects.
831 *
832 * @private
833 * @param {*} value The value to compare.
834 * @param {*} other The other value to compare.
835 * @param {Function} [customizer] The function to customize comparisons.
836 * @param {boolean} [bitmask] The bitmask of comparison flags.
837 * The bitmask may be composed of the following flags:
838 * 1 - Unordered comparison
839 * 2 - Partial comparison
840 * @param {Object} [stack] Tracks traversed `value` and `other` objects.
841 * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
842 */
843function baseIsEqual(value, other, customizer, bitmask, stack) {
844 if (value === other) {
845 return true;
846 }
847 if (value == null || other == null || (!isObject(value) && !isObjectLike(other))) {
848 return value !== value && other !== other;
849 }
850 return baseIsEqualDeep(value, other, baseIsEqual, customizer, bitmask, stack);
851}
852
853/**
854 * A specialized version of `baseIsEqual` for arrays and objects which performs
855 * deep comparisons and tracks traversed objects enabling objects with circular
856 * references to be compared.
857 *
858 * @private
859 * @param {Object} object The object to compare.
860 * @param {Object} other The other object to compare.
861 * @param {Function} equalFunc The function to determine equivalents of values.
862 * @param {Function} [customizer] The function to customize comparisons.
863 * @param {number} [bitmask] The bitmask of comparison flags. See `baseIsEqual`
864 * for more details.
865 * @param {Object} [stack] Tracks traversed `object` and `other` objects.
866 * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
867 */
868function baseIsEqualDeep(object, other, equalFunc, customizer, bitmask, stack) {
869 var objIsArr = isArray(object),
870 othIsArr = isArray(other),
871 objTag = arrayTag,
872 othTag = arrayTag;
873
874 if (!objIsArr) {
875 objTag = getTag(object);
876 objTag = objTag == argsTag ? objectTag : objTag;
877 }
878 if (!othIsArr) {
879 othTag = getTag(other);
880 othTag = othTag == argsTag ? objectTag : othTag;
881 }
882 var objIsObj = objTag == objectTag && !isHostObject(object),
883 othIsObj = othTag == objectTag && !isHostObject(other),
884 isSameTag = objTag == othTag;
885
886 if (isSameTag && !objIsObj) {
887 stack || (stack = new Stack);
888 return (objIsArr || isTypedArray(object))
889 ? equalArrays(object, other, equalFunc, customizer, bitmask, stack)
890 : equalByTag(object, other, objTag, equalFunc, customizer, bitmask, stack);
891 }
892 if (!(bitmask & PARTIAL_COMPARE_FLAG)) {
893 var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),
894 othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');
895
896 if (objIsWrapped || othIsWrapped) {
897 var objUnwrapped = objIsWrapped ? object.value() : object,
898 othUnwrapped = othIsWrapped ? other.value() : other;
899
900 stack || (stack = new Stack);
901 return equalFunc(objUnwrapped, othUnwrapped, customizer, bitmask, stack);
902 }
903 }
904 if (!isSameTag) {
905 return false;
906 }
907 stack || (stack = new Stack);
908 return equalObjects(object, other, equalFunc, customizer, bitmask, stack);
909}
910
911/**
912 * The base implementation of `_.isNative` without bad shim checks.
913 *
914 * @private
915 * @param {*} value The value to check.
916 * @returns {boolean} Returns `true` if `value` is a native function,
917 * else `false`.
918 */
919function baseIsNative(value) {
920 if (!isObject(value) || isMasked(value)) {
921 return false;
922 }
923 var pattern = (isFunction(value) || isHostObject(value)) ? reIsNative : reIsHostCtor;
924 return pattern.test(toSource(value));
925}
926
927/**
928 * The base implementation of `_.isTypedArray` without Node.js optimizations.
929 *
930 * @private
931 * @param {*} value The value to check.
932 * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
933 */
934function baseIsTypedArray(value) {
935 return isObjectLike(value) &&
936 isLength(value.length) && !!typedArrayTags[objectToString.call(value)];
937}
938
939/**
940 * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
941 *
942 * @private
943 * @param {Object} object The object to query.
944 * @returns {Array} Returns the array of property names.
945 */
946function baseKeys(object) {
947 if (!isPrototype(object)) {
948 return nativeKeys(object);
949 }
950 var result = [];
951 for (var key in Object(object)) {
952 if (hasOwnProperty.call(object, key) && key != 'constructor') {
953 result.push(key);
954 }
955 }
956 return result;
957}
958
959/**
960 * A specialized version of `baseIsEqualDeep` for arrays with support for
961 * partial deep comparisons.
962 *
963 * @private
964 * @param {Array} array The array to compare.
965 * @param {Array} other The other array to compare.
966 * @param {Function} equalFunc The function to determine equivalents of values.
967 * @param {Function} customizer The function to customize comparisons.
968 * @param {number} bitmask The bitmask of comparison flags. See `baseIsEqual`
969 * for more details.
970 * @param {Object} stack Tracks traversed `array` and `other` objects.
971 * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
972 */
973function equalArrays(array, other, equalFunc, customizer, bitmask, stack) {
974 var isPartial = bitmask & PARTIAL_COMPARE_FLAG,
975 arrLength = array.length,
976 othLength = other.length;
977
978 if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
979 return false;
980 }
981 // Assume cyclic values are equal.
982 var stacked = stack.get(array);
983 if (stacked && stack.get(other)) {
984 return stacked == other;
985 }
986 var index = -1,
987 result = true,
988 seen = (bitmask & UNORDERED_COMPARE_FLAG) ? new SetCache : undefined;
989
990 stack.set(array, other);
991 stack.set(other, array);
992
993 // Ignore non-index properties.
994 while (++index < arrLength) {
995 var arrValue = array[index],
996 othValue = other[index];
997
998 if (customizer) {
999 var compared = isPartial
1000 ? customizer(othValue, arrValue, index, other, array, stack)
1001 : customizer(arrValue, othValue, index, array, other, stack);
1002 }
1003 if (compared !== undefined) {
1004 if (compared) {
1005 continue;
1006 }
1007 result = false;
1008 break;
1009 }
1010 // Recursively compare arrays (susceptible to call stack limits).
1011 if (seen) {
1012 if (!arraySome(other, function(othValue, othIndex) {
1013 if (!seen.has(othIndex) &&
1014 (arrValue === othValue || equalFunc(arrValue, othValue, customizer, bitmask, stack))) {
1015 return seen.add(othIndex);
1016 }
1017 })) {
1018 result = false;
1019 break;
1020 }
1021 } else if (!(
1022 arrValue === othValue ||
1023 equalFunc(arrValue, othValue, customizer, bitmask, stack)
1024 )) {
1025 result = false;
1026 break;
1027 }
1028 }
1029 stack['delete'](array);
1030 stack['delete'](other);
1031 return result;
1032}
1033
1034/**
1035 * A specialized version of `baseIsEqualDeep` for comparing objects of
1036 * the same `toStringTag`.
1037 *
1038 * **Note:** This function only supports comparing values with tags of
1039 * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
1040 *
1041 * @private
1042 * @param {Object} object The object to compare.
1043 * @param {Object} other The other object to compare.
1044 * @param {string} tag The `toStringTag` of the objects to compare.
1045 * @param {Function} equalFunc The function to determine equivalents of values.
1046 * @param {Function} customizer The function to customize comparisons.
1047 * @param {number} bitmask The bitmask of comparison flags. See `baseIsEqual`
1048 * for more details.
1049 * @param {Object} stack Tracks traversed `object` and `other` objects.
1050 * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
1051 */
1052function equalByTag(object, other, tag, equalFunc, customizer, bitmask, stack) {
1053 switch (tag) {
1054 case dataViewTag:
1055 if ((object.byteLength != other.byteLength) ||
1056 (object.byteOffset != other.byteOffset)) {
1057 return false;
1058 }
1059 object = object.buffer;
1060 other = other.buffer;
1061
1062 case arrayBufferTag:
1063 if ((object.byteLength != other.byteLength) ||
1064 !equalFunc(new Uint8Array(object), new Uint8Array(other))) {
1065 return false;
1066 }
1067 return true;
1068
1069 case boolTag:
1070 case dateTag:
1071 case numberTag:
1072 // Coerce booleans to `1` or `0` and dates to milliseconds.
1073 // Invalid dates are coerced to `NaN`.
1074 return eq(+object, +other);
1075
1076 case errorTag:
1077 return object.name == other.name && object.message == other.message;
1078
1079 case regexpTag:
1080 case stringTag:
1081 // Coerce regexes to strings and treat strings, primitives and objects,
1082 // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring
1083 // for more details.
1084 return object == (other + '');
1085
1086 case mapTag:
1087 var convert = mapToArray;
1088
1089 case setTag:
1090 var isPartial = bitmask & PARTIAL_COMPARE_FLAG;
1091 convert || (convert = setToArray);
1092
1093 if (object.size != other.size && !isPartial) {
1094 return false;
1095 }
1096 // Assume cyclic values are equal.
1097 var stacked = stack.get(object);
1098 if (stacked) {
1099 return stacked == other;
1100 }
1101 bitmask |= UNORDERED_COMPARE_FLAG;
1102
1103 // Recursively compare objects (susceptible to call stack limits).
1104 stack.set(object, other);
1105 var result = equalArrays(convert(object), convert(other), equalFunc, customizer, bitmask, stack);
1106 stack['delete'](object);
1107 return result;
1108
1109 case symbolTag:
1110 if (symbolValueOf) {
1111 return symbolValueOf.call(object) == symbolValueOf.call(other);
1112 }
1113 }
1114 return false;
1115}
1116
1117/**
1118 * A specialized version of `baseIsEqualDeep` for objects with support for
1119 * partial deep comparisons.
1120 *
1121 * @private
1122 * @param {Object} object The object to compare.
1123 * @param {Object} other The other object to compare.
1124 * @param {Function} equalFunc The function to determine equivalents of values.
1125 * @param {Function} customizer The function to customize comparisons.
1126 * @param {number} bitmask The bitmask of comparison flags. See `baseIsEqual`
1127 * for more details.
1128 * @param {Object} stack Tracks traversed `object` and `other` objects.
1129 * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
1130 */
1131function equalObjects(object, other, equalFunc, customizer, bitmask, stack) {
1132 var isPartial = bitmask & PARTIAL_COMPARE_FLAG,
1133 objProps = keys(object),
1134 objLength = objProps.length,
1135 othProps = keys(other),
1136 othLength = othProps.length;
1137
1138 if (objLength != othLength && !isPartial) {
1139 return false;
1140 }
1141 var index = objLength;
1142 while (index--) {
1143 var key = objProps[index];
1144 if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) {
1145 return false;
1146 }
1147 }
1148 // Assume cyclic values are equal.
1149 var stacked = stack.get(object);
1150 if (stacked && stack.get(other)) {
1151 return stacked == other;
1152 }
1153 var result = true;
1154 stack.set(object, other);
1155 stack.set(other, object);
1156
1157 var skipCtor = isPartial;
1158 while (++index < objLength) {
1159 key = objProps[index];
1160 var objValue = object[key],
1161 othValue = other[key];
1162
1163 if (customizer) {
1164 var compared = isPartial
1165 ? customizer(othValue, objValue, key, other, object, stack)
1166 : customizer(objValue, othValue, key, object, other, stack);
1167 }
1168 // Recursively compare objects (susceptible to call stack limits).
1169 if (!(compared === undefined
1170 ? (objValue === othValue || equalFunc(objValue, othValue, customizer, bitmask, stack))
1171 : compared
1172 )) {
1173 result = false;
1174 break;
1175 }
1176 skipCtor || (skipCtor = key == 'constructor');
1177 }
1178 if (result && !skipCtor) {
1179 var objCtor = object.constructor,
1180 othCtor = other.constructor;
1181
1182 // Non `Object` object instances with different constructors are not equal.
1183 if (objCtor != othCtor &&
1184 ('constructor' in object && 'constructor' in other) &&
1185 !(typeof objCtor == 'function' && objCtor instanceof objCtor &&
1186 typeof othCtor == 'function' && othCtor instanceof othCtor)) {
1187 result = false;
1188 }
1189 }
1190 stack['delete'](object);
1191 stack['delete'](other);
1192 return result;
1193}
1194
1195/**
1196 * Gets the data for `map`.
1197 *
1198 * @private
1199 * @param {Object} map The map to query.
1200 * @param {string} key The reference key.
1201 * @returns {*} Returns the map data.
1202 */
1203function getMapData(map, key) {
1204 var data = map.__data__;
1205 return isKeyable(key)
1206 ? data[typeof key == 'string' ? 'string' : 'hash']
1207 : data.map;
1208}
1209
1210/**
1211 * Gets the native function at `key` of `object`.
1212 *
1213 * @private
1214 * @param {Object} object The object to query.
1215 * @param {string} key The key of the method to get.
1216 * @returns {*} Returns the function if it's native, else `undefined`.
1217 */
1218function getNative(object, key) {
1219 var value = getValue(object, key);
1220 return baseIsNative(value) ? value : undefined;
1221}
1222
1223/**
1224 * Gets the `toStringTag` of `value`.
1225 *
1226 * @private
1227 * @param {*} value The value to query.
1228 * @returns {string} Returns the `toStringTag`.
1229 */
1230var getTag = baseGetTag;
1231
1232// Fallback for data views, maps, sets, and weak maps in IE 11,
1233// for data views in Edge < 14, and promises in Node.js.
1234if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||
1235 (Map && getTag(new Map) != mapTag) ||
1236 (Promise && getTag(Promise.resolve()) != promiseTag) ||
1237 (Set && getTag(new Set) != setTag) ||
1238 (WeakMap && getTag(new WeakMap) != weakMapTag)) {
1239 getTag = function(value) {
1240 var result = objectToString.call(value),
1241 Ctor = result == objectTag ? value.constructor : undefined,
1242 ctorString = Ctor ? toSource(Ctor) : undefined;
1243
1244 if (ctorString) {
1245 switch (ctorString) {
1246 case dataViewCtorString: return dataViewTag;
1247 case mapCtorString: return mapTag;
1248 case promiseCtorString: return promiseTag;
1249 case setCtorString: return setTag;
1250 case weakMapCtorString: return weakMapTag;
1251 }
1252 }
1253 return result;
1254 };
1255}
1256
1257/**
1258 * Checks if `value` is a valid array-like index.
1259 *
1260 * @private
1261 * @param {*} value The value to check.
1262 * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
1263 * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
1264 */
1265function isIndex(value, length) {
1266 length = length == null ? MAX_SAFE_INTEGER : length;
1267 return !!length &&
1268 (typeof value == 'number' || reIsUint.test(value)) &&
1269 (value > -1 && value % 1 == 0 && value < length);
1270}
1271
1272/**
1273 * Checks if `value` is suitable for use as unique object key.
1274 *
1275 * @private
1276 * @param {*} value The value to check.
1277 * @returns {boolean} Returns `true` if `value` is suitable, else `false`.
1278 */
1279function isKeyable(value) {
1280 var type = typeof value;
1281 return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
1282 ? (value !== '__proto__')
1283 : (value === null);
1284}
1285
1286/**
1287 * Checks if `func` has its source masked.
1288 *
1289 * @private
1290 * @param {Function} func The function to check.
1291 * @returns {boolean} Returns `true` if `func` is masked, else `false`.
1292 */
1293function isMasked(func) {
1294 return !!maskSrcKey && (maskSrcKey in func);
1295}
1296
1297/**
1298 * Checks if `value` is likely a prototype object.
1299 *
1300 * @private
1301 * @param {*} value The value to check.
1302 * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
1303 */
1304function isPrototype(value) {
1305 var Ctor = value && value.constructor,
1306 proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;
1307
1308 return value === proto;
1309}
1310
1311/**
1312 * Converts `func` to its source code.
1313 *
1314 * @private
1315 * @param {Function} func The function to process.
1316 * @returns {string} Returns the source code.
1317 */
1318function toSource(func) {
1319 if (func != null) {
1320 try {
1321 return funcToString.call(func);
1322 } catch (e) {}
1323 try {
1324 return (func + '');
1325 } catch (e) {}
1326 }
1327 return '';
1328}
1329
1330/**
1331 * Performs a
1332 * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
1333 * comparison between two values to determine if they are equivalent.
1334 *
1335 * @static
1336 * @memberOf _
1337 * @since 4.0.0
1338 * @category Lang
1339 * @param {*} value The value to compare.
1340 * @param {*} other The other value to compare.
1341 * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
1342 * @example
1343 *
1344 * var object = { 'a': 1 };
1345 * var other = { 'a': 1 };
1346 *
1347 * _.eq(object, object);
1348 * // => true
1349 *
1350 * _.eq(object, other);
1351 * // => false
1352 *
1353 * _.eq('a', 'a');
1354 * // => true
1355 *
1356 * _.eq('a', Object('a'));
1357 * // => false
1358 *
1359 * _.eq(NaN, NaN);
1360 * // => true
1361 */
1362function eq(value, other) {
1363 return value === other || (value !== value && other !== other);
1364}
1365
1366/**
1367 * Checks if `value` is likely an `arguments` object.
1368 *
1369 * @static
1370 * @memberOf _
1371 * @since 0.1.0
1372 * @category Lang
1373 * @param {*} value The value to check.
1374 * @returns {boolean} Returns `true` if `value` is an `arguments` object,
1375 * else `false`.
1376 * @example
1377 *
1378 * _.isArguments(function() { return arguments; }());
1379 * // => true
1380 *
1381 * _.isArguments([1, 2, 3]);
1382 * // => false
1383 */
1384function isArguments(value) {
1385 // Safari 8.1 makes `arguments.callee` enumerable in strict mode.
1386 return isArrayLikeObject(value) && hasOwnProperty.call(value, 'callee') &&
1387 (!propertyIsEnumerable.call(value, 'callee') || objectToString.call(value) == argsTag);
1388}
1389
1390/**
1391 * Checks if `value` is classified as an `Array` object.
1392 *
1393 * @static
1394 * @memberOf _
1395 * @since 0.1.0
1396 * @category Lang
1397 * @param {*} value The value to check.
1398 * @returns {boolean} Returns `true` if `value` is an array, else `false`.
1399 * @example
1400 *
1401 * _.isArray([1, 2, 3]);
1402 * // => true
1403 *
1404 * _.isArray(document.body.children);
1405 * // => false
1406 *
1407 * _.isArray('abc');
1408 * // => false
1409 *
1410 * _.isArray(_.noop);
1411 * // => false
1412 */
1413var isArray = Array.isArray;
1414
1415/**
1416 * Checks if `value` is array-like. A value is considered array-like if it's
1417 * not a function and has a `value.length` that's an integer greater than or
1418 * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
1419 *
1420 * @static
1421 * @memberOf _
1422 * @since 4.0.0
1423 * @category Lang
1424 * @param {*} value The value to check.
1425 * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
1426 * @example
1427 *
1428 * _.isArrayLike([1, 2, 3]);
1429 * // => true
1430 *
1431 * _.isArrayLike(document.body.children);
1432 * // => true
1433 *
1434 * _.isArrayLike('abc');
1435 * // => true
1436 *
1437 * _.isArrayLike(_.noop);
1438 * // => false
1439 */
1440function isArrayLike(value) {
1441 return value != null && isLength(value.length) && !isFunction(value);
1442}
1443
1444/**
1445 * This method is like `_.isArrayLike` except that it also checks if `value`
1446 * is an object.
1447 *
1448 * @static
1449 * @memberOf _
1450 * @since 4.0.0
1451 * @category Lang
1452 * @param {*} value The value to check.
1453 * @returns {boolean} Returns `true` if `value` is an array-like object,
1454 * else `false`.
1455 * @example
1456 *
1457 * _.isArrayLikeObject([1, 2, 3]);
1458 * // => true
1459 *
1460 * _.isArrayLikeObject(document.body.children);
1461 * // => true
1462 *
1463 * _.isArrayLikeObject('abc');
1464 * // => false
1465 *
1466 * _.isArrayLikeObject(_.noop);
1467 * // => false
1468 */
1469function isArrayLikeObject(value) {
1470 return isObjectLike(value) && isArrayLike(value);
1471}
1472
1473/**
1474 * Performs a deep comparison between two values to determine if they are
1475 * equivalent.
1476 *
1477 * **Note:** This method supports comparing arrays, array buffers, booleans,
1478 * date objects, error objects, maps, numbers, `Object` objects, regexes,
1479 * sets, strings, symbols, and typed arrays. `Object` objects are compared
1480 * by their own, not inherited, enumerable properties. Functions and DOM
1481 * nodes are **not** supported.
1482 *
1483 * @static
1484 * @memberOf _
1485 * @since 0.1.0
1486 * @category Lang
1487 * @param {*} value The value to compare.
1488 * @param {*} other The other value to compare.
1489 * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
1490 * @example
1491 *
1492 * var object = { 'a': 1 };
1493 * var other = { 'a': 1 };
1494 *
1495 * _.isEqual(object, other);
1496 * // => true
1497 *
1498 * object === other;
1499 * // => false
1500 */
1501function isEqual(value, other) {
1502 return baseIsEqual(value, other);
1503}
1504
1505/**
1506 * Checks if `value` is classified as a `Function` object.
1507 *
1508 * @static
1509 * @memberOf _
1510 * @since 0.1.0
1511 * @category Lang
1512 * @param {*} value The value to check.
1513 * @returns {boolean} Returns `true` if `value` is a function, else `false`.
1514 * @example
1515 *
1516 * _.isFunction(_);
1517 * // => true
1518 *
1519 * _.isFunction(/abc/);
1520 * // => false
1521 */
1522function isFunction(value) {
1523 // The use of `Object#toString` avoids issues with the `typeof` operator
1524 // in Safari 8-9 which returns 'object' for typed array and other constructors.
1525 var tag = isObject(value) ? objectToString.call(value) : '';
1526 return tag == funcTag || tag == genTag;
1527}
1528
1529/**
1530 * Checks if `value` is a valid array-like length.
1531 *
1532 * **Note:** This method is loosely based on
1533 * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
1534 *
1535 * @static
1536 * @memberOf _
1537 * @since 4.0.0
1538 * @category Lang
1539 * @param {*} value The value to check.
1540 * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
1541 * @example
1542 *
1543 * _.isLength(3);
1544 * // => true
1545 *
1546 * _.isLength(Number.MIN_VALUE);
1547 * // => false
1548 *
1549 * _.isLength(Infinity);
1550 * // => false
1551 *
1552 * _.isLength('3');
1553 * // => false
1554 */
1555function isLength(value) {
1556 return typeof value == 'number' &&
1557 value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
1558}
1559
1560/**
1561 * Checks if `value` is the
1562 * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
1563 * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
1564 *
1565 * @static
1566 * @memberOf _
1567 * @since 0.1.0
1568 * @category Lang
1569 * @param {*} value The value to check.
1570 * @returns {boolean} Returns `true` if `value` is an object, else `false`.
1571 * @example
1572 *
1573 * _.isObject({});
1574 * // => true
1575 *
1576 * _.isObject([1, 2, 3]);
1577 * // => true
1578 *
1579 * _.isObject(_.noop);
1580 * // => true
1581 *
1582 * _.isObject(null);
1583 * // => false
1584 */
1585function isObject(value) {
1586 var type = typeof value;
1587 return !!value && (type == 'object' || type == 'function');
1588}
1589
1590/**
1591 * Checks if `value` is object-like. A value is object-like if it's not `null`
1592 * and has a `typeof` result of "object".
1593 *
1594 * @static
1595 * @memberOf _
1596 * @since 4.0.0
1597 * @category Lang
1598 * @param {*} value The value to check.
1599 * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
1600 * @example
1601 *
1602 * _.isObjectLike({});
1603 * // => true
1604 *
1605 * _.isObjectLike([1, 2, 3]);
1606 * // => true
1607 *
1608 * _.isObjectLike(_.noop);
1609 * // => false
1610 *
1611 * _.isObjectLike(null);
1612 * // => false
1613 */
1614function isObjectLike(value) {
1615 return !!value && typeof value == 'object';
1616}
1617
1618/**
1619 * Checks if `value` is classified as a typed array.
1620 *
1621 * @static
1622 * @memberOf _
1623 * @since 3.0.0
1624 * @category Lang
1625 * @param {*} value The value to check.
1626 * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
1627 * @example
1628 *
1629 * _.isTypedArray(new Uint8Array);
1630 * // => true
1631 *
1632 * _.isTypedArray([]);
1633 * // => false
1634 */
1635var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
1636
1637/**
1638 * Creates an array of the own enumerable property names of `object`.
1639 *
1640 * **Note:** Non-object values are coerced to objects. See the
1641 * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
1642 * for more details.
1643 *
1644 * @static
1645 * @since 0.1.0
1646 * @memberOf _
1647 * @category Object
1648 * @param {Object} object The object to query.
1649 * @returns {Array} Returns the array of property names.
1650 * @example
1651 *
1652 * function Foo() {
1653 * this.a = 1;
1654 * this.b = 2;
1655 * }
1656 *
1657 * Foo.prototype.c = 3;
1658 *
1659 * _.keys(new Foo);
1660 * // => ['a', 'b'] (iteration order is not guaranteed)
1661 *
1662 * _.keys('hi');
1663 * // => ['0', '1']
1664 */
1665function keys(object) {
1666 return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
1667}
1668
1669module.exports = isEqual;
1670
1671}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
1672},{}],4:[function(require,module,exports){
1673(function (global){
1674/**
1675 * lodash (Custom Build) <https://lodash.com/>
1676 * Build: `lodash modularize exports="npm" -o ./`
1677 * Copyright jQuery Foundation and other contributors <https://jquery.org/>
1678 * Released under MIT license <https://lodash.com/license>
1679 * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
1680 * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
1681 */
1682
1683/** Used as the size to enable large array optimizations. */
1684var LARGE_ARRAY_SIZE = 200;
1685
1686/** Used as the `TypeError` message for "Functions" methods. */
1687var FUNC_ERROR_TEXT = 'Expected a function';
1688
1689/** Used to stand-in for `undefined` hash values. */
1690var HASH_UNDEFINED = '__lodash_hash_undefined__';
1691
1692/** Used to compose bitmasks for comparison styles. */
1693var UNORDERED_COMPARE_FLAG = 1,
1694 PARTIAL_COMPARE_FLAG = 2;
1695
1696/** Used as references for various `Number` constants. */
1697var INFINITY = 1 / 0,
1698 MAX_SAFE_INTEGER = 9007199254740991;
1699
1700/** `Object#toString` result references. */
1701var argsTag = '[object Arguments]',
1702 arrayTag = '[object Array]',
1703 boolTag = '[object Boolean]',
1704 dateTag = '[object Date]',
1705 errorTag = '[object Error]',
1706 funcTag = '[object Function]',
1707 genTag = '[object GeneratorFunction]',
1708 mapTag = '[object Map]',
1709 numberTag = '[object Number]',
1710 objectTag = '[object Object]',
1711 promiseTag = '[object Promise]',
1712 regexpTag = '[object RegExp]',
1713 setTag = '[object Set]',
1714 stringTag = '[object String]',
1715 symbolTag = '[object Symbol]',
1716 weakMapTag = '[object WeakMap]';
1717
1718var arrayBufferTag = '[object ArrayBuffer]',
1719 dataViewTag = '[object DataView]',
1720 float32Tag = '[object Float32Array]',
1721 float64Tag = '[object Float64Array]',
1722 int8Tag = '[object Int8Array]',
1723 int16Tag = '[object Int16Array]',
1724 int32Tag = '[object Int32Array]',
1725 uint8Tag = '[object Uint8Array]',
1726 uint8ClampedTag = '[object Uint8ClampedArray]',
1727 uint16Tag = '[object Uint16Array]',
1728 uint32Tag = '[object Uint32Array]';
1729
1730/** Used to match property names within property paths. */
1731var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,
1732 reIsPlainProp = /^\w*$/,
1733 reLeadingDot = /^\./,
1734 rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
1735
1736/**
1737 * Used to match `RegExp`
1738 * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
1739 */
1740var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
1741
1742/** Used to match backslashes in property paths. */
1743var reEscapeChar = /\\(\\)?/g;
1744
1745/** Used to detect host constructors (Safari). */
1746var reIsHostCtor = /^\[object .+?Constructor\]$/;
1747
1748/** Used to detect unsigned integer values. */
1749var reIsUint = /^(?:0|[1-9]\d*)$/;
1750
1751/** Used to identify `toStringTag` values of typed arrays. */
1752var typedArrayTags = {};
1753typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
1754typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
1755typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
1756typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
1757typedArrayTags[uint32Tag] = true;
1758typedArrayTags[argsTag] = typedArrayTags[arrayTag] =
1759typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
1760typedArrayTags[dataViewTag] = typedArrayTags[dateTag] =
1761typedArrayTags[errorTag] = typedArrayTags[funcTag] =
1762typedArrayTags[mapTag] = typedArrayTags[numberTag] =
1763typedArrayTags[objectTag] = typedArrayTags[regexpTag] =
1764typedArrayTags[setTag] = typedArrayTags[stringTag] =
1765typedArrayTags[weakMapTag] = false;
1766
1767/** Detect free variable `global` from Node.js. */
1768var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
1769
1770/** Detect free variable `self`. */
1771var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
1772
1773/** Used as a reference to the global object. */
1774var root = freeGlobal || freeSelf || Function('return this')();
1775
1776/** Detect free variable `exports`. */
1777var freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;
1778
1779/** Detect free variable `module`. */
1780var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;
1781
1782/** Detect the popular CommonJS extension `module.exports`. */
1783var moduleExports = freeModule && freeModule.exports === freeExports;
1784
1785/** Detect free variable `process` from Node.js. */
1786var freeProcess = moduleExports && freeGlobal.process;
1787
1788/** Used to access faster Node.js helpers. */
1789var nodeUtil = (function() {
1790 try {
1791 return freeProcess && freeProcess.binding('util');
1792 } catch (e) {}
1793}());
1794
1795/* Node.js helper references. */
1796var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
1797
1798/**
1799 * A specialized version of `_.includes` for arrays without support for
1800 * specifying an index to search from.
1801 *
1802 * @private
1803 * @param {Array} [array] The array to inspect.
1804 * @param {*} target The value to search for.
1805 * @returns {boolean} Returns `true` if `target` is found, else `false`.
1806 */
1807function arrayIncludes(array, value) {
1808 var length = array ? array.length : 0;
1809 return !!length && baseIndexOf(array, value, 0) > -1;
1810}
1811
1812/**
1813 * This function is like `arrayIncludes` except that it accepts a comparator.
1814 *
1815 * @private
1816 * @param {Array} [array] The array to inspect.
1817 * @param {*} target The value to search for.
1818 * @param {Function} comparator The comparator invoked per element.
1819 * @returns {boolean} Returns `true` if `target` is found, else `false`.
1820 */
1821function arrayIncludesWith(array, value, comparator) {
1822 var index = -1,
1823 length = array ? array.length : 0;
1824
1825 while (++index < length) {
1826 if (comparator(value, array[index])) {
1827 return true;
1828 }
1829 }
1830 return false;
1831}
1832
1833/**
1834 * A specialized version of `_.some` for arrays without support for iteratee
1835 * shorthands.
1836 *
1837 * @private
1838 * @param {Array} [array] The array to iterate over.
1839 * @param {Function} predicate The function invoked per iteration.
1840 * @returns {boolean} Returns `true` if any element passes the predicate check,
1841 * else `false`.
1842 */
1843function arraySome(array, predicate) {
1844 var index = -1,
1845 length = array ? array.length : 0;
1846
1847 while (++index < length) {
1848 if (predicate(array[index], index, array)) {
1849 return true;
1850 }
1851 }
1852 return false;
1853}
1854
1855/**
1856 * The base implementation of `_.findIndex` and `_.findLastIndex` without
1857 * support for iteratee shorthands.
1858 *
1859 * @private
1860 * @param {Array} array The array to inspect.
1861 * @param {Function} predicate The function invoked per iteration.
1862 * @param {number} fromIndex The index to search from.
1863 * @param {boolean} [fromRight] Specify iterating from right to left.
1864 * @returns {number} Returns the index of the matched value, else `-1`.
1865 */
1866function baseFindIndex(array, predicate, fromIndex, fromRight) {
1867 var length = array.length,
1868 index = fromIndex + (fromRight ? 1 : -1);
1869
1870 while ((fromRight ? index-- : ++index < length)) {
1871 if (predicate(array[index], index, array)) {
1872 return index;
1873 }
1874 }
1875 return -1;
1876}
1877
1878/**
1879 * The base implementation of `_.indexOf` without `fromIndex` bounds checks.
1880 *
1881 * @private
1882 * @param {Array} array The array to inspect.
1883 * @param {*} value The value to search for.
1884 * @param {number} fromIndex The index to search from.
1885 * @returns {number} Returns the index of the matched value, else `-1`.
1886 */
1887function baseIndexOf(array, value, fromIndex) {
1888 if (value !== value) {
1889 return baseFindIndex(array, baseIsNaN, fromIndex);
1890 }
1891 var index = fromIndex - 1,
1892 length = array.length;
1893
1894 while (++index < length) {
1895 if (array[index] === value) {
1896 return index;
1897 }
1898 }
1899 return -1;
1900}
1901
1902/**
1903 * The base implementation of `_.isNaN` without support for number objects.
1904 *
1905 * @private
1906 * @param {*} value The value to check.
1907 * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
1908 */
1909function baseIsNaN(value) {
1910 return value !== value;
1911}
1912
1913/**
1914 * The base implementation of `_.property` without support for deep paths.
1915 *
1916 * @private
1917 * @param {string} key The key of the property to get.
1918 * @returns {Function} Returns the new accessor function.
1919 */
1920function baseProperty(key) {
1921 return function(object) {
1922 return object == null ? undefined : object[key];
1923 };
1924}
1925
1926/**
1927 * The base implementation of `_.times` without support for iteratee shorthands
1928 * or max array length checks.
1929 *
1930 * @private
1931 * @param {number} n The number of times to invoke `iteratee`.
1932 * @param {Function} iteratee The function invoked per iteration.
1933 * @returns {Array} Returns the array of results.
1934 */
1935function baseTimes(n, iteratee) {
1936 var index = -1,
1937 result = Array(n);
1938
1939 while (++index < n) {
1940 result[index] = iteratee(index);
1941 }
1942 return result;
1943}
1944
1945/**
1946 * The base implementation of `_.unary` without support for storing metadata.
1947 *
1948 * @private
1949 * @param {Function} func The function to cap arguments for.
1950 * @returns {Function} Returns the new capped function.
1951 */
1952function baseUnary(func) {
1953 return function(value) {
1954 return func(value);
1955 };
1956}
1957
1958/**
1959 * Checks if a cache value for `key` exists.
1960 *
1961 * @private
1962 * @param {Object} cache The cache to query.
1963 * @param {string} key The key of the entry to check.
1964 * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
1965 */
1966function cacheHas(cache, key) {
1967 return cache.has(key);
1968}
1969
1970/**
1971 * Gets the value at `key` of `object`.
1972 *
1973 * @private
1974 * @param {Object} [object] The object to query.
1975 * @param {string} key The key of the property to get.
1976 * @returns {*} Returns the property value.
1977 */
1978function getValue(object, key) {
1979 return object == null ? undefined : object[key];
1980}
1981
1982/**
1983 * Checks if `value` is a host object in IE < 9.
1984 *
1985 * @private
1986 * @param {*} value The value to check.
1987 * @returns {boolean} Returns `true` if `value` is a host object, else `false`.
1988 */
1989function isHostObject(value) {
1990 // Many host objects are `Object` objects that can coerce to strings
1991 // despite having improperly defined `toString` methods.
1992 var result = false;
1993 if (value != null && typeof value.toString != 'function') {
1994 try {
1995 result = !!(value + '');
1996 } catch (e) {}
1997 }
1998 return result;
1999}
2000
2001/**
2002 * Converts `map` to its key-value pairs.
2003 *
2004 * @private
2005 * @param {Object} map The map to convert.
2006 * @returns {Array} Returns the key-value pairs.
2007 */
2008function mapToArray(map) {
2009 var index = -1,
2010 result = Array(map.size);
2011
2012 map.forEach(function(value, key) {
2013 result[++index] = [key, value];
2014 });
2015 return result;
2016}
2017
2018/**
2019 * Creates a unary function that invokes `func` with its argument transformed.
2020 *
2021 * @private
2022 * @param {Function} func The function to wrap.
2023 * @param {Function} transform The argument transform.
2024 * @returns {Function} Returns the new function.
2025 */
2026function overArg(func, transform) {
2027 return function(arg) {
2028 return func(transform(arg));
2029 };
2030}
2031
2032/**
2033 * Converts `set` to an array of its values.
2034 *
2035 * @private
2036 * @param {Object} set The set to convert.
2037 * @returns {Array} Returns the values.
2038 */
2039function setToArray(set) {
2040 var index = -1,
2041 result = Array(set.size);
2042
2043 set.forEach(function(value) {
2044 result[++index] = value;
2045 });
2046 return result;
2047}
2048
2049/** Used for built-in method references. */
2050var arrayProto = Array.prototype,
2051 funcProto = Function.prototype,
2052 objectProto = Object.prototype;
2053
2054/** Used to detect overreaching core-js shims. */
2055var coreJsData = root['__core-js_shared__'];
2056
2057/** Used to detect methods masquerading as native. */
2058var maskSrcKey = (function() {
2059 var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
2060 return uid ? ('Symbol(src)_1.' + uid) : '';
2061}());
2062
2063/** Used to resolve the decompiled source of functions. */
2064var funcToString = funcProto.toString;
2065
2066/** Used to check objects for own properties. */
2067var hasOwnProperty = objectProto.hasOwnProperty;
2068
2069/**
2070 * Used to resolve the
2071 * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
2072 * of values.
2073 */
2074var objectToString = objectProto.toString;
2075
2076/** Used to detect if a method is native. */
2077var reIsNative = RegExp('^' +
2078 funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&')
2079 .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
2080);
2081
2082/** Built-in value references. */
2083var Symbol = root.Symbol,
2084 Uint8Array = root.Uint8Array,
2085 propertyIsEnumerable = objectProto.propertyIsEnumerable,
2086 splice = arrayProto.splice;
2087
2088/* Built-in method references for those with the same name as other `lodash` methods. */
2089var nativeKeys = overArg(Object.keys, Object);
2090
2091/* Built-in method references that are verified to be native. */
2092var DataView = getNative(root, 'DataView'),
2093 Map = getNative(root, 'Map'),
2094 Promise = getNative(root, 'Promise'),
2095 Set = getNative(root, 'Set'),
2096 WeakMap = getNative(root, 'WeakMap'),
2097 nativeCreate = getNative(Object, 'create');
2098
2099/** Used to detect maps, sets, and weakmaps. */
2100var dataViewCtorString = toSource(DataView),
2101 mapCtorString = toSource(Map),
2102 promiseCtorString = toSource(Promise),
2103 setCtorString = toSource(Set),
2104 weakMapCtorString = toSource(WeakMap);
2105
2106/** Used to convert symbols to primitives and strings. */
2107var symbolProto = Symbol ? Symbol.prototype : undefined,
2108 symbolValueOf = symbolProto ? symbolProto.valueOf : undefined,
2109 symbolToString = symbolProto ? symbolProto.toString : undefined;
2110
2111/**
2112 * Creates a hash object.
2113 *
2114 * @private
2115 * @constructor
2116 * @param {Array} [entries] The key-value pairs to cache.
2117 */
2118function Hash(entries) {
2119 var index = -1,
2120 length = entries ? entries.length : 0;
2121
2122 this.clear();
2123 while (++index < length) {
2124 var entry = entries[index];
2125 this.set(entry[0], entry[1]);
2126 }
2127}
2128
2129/**
2130 * Removes all key-value entries from the hash.
2131 *
2132 * @private
2133 * @name clear
2134 * @memberOf Hash
2135 */
2136function hashClear() {
2137 this.__data__ = nativeCreate ? nativeCreate(null) : {};
2138}
2139
2140/**
2141 * Removes `key` and its value from the hash.
2142 *
2143 * @private
2144 * @name delete
2145 * @memberOf Hash
2146 * @param {Object} hash The hash to modify.
2147 * @param {string} key The key of the value to remove.
2148 * @returns {boolean} Returns `true` if the entry was removed, else `false`.
2149 */
2150function hashDelete(key) {
2151 return this.has(key) && delete this.__data__[key];
2152}
2153
2154/**
2155 * Gets the hash value for `key`.
2156 *
2157 * @private
2158 * @name get
2159 * @memberOf Hash
2160 * @param {string} key The key of the value to get.
2161 * @returns {*} Returns the entry value.
2162 */
2163function hashGet(key) {
2164 var data = this.__data__;
2165 if (nativeCreate) {
2166 var result = data[key];
2167 return result === HASH_UNDEFINED ? undefined : result;
2168 }
2169 return hasOwnProperty.call(data, key) ? data[key] : undefined;
2170}
2171
2172/**
2173 * Checks if a hash value for `key` exists.
2174 *
2175 * @private
2176 * @name has
2177 * @memberOf Hash
2178 * @param {string} key The key of the entry to check.
2179 * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
2180 */
2181function hashHas(key) {
2182 var data = this.__data__;
2183 return nativeCreate ? data[key] !== undefined : hasOwnProperty.call(data, key);
2184}
2185
2186/**
2187 * Sets the hash `key` to `value`.
2188 *
2189 * @private
2190 * @name set
2191 * @memberOf Hash
2192 * @param {string} key The key of the value to set.
2193 * @param {*} value The value to set.
2194 * @returns {Object} Returns the hash instance.
2195 */
2196function hashSet(key, value) {
2197 var data = this.__data__;
2198 data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;
2199 return this;
2200}
2201
2202// Add methods to `Hash`.
2203Hash.prototype.clear = hashClear;
2204Hash.prototype['delete'] = hashDelete;
2205Hash.prototype.get = hashGet;
2206Hash.prototype.has = hashHas;
2207Hash.prototype.set = hashSet;
2208
2209/**
2210 * Creates an list cache object.
2211 *
2212 * @private
2213 * @constructor
2214 * @param {Array} [entries] The key-value pairs to cache.
2215 */
2216function ListCache(entries) {
2217 var index = -1,
2218 length = entries ? entries.length : 0;
2219
2220 this.clear();
2221 while (++index < length) {
2222 var entry = entries[index];
2223 this.set(entry[0], entry[1]);
2224 }
2225}
2226
2227/**
2228 * Removes all key-value entries from the list cache.
2229 *
2230 * @private
2231 * @name clear
2232 * @memberOf ListCache
2233 */
2234function listCacheClear() {
2235 this.__data__ = [];
2236}
2237
2238/**
2239 * Removes `key` and its value from the list cache.
2240 *
2241 * @private
2242 * @name delete
2243 * @memberOf ListCache
2244 * @param {string} key The key of the value to remove.
2245 * @returns {boolean} Returns `true` if the entry was removed, else `false`.
2246 */
2247function listCacheDelete(key) {
2248 var data = this.__data__,
2249 index = assocIndexOf(data, key);
2250
2251 if (index < 0) {
2252 return false;
2253 }
2254 var lastIndex = data.length - 1;
2255 if (index == lastIndex) {
2256 data.pop();
2257 } else {
2258 splice.call(data, index, 1);
2259 }
2260 return true;
2261}
2262
2263/**
2264 * Gets the list cache value for `key`.
2265 *
2266 * @private
2267 * @name get
2268 * @memberOf ListCache
2269 * @param {string} key The key of the value to get.
2270 * @returns {*} Returns the entry value.
2271 */
2272function listCacheGet(key) {
2273 var data = this.__data__,
2274 index = assocIndexOf(data, key);
2275
2276 return index < 0 ? undefined : data[index][1];
2277}
2278
2279/**
2280 * Checks if a list cache value for `key` exists.
2281 *
2282 * @private
2283 * @name has
2284 * @memberOf ListCache
2285 * @param {string} key The key of the entry to check.
2286 * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
2287 */
2288function listCacheHas(key) {
2289 return assocIndexOf(this.__data__, key) > -1;
2290}
2291
2292/**
2293 * Sets the list cache `key` to `value`.
2294 *
2295 * @private
2296 * @name set
2297 * @memberOf ListCache
2298 * @param {string} key The key of the value to set.
2299 * @param {*} value The value to set.
2300 * @returns {Object} Returns the list cache instance.
2301 */
2302function listCacheSet(key, value) {
2303 var data = this.__data__,
2304 index = assocIndexOf(data, key);
2305
2306 if (index < 0) {
2307 data.push([key, value]);
2308 } else {
2309 data[index][1] = value;
2310 }
2311 return this;
2312}
2313
2314// Add methods to `ListCache`.
2315ListCache.prototype.clear = listCacheClear;
2316ListCache.prototype['delete'] = listCacheDelete;
2317ListCache.prototype.get = listCacheGet;
2318ListCache.prototype.has = listCacheHas;
2319ListCache.prototype.set = listCacheSet;
2320
2321/**
2322 * Creates a map cache object to store key-value pairs.
2323 *
2324 * @private
2325 * @constructor
2326 * @param {Array} [entries] The key-value pairs to cache.
2327 */
2328function MapCache(entries) {
2329 var index = -1,
2330 length = entries ? entries.length : 0;
2331
2332 this.clear();
2333 while (++index < length) {
2334 var entry = entries[index];
2335 this.set(entry[0], entry[1]);
2336 }
2337}
2338
2339/**
2340 * Removes all key-value entries from the map.
2341 *
2342 * @private
2343 * @name clear
2344 * @memberOf MapCache
2345 */
2346function mapCacheClear() {
2347 this.__data__ = {
2348 'hash': new Hash,
2349 'map': new (Map || ListCache),
2350 'string': new Hash
2351 };
2352}
2353
2354/**
2355 * Removes `key` and its value from the map.
2356 *
2357 * @private
2358 * @name delete
2359 * @memberOf MapCache
2360 * @param {string} key The key of the value to remove.
2361 * @returns {boolean} Returns `true` if the entry was removed, else `false`.
2362 */
2363function mapCacheDelete(key) {
2364 return getMapData(this, key)['delete'](key);
2365}
2366
2367/**
2368 * Gets the map value for `key`.
2369 *
2370 * @private
2371 * @name get
2372 * @memberOf MapCache
2373 * @param {string} key The key of the value to get.
2374 * @returns {*} Returns the entry value.
2375 */
2376function mapCacheGet(key) {
2377 return getMapData(this, key).get(key);
2378}
2379
2380/**
2381 * Checks if a map value for `key` exists.
2382 *
2383 * @private
2384 * @name has
2385 * @memberOf MapCache
2386 * @param {string} key The key of the entry to check.
2387 * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
2388 */
2389function mapCacheHas(key) {
2390 return getMapData(this, key).has(key);
2391}
2392
2393/**
2394 * Sets the map `key` to `value`.
2395 *
2396 * @private
2397 * @name set
2398 * @memberOf MapCache
2399 * @param {string} key The key of the value to set.
2400 * @param {*} value The value to set.
2401 * @returns {Object} Returns the map cache instance.
2402 */
2403function mapCacheSet(key, value) {
2404 getMapData(this, key).set(key, value);
2405 return this;
2406}
2407
2408// Add methods to `MapCache`.
2409MapCache.prototype.clear = mapCacheClear;
2410MapCache.prototype['delete'] = mapCacheDelete;
2411MapCache.prototype.get = mapCacheGet;
2412MapCache.prototype.has = mapCacheHas;
2413MapCache.prototype.set = mapCacheSet;
2414
2415/**
2416 *
2417 * Creates an array cache object to store unique values.
2418 *
2419 * @private
2420 * @constructor
2421 * @param {Array} [values] The values to cache.
2422 */
2423function SetCache(values) {
2424 var index = -1,
2425 length = values ? values.length : 0;
2426
2427 this.__data__ = new MapCache;
2428 while (++index < length) {
2429 this.add(values[index]);
2430 }
2431}
2432
2433/**
2434 * Adds `value` to the array cache.
2435 *
2436 * @private
2437 * @name add
2438 * @memberOf SetCache
2439 * @alias push
2440 * @param {*} value The value to cache.
2441 * @returns {Object} Returns the cache instance.
2442 */
2443function setCacheAdd(value) {
2444 this.__data__.set(value, HASH_UNDEFINED);
2445 return this;
2446}
2447
2448/**
2449 * Checks if `value` is in the array cache.
2450 *
2451 * @private
2452 * @name has
2453 * @memberOf SetCache
2454 * @param {*} value The value to search for.
2455 * @returns {number} Returns `true` if `value` is found, else `false`.
2456 */
2457function setCacheHas(value) {
2458 return this.__data__.has(value);
2459}
2460
2461// Add methods to `SetCache`.
2462SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
2463SetCache.prototype.has = setCacheHas;
2464
2465/**
2466 * Creates a stack cache object to store key-value pairs.
2467 *
2468 * @private
2469 * @constructor
2470 * @param {Array} [entries] The key-value pairs to cache.
2471 */
2472function Stack(entries) {
2473 this.__data__ = new ListCache(entries);
2474}
2475
2476/**
2477 * Removes all key-value entries from the stack.
2478 *
2479 * @private
2480 * @name clear
2481 * @memberOf Stack
2482 */
2483function stackClear() {
2484 this.__data__ = new ListCache;
2485}
2486
2487/**
2488 * Removes `key` and its value from the stack.
2489 *
2490 * @private
2491 * @name delete
2492 * @memberOf Stack
2493 * @param {string} key The key of the value to remove.
2494 * @returns {boolean} Returns `true` if the entry was removed, else `false`.
2495 */
2496function stackDelete(key) {
2497 return this.__data__['delete'](key);
2498}
2499
2500/**
2501 * Gets the stack value for `key`.
2502 *
2503 * @private
2504 * @name get
2505 * @memberOf Stack
2506 * @param {string} key The key of the value to get.
2507 * @returns {*} Returns the entry value.
2508 */
2509function stackGet(key) {
2510 return this.__data__.get(key);
2511}
2512
2513/**
2514 * Checks if a stack value for `key` exists.
2515 *
2516 * @private
2517 * @name has
2518 * @memberOf Stack
2519 * @param {string} key The key of the entry to check.
2520 * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
2521 */
2522function stackHas(key) {
2523 return this.__data__.has(key);
2524}
2525
2526/**
2527 * Sets the stack `key` to `value`.
2528 *
2529 * @private
2530 * @name set
2531 * @memberOf Stack
2532 * @param {string} key The key of the value to set.
2533 * @param {*} value The value to set.
2534 * @returns {Object} Returns the stack cache instance.
2535 */
2536function stackSet(key, value) {
2537 var cache = this.__data__;
2538 if (cache instanceof ListCache) {
2539 var pairs = cache.__data__;
2540 if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {
2541 pairs.push([key, value]);
2542 return this;
2543 }
2544 cache = this.__data__ = new MapCache(pairs);
2545 }
2546 cache.set(key, value);
2547 return this;
2548}
2549
2550// Add methods to `Stack`.
2551Stack.prototype.clear = stackClear;
2552Stack.prototype['delete'] = stackDelete;
2553Stack.prototype.get = stackGet;
2554Stack.prototype.has = stackHas;
2555Stack.prototype.set = stackSet;
2556
2557/**
2558 * Creates an array of the enumerable property names of the array-like `value`.
2559 *
2560 * @private
2561 * @param {*} value The value to query.
2562 * @param {boolean} inherited Specify returning inherited property names.
2563 * @returns {Array} Returns the array of property names.
2564 */
2565function arrayLikeKeys(value, inherited) {
2566 // Safari 8.1 makes `arguments.callee` enumerable in strict mode.
2567 // Safari 9 makes `arguments.length` enumerable in strict mode.
2568 var result = (isArray(value) || isArguments(value))
2569 ? baseTimes(value.length, String)
2570 : [];
2571
2572 var length = result.length,
2573 skipIndexes = !!length;
2574
2575 for (var key in value) {
2576 if ((inherited || hasOwnProperty.call(value, key)) &&
2577 !(skipIndexes && (key == 'length' || isIndex(key, length)))) {
2578 result.push(key);
2579 }
2580 }
2581 return result;
2582}
2583
2584/**
2585 * Gets the index at which the `key` is found in `array` of key-value pairs.
2586 *
2587 * @private
2588 * @param {Array} array The array to inspect.
2589 * @param {*} key The key to search for.
2590 * @returns {number} Returns the index of the matched value, else `-1`.
2591 */
2592function assocIndexOf(array, key) {
2593 var length = array.length;
2594 while (length--) {
2595 if (eq(array[length][0], key)) {
2596 return length;
2597 }
2598 }
2599 return -1;
2600}
2601
2602/**
2603 * The base implementation of `_.get` without support for default values.
2604 *
2605 * @private
2606 * @param {Object} object The object to query.
2607 * @param {Array|string} path The path of the property to get.
2608 * @returns {*} Returns the resolved value.
2609 */
2610function baseGet(object, path) {
2611 path = isKey(path, object) ? [path] : castPath(path);
2612
2613 var index = 0,
2614 length = path.length;
2615
2616 while (object != null && index < length) {
2617 object = object[toKey(path[index++])];
2618 }
2619 return (index && index == length) ? object : undefined;
2620}
2621
2622/**
2623 * The base implementation of `getTag`.
2624 *
2625 * @private
2626 * @param {*} value The value to query.
2627 * @returns {string} Returns the `toStringTag`.
2628 */
2629function baseGetTag(value) {
2630 return objectToString.call(value);
2631}
2632
2633/**
2634 * The base implementation of `_.hasIn` without support for deep paths.
2635 *
2636 * @private
2637 * @param {Object} [object] The object to query.
2638 * @param {Array|string} key The key to check.
2639 * @returns {boolean} Returns `true` if `key` exists, else `false`.
2640 */
2641function baseHasIn(object, key) {
2642 return object != null && key in Object(object);
2643}
2644
2645/**
2646 * The base implementation of `_.isEqual` which supports partial comparisons
2647 * and tracks traversed objects.
2648 *
2649 * @private
2650 * @param {*} value The value to compare.
2651 * @param {*} other The other value to compare.
2652 * @param {Function} [customizer] The function to customize comparisons.
2653 * @param {boolean} [bitmask] The bitmask of comparison flags.
2654 * The bitmask may be composed of the following flags:
2655 * 1 - Unordered comparison
2656 * 2 - Partial comparison
2657 * @param {Object} [stack] Tracks traversed `value` and `other` objects.
2658 * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
2659 */
2660function baseIsEqual(value, other, customizer, bitmask, stack) {
2661 if (value === other) {
2662 return true;
2663 }
2664 if (value == null || other == null || (!isObject(value) && !isObjectLike(other))) {
2665 return value !== value && other !== other;
2666 }
2667 return baseIsEqualDeep(value, other, baseIsEqual, customizer, bitmask, stack);
2668}
2669
2670/**
2671 * A specialized version of `baseIsEqual` for arrays and objects which performs
2672 * deep comparisons and tracks traversed objects enabling objects with circular
2673 * references to be compared.
2674 *
2675 * @private
2676 * @param {Object} object The object to compare.
2677 * @param {Object} other The other object to compare.
2678 * @param {Function} equalFunc The function to determine equivalents of values.
2679 * @param {Function} [customizer] The function to customize comparisons.
2680 * @param {number} [bitmask] The bitmask of comparison flags. See `baseIsEqual`
2681 * for more details.
2682 * @param {Object} [stack] Tracks traversed `object` and `other` objects.
2683 * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
2684 */
2685function baseIsEqualDeep(object, other, equalFunc, customizer, bitmask, stack) {
2686 var objIsArr = isArray(object),
2687 othIsArr = isArray(other),
2688 objTag = arrayTag,
2689 othTag = arrayTag;
2690
2691 if (!objIsArr) {
2692 objTag = getTag(object);
2693 objTag = objTag == argsTag ? objectTag : objTag;
2694 }
2695 if (!othIsArr) {
2696 othTag = getTag(other);
2697 othTag = othTag == argsTag ? objectTag : othTag;
2698 }
2699 var objIsObj = objTag == objectTag && !isHostObject(object),
2700 othIsObj = othTag == objectTag && !isHostObject(other),
2701 isSameTag = objTag == othTag;
2702
2703 if (isSameTag && !objIsObj) {
2704 stack || (stack = new Stack);
2705 return (objIsArr || isTypedArray(object))
2706 ? equalArrays(object, other, equalFunc, customizer, bitmask, stack)
2707 : equalByTag(object, other, objTag, equalFunc, customizer, bitmask, stack);
2708 }
2709 if (!(bitmask & PARTIAL_COMPARE_FLAG)) {
2710 var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),
2711 othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');
2712
2713 if (objIsWrapped || othIsWrapped) {
2714 var objUnwrapped = objIsWrapped ? object.value() : object,
2715 othUnwrapped = othIsWrapped ? other.value() : other;
2716
2717 stack || (stack = new Stack);
2718 return equalFunc(objUnwrapped, othUnwrapped, customizer, bitmask, stack);
2719 }
2720 }
2721 if (!isSameTag) {
2722 return false;
2723 }
2724 stack || (stack = new Stack);
2725 return equalObjects(object, other, equalFunc, customizer, bitmask, stack);
2726}
2727
2728/**
2729 * The base implementation of `_.isMatch` without support for iteratee shorthands.
2730 *
2731 * @private
2732 * @param {Object} object The object to inspect.
2733 * @param {Object} source The object of property values to match.
2734 * @param {Array} matchData The property names, values, and compare flags to match.
2735 * @param {Function} [customizer] The function to customize comparisons.
2736 * @returns {boolean} Returns `true` if `object` is a match, else `false`.
2737 */
2738function baseIsMatch(object, source, matchData, customizer) {
2739 var index = matchData.length,
2740 length = index,
2741 noCustomizer = !customizer;
2742
2743 if (object == null) {
2744 return !length;
2745 }
2746 object = Object(object);
2747 while (index--) {
2748 var data = matchData[index];
2749 if ((noCustomizer && data[2])
2750 ? data[1] !== object[data[0]]
2751 : !(data[0] in object)
2752 ) {
2753 return false;
2754 }
2755 }
2756 while (++index < length) {
2757 data = matchData[index];
2758 var key = data[0],
2759 objValue = object[key],
2760 srcValue = data[1];
2761
2762 if (noCustomizer && data[2]) {
2763 if (objValue === undefined && !(key in object)) {
2764 return false;
2765 }
2766 } else {
2767 var stack = new Stack;
2768 if (customizer) {
2769 var result = customizer(objValue, srcValue, key, object, source, stack);
2770 }
2771 if (!(result === undefined
2772 ? baseIsEqual(srcValue, objValue, customizer, UNORDERED_COMPARE_FLAG | PARTIAL_COMPARE_FLAG, stack)
2773 : result
2774 )) {
2775 return false;
2776 }
2777 }
2778 }
2779 return true;
2780}
2781
2782/**
2783 * The base implementation of `_.isNative` without bad shim checks.
2784 *
2785 * @private
2786 * @param {*} value The value to check.
2787 * @returns {boolean} Returns `true` if `value` is a native function,
2788 * else `false`.
2789 */
2790function baseIsNative(value) {
2791 if (!isObject(value) || isMasked(value)) {
2792 return false;
2793 }
2794 var pattern = (isFunction(value) || isHostObject(value)) ? reIsNative : reIsHostCtor;
2795 return pattern.test(toSource(value));
2796}
2797
2798/**
2799 * The base implementation of `_.isTypedArray` without Node.js optimizations.
2800 *
2801 * @private
2802 * @param {*} value The value to check.
2803 * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
2804 */
2805function baseIsTypedArray(value) {
2806 return isObjectLike(value) &&
2807 isLength(value.length) && !!typedArrayTags[objectToString.call(value)];
2808}
2809
2810/**
2811 * The base implementation of `_.iteratee`.
2812 *
2813 * @private
2814 * @param {*} [value=_.identity] The value to convert to an iteratee.
2815 * @returns {Function} Returns the iteratee.
2816 */
2817function baseIteratee(value) {
2818 // Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9.
2819 // See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details.
2820 if (typeof value == 'function') {
2821 return value;
2822 }
2823 if (value == null) {
2824 return identity;
2825 }
2826 if (typeof value == 'object') {
2827 return isArray(value)
2828 ? baseMatchesProperty(value[0], value[1])
2829 : baseMatches(value);
2830 }
2831 return property(value);
2832}
2833
2834/**
2835 * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
2836 *
2837 * @private
2838 * @param {Object} object The object to query.
2839 * @returns {Array} Returns the array of property names.
2840 */
2841function baseKeys(object) {
2842 if (!isPrototype(object)) {
2843 return nativeKeys(object);
2844 }
2845 var result = [];
2846 for (var key in Object(object)) {
2847 if (hasOwnProperty.call(object, key) && key != 'constructor') {
2848 result.push(key);
2849 }
2850 }
2851 return result;
2852}
2853
2854/**
2855 * The base implementation of `_.matches` which doesn't clone `source`.
2856 *
2857 * @private
2858 * @param {Object} source The object of property values to match.
2859 * @returns {Function} Returns the new spec function.
2860 */
2861function baseMatches(source) {
2862 var matchData = getMatchData(source);
2863 if (matchData.length == 1 && matchData[0][2]) {
2864 return matchesStrictComparable(matchData[0][0], matchData[0][1]);
2865 }
2866 return function(object) {
2867 return object === source || baseIsMatch(object, source, matchData);
2868 };
2869}
2870
2871/**
2872 * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`.
2873 *
2874 * @private
2875 * @param {string} path The path of the property to get.
2876 * @param {*} srcValue The value to match.
2877 * @returns {Function} Returns the new spec function.
2878 */
2879function baseMatchesProperty(path, srcValue) {
2880 if (isKey(path) && isStrictComparable(srcValue)) {
2881 return matchesStrictComparable(toKey(path), srcValue);
2882 }
2883 return function(object) {
2884 var objValue = get(object, path);
2885 return (objValue === undefined && objValue === srcValue)
2886 ? hasIn(object, path)
2887 : baseIsEqual(srcValue, objValue, undefined, UNORDERED_COMPARE_FLAG | PARTIAL_COMPARE_FLAG);
2888 };
2889}
2890
2891/**
2892 * A specialized version of `baseProperty` which supports deep paths.
2893 *
2894 * @private
2895 * @param {Array|string} path The path of the property to get.
2896 * @returns {Function} Returns the new accessor function.
2897 */
2898function basePropertyDeep(path) {
2899 return function(object) {
2900 return baseGet(object, path);
2901 };
2902}
2903
2904/**
2905 * The base implementation of `_.toString` which doesn't convert nullish
2906 * values to empty strings.
2907 *
2908 * @private
2909 * @param {*} value The value to process.
2910 * @returns {string} Returns the string.
2911 */
2912function baseToString(value) {
2913 // Exit early for strings to avoid a performance hit in some environments.
2914 if (typeof value == 'string') {
2915 return value;
2916 }
2917 if (isSymbol(value)) {
2918 return symbolToString ? symbolToString.call(value) : '';
2919 }
2920 var result = (value + '');
2921 return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
2922}
2923
2924/**
2925 * The base implementation of `_.uniqBy` without support for iteratee shorthands.
2926 *
2927 * @private
2928 * @param {Array} array The array to inspect.
2929 * @param {Function} [iteratee] The iteratee invoked per element.
2930 * @param {Function} [comparator] The comparator invoked per element.
2931 * @returns {Array} Returns the new duplicate free array.
2932 */
2933function baseUniq(array, iteratee, comparator) {
2934 var index = -1,
2935 includes = arrayIncludes,
2936 length = array.length,
2937 isCommon = true,
2938 result = [],
2939 seen = result;
2940
2941 if (comparator) {
2942 isCommon = false;
2943 includes = arrayIncludesWith;
2944 }
2945 else if (length >= LARGE_ARRAY_SIZE) {
2946 var set = iteratee ? null : createSet(array);
2947 if (set) {
2948 return setToArray(set);
2949 }
2950 isCommon = false;
2951 includes = cacheHas;
2952 seen = new SetCache;
2953 }
2954 else {
2955 seen = iteratee ? [] : result;
2956 }
2957 outer:
2958 while (++index < length) {
2959 var value = array[index],
2960 computed = iteratee ? iteratee(value) : value;
2961
2962 value = (comparator || value !== 0) ? value : 0;
2963 if (isCommon && computed === computed) {
2964 var seenIndex = seen.length;
2965 while (seenIndex--) {
2966 if (seen[seenIndex] === computed) {
2967 continue outer;
2968 }
2969 }
2970 if (iteratee) {
2971 seen.push(computed);
2972 }
2973 result.push(value);
2974 }
2975 else if (!includes(seen, computed, comparator)) {
2976 if (seen !== result) {
2977 seen.push(computed);
2978 }
2979 result.push(value);
2980 }
2981 }
2982 return result;
2983}
2984
2985/**
2986 * Casts `value` to a path array if it's not one.
2987 *
2988 * @private
2989 * @param {*} value The value to inspect.
2990 * @returns {Array} Returns the cast property path array.
2991 */
2992function castPath(value) {
2993 return isArray(value) ? value : stringToPath(value);
2994}
2995
2996/**
2997 * Creates a set object of `values`.
2998 *
2999 * @private
3000 * @param {Array} values The values to add to the set.
3001 * @returns {Object} Returns the new set.
3002 */
3003var createSet = !(Set && (1 / setToArray(new Set([,-0]))[1]) == INFINITY) ? noop : function(values) {
3004 return new Set(values);
3005};
3006
3007/**
3008 * A specialized version of `baseIsEqualDeep` for arrays with support for
3009 * partial deep comparisons.
3010 *
3011 * @private
3012 * @param {Array} array The array to compare.
3013 * @param {Array} other The other array to compare.
3014 * @param {Function} equalFunc The function to determine equivalents of values.
3015 * @param {Function} customizer The function to customize comparisons.
3016 * @param {number} bitmask The bitmask of comparison flags. See `baseIsEqual`
3017 * for more details.
3018 * @param {Object} stack Tracks traversed `array` and `other` objects.
3019 * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
3020 */
3021function equalArrays(array, other, equalFunc, customizer, bitmask, stack) {
3022 var isPartial = bitmask & PARTIAL_COMPARE_FLAG,
3023 arrLength = array.length,
3024 othLength = other.length;
3025
3026 if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
3027 return false;
3028 }
3029 // Assume cyclic values are equal.
3030 var stacked = stack.get(array);
3031 if (stacked && stack.get(other)) {
3032 return stacked == other;
3033 }
3034 var index = -1,
3035 result = true,
3036 seen = (bitmask & UNORDERED_COMPARE_FLAG) ? new SetCache : undefined;
3037
3038 stack.set(array, other);
3039 stack.set(other, array);
3040
3041 // Ignore non-index properties.
3042 while (++index < arrLength) {
3043 var arrValue = array[index],
3044 othValue = other[index];
3045
3046 if (customizer) {
3047 var compared = isPartial
3048 ? customizer(othValue, arrValue, index, other, array, stack)
3049 : customizer(arrValue, othValue, index, array, other, stack);
3050 }
3051 if (compared !== undefined) {
3052 if (compared) {
3053 continue;
3054 }
3055 result = false;
3056 break;
3057 }
3058 // Recursively compare arrays (susceptible to call stack limits).
3059 if (seen) {
3060 if (!arraySome(other, function(othValue, othIndex) {
3061 if (!seen.has(othIndex) &&
3062 (arrValue === othValue || equalFunc(arrValue, othValue, customizer, bitmask, stack))) {
3063 return seen.add(othIndex);
3064 }
3065 })) {
3066 result = false;
3067 break;
3068 }
3069 } else if (!(
3070 arrValue === othValue ||
3071 equalFunc(arrValue, othValue, customizer, bitmask, stack)
3072 )) {
3073 result = false;
3074 break;
3075 }
3076 }
3077 stack['delete'](array);
3078 stack['delete'](other);
3079 return result;
3080}
3081
3082/**
3083 * A specialized version of `baseIsEqualDeep` for comparing objects of
3084 * the same `toStringTag`.
3085 *
3086 * **Note:** This function only supports comparing values with tags of
3087 * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
3088 *
3089 * @private
3090 * @param {Object} object The object to compare.
3091 * @param {Object} other The other object to compare.
3092 * @param {string} tag The `toStringTag` of the objects to compare.
3093 * @param {Function} equalFunc The function to determine equivalents of values.
3094 * @param {Function} customizer The function to customize comparisons.
3095 * @param {number} bitmask The bitmask of comparison flags. See `baseIsEqual`
3096 * for more details.
3097 * @param {Object} stack Tracks traversed `object` and `other` objects.
3098 * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
3099 */
3100function equalByTag(object, other, tag, equalFunc, customizer, bitmask, stack) {
3101 switch (tag) {
3102 case dataViewTag:
3103 if ((object.byteLength != other.byteLength) ||
3104 (object.byteOffset != other.byteOffset)) {
3105 return false;
3106 }
3107 object = object.buffer;
3108 other = other.buffer;
3109
3110 case arrayBufferTag:
3111 if ((object.byteLength != other.byteLength) ||
3112 !equalFunc(new Uint8Array(object), new Uint8Array(other))) {
3113 return false;
3114 }
3115 return true;
3116
3117 case boolTag:
3118 case dateTag:
3119 case numberTag:
3120 // Coerce booleans to `1` or `0` and dates to milliseconds.
3121 // Invalid dates are coerced to `NaN`.
3122 return eq(+object, +other);
3123
3124 case errorTag:
3125 return object.name == other.name && object.message == other.message;
3126
3127 case regexpTag:
3128 case stringTag:
3129 // Coerce regexes to strings and treat strings, primitives and objects,
3130 // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring
3131 // for more details.
3132 return object == (other + '');
3133
3134 case mapTag:
3135 var convert = mapToArray;
3136
3137 case setTag:
3138 var isPartial = bitmask & PARTIAL_COMPARE_FLAG;
3139 convert || (convert = setToArray);
3140
3141 if (object.size != other.size && !isPartial) {
3142 return false;
3143 }
3144 // Assume cyclic values are equal.
3145 var stacked = stack.get(object);
3146 if (stacked) {
3147 return stacked == other;
3148 }
3149 bitmask |= UNORDERED_COMPARE_FLAG;
3150
3151 // Recursively compare objects (susceptible to call stack limits).
3152 stack.set(object, other);
3153 var result = equalArrays(convert(object), convert(other), equalFunc, customizer, bitmask, stack);
3154 stack['delete'](object);
3155 return result;
3156
3157 case symbolTag:
3158 if (symbolValueOf) {
3159 return symbolValueOf.call(object) == symbolValueOf.call(other);
3160 }
3161 }
3162 return false;
3163}
3164
3165/**
3166 * A specialized version of `baseIsEqualDeep` for objects with support for
3167 * partial deep comparisons.
3168 *
3169 * @private
3170 * @param {Object} object The object to compare.
3171 * @param {Object} other The other object to compare.
3172 * @param {Function} equalFunc The function to determine equivalents of values.
3173 * @param {Function} customizer The function to customize comparisons.
3174 * @param {number} bitmask The bitmask of comparison flags. See `baseIsEqual`
3175 * for more details.
3176 * @param {Object} stack Tracks traversed `object` and `other` objects.
3177 * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
3178 */
3179function equalObjects(object, other, equalFunc, customizer, bitmask, stack) {
3180 var isPartial = bitmask & PARTIAL_COMPARE_FLAG,
3181 objProps = keys(object),
3182 objLength = objProps.length,
3183 othProps = keys(other),
3184 othLength = othProps.length;
3185
3186 if (objLength != othLength && !isPartial) {
3187 return false;
3188 }
3189 var index = objLength;
3190 while (index--) {
3191 var key = objProps[index];
3192 if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) {
3193 return false;
3194 }
3195 }
3196 // Assume cyclic values are equal.
3197 var stacked = stack.get(object);
3198 if (stacked && stack.get(other)) {
3199 return stacked == other;
3200 }
3201 var result = true;
3202 stack.set(object, other);
3203 stack.set(other, object);
3204
3205 var skipCtor = isPartial;
3206 while (++index < objLength) {
3207 key = objProps[index];
3208 var objValue = object[key],
3209 othValue = other[key];
3210
3211 if (customizer) {
3212 var compared = isPartial
3213 ? customizer(othValue, objValue, key, other, object, stack)
3214 : customizer(objValue, othValue, key, object, other, stack);
3215 }
3216 // Recursively compare objects (susceptible to call stack limits).
3217 if (!(compared === undefined
3218 ? (objValue === othValue || equalFunc(objValue, othValue, customizer, bitmask, stack))
3219 : compared
3220 )) {
3221 result = false;
3222 break;
3223 }
3224 skipCtor || (skipCtor = key == 'constructor');
3225 }
3226 if (result && !skipCtor) {
3227 var objCtor = object.constructor,
3228 othCtor = other.constructor;
3229
3230 // Non `Object` object instances with different constructors are not equal.
3231 if (objCtor != othCtor &&
3232 ('constructor' in object && 'constructor' in other) &&
3233 !(typeof objCtor == 'function' && objCtor instanceof objCtor &&
3234 typeof othCtor == 'function' && othCtor instanceof othCtor)) {
3235 result = false;
3236 }
3237 }
3238 stack['delete'](object);
3239 stack['delete'](other);
3240 return result;
3241}
3242
3243/**
3244 * Gets the data for `map`.
3245 *
3246 * @private
3247 * @param {Object} map The map to query.
3248 * @param {string} key The reference key.
3249 * @returns {*} Returns the map data.
3250 */
3251function getMapData(map, key) {
3252 var data = map.__data__;
3253 return isKeyable(key)
3254 ? data[typeof key == 'string' ? 'string' : 'hash']
3255 : data.map;
3256}
3257
3258/**
3259 * Gets the property names, values, and compare flags of `object`.
3260 *
3261 * @private
3262 * @param {Object} object The object to query.
3263 * @returns {Array} Returns the match data of `object`.
3264 */
3265function getMatchData(object) {
3266 var result = keys(object),
3267 length = result.length;
3268
3269 while (length--) {
3270 var key = result[length],
3271 value = object[key];
3272
3273 result[length] = [key, value, isStrictComparable(value)];
3274 }
3275 return result;
3276}
3277
3278/**
3279 * Gets the native function at `key` of `object`.
3280 *
3281 * @private
3282 * @param {Object} object The object to query.
3283 * @param {string} key The key of the method to get.
3284 * @returns {*} Returns the function if it's native, else `undefined`.
3285 */
3286function getNative(object, key) {
3287 var value = getValue(object, key);
3288 return baseIsNative(value) ? value : undefined;
3289}
3290
3291/**
3292 * Gets the `toStringTag` of `value`.
3293 *
3294 * @private
3295 * @param {*} value The value to query.
3296 * @returns {string} Returns the `toStringTag`.
3297 */
3298var getTag = baseGetTag;
3299
3300// Fallback for data views, maps, sets, and weak maps in IE 11,
3301// for data views in Edge < 14, and promises in Node.js.
3302if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||
3303 (Map && getTag(new Map) != mapTag) ||
3304 (Promise && getTag(Promise.resolve()) != promiseTag) ||
3305 (Set && getTag(new Set) != setTag) ||
3306 (WeakMap && getTag(new WeakMap) != weakMapTag)) {
3307 getTag = function(value) {
3308 var result = objectToString.call(value),
3309 Ctor = result == objectTag ? value.constructor : undefined,
3310 ctorString = Ctor ? toSource(Ctor) : undefined;
3311
3312 if (ctorString) {
3313 switch (ctorString) {
3314 case dataViewCtorString: return dataViewTag;
3315 case mapCtorString: return mapTag;
3316 case promiseCtorString: return promiseTag;
3317 case setCtorString: return setTag;
3318 case weakMapCtorString: return weakMapTag;
3319 }
3320 }
3321 return result;
3322 };
3323}
3324
3325/**
3326 * Checks if `path` exists on `object`.
3327 *
3328 * @private
3329 * @param {Object} object The object to query.
3330 * @param {Array|string} path The path to check.
3331 * @param {Function} hasFunc The function to check properties.
3332 * @returns {boolean} Returns `true` if `path` exists, else `false`.
3333 */
3334function hasPath(object, path, hasFunc) {
3335 path = isKey(path, object) ? [path] : castPath(path);
3336
3337 var result,
3338 index = -1,
3339 length = path.length;
3340
3341 while (++index < length) {
3342 var key = toKey(path[index]);
3343 if (!(result = object != null && hasFunc(object, key))) {
3344 break;
3345 }
3346 object = object[key];
3347 }
3348 if (result) {
3349 return result;
3350 }
3351 var length = object ? object.length : 0;
3352 return !!length && isLength(length) && isIndex(key, length) &&
3353 (isArray(object) || isArguments(object));
3354}
3355
3356/**
3357 * Checks if `value` is a valid array-like index.
3358 *
3359 * @private
3360 * @param {*} value The value to check.
3361 * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
3362 * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
3363 */
3364function isIndex(value, length) {
3365 length = length == null ? MAX_SAFE_INTEGER : length;
3366 return !!length &&
3367 (typeof value == 'number' || reIsUint.test(value)) &&
3368 (value > -1 && value % 1 == 0 && value < length);
3369}
3370
3371/**
3372 * Checks if `value` is a property name and not a property path.
3373 *
3374 * @private
3375 * @param {*} value The value to check.
3376 * @param {Object} [object] The object to query keys on.
3377 * @returns {boolean} Returns `true` if `value` is a property name, else `false`.
3378 */
3379function isKey(value, object) {
3380 if (isArray(value)) {
3381 return false;
3382 }
3383 var type = typeof value;
3384 if (type == 'number' || type == 'symbol' || type == 'boolean' ||
3385 value == null || isSymbol(value)) {
3386 return true;
3387 }
3388 return reIsPlainProp.test(value) || !reIsDeepProp.test(value) ||
3389 (object != null && value in Object(object));
3390}
3391
3392/**
3393 * Checks if `value` is suitable for use as unique object key.
3394 *
3395 * @private
3396 * @param {*} value The value to check.
3397 * @returns {boolean} Returns `true` if `value` is suitable, else `false`.
3398 */
3399function isKeyable(value) {
3400 var type = typeof value;
3401 return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
3402 ? (value !== '__proto__')
3403 : (value === null);
3404}
3405
3406/**
3407 * Checks if `func` has its source masked.
3408 *
3409 * @private
3410 * @param {Function} func The function to check.
3411 * @returns {boolean} Returns `true` if `func` is masked, else `false`.
3412 */
3413function isMasked(func) {
3414 return !!maskSrcKey && (maskSrcKey in func);
3415}
3416
3417/**
3418 * Checks if `value` is likely a prototype object.
3419 *
3420 * @private
3421 * @param {*} value The value to check.
3422 * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
3423 */
3424function isPrototype(value) {
3425 var Ctor = value && value.constructor,
3426 proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;
3427
3428 return value === proto;
3429}
3430
3431/**
3432 * Checks if `value` is suitable for strict equality comparisons, i.e. `===`.
3433 *
3434 * @private
3435 * @param {*} value The value to check.
3436 * @returns {boolean} Returns `true` if `value` if suitable for strict
3437 * equality comparisons, else `false`.
3438 */
3439function isStrictComparable(value) {
3440 return value === value && !isObject(value);
3441}
3442
3443/**
3444 * A specialized version of `matchesProperty` for source values suitable
3445 * for strict equality comparisons, i.e. `===`.
3446 *
3447 * @private
3448 * @param {string} key The key of the property to get.
3449 * @param {*} srcValue The value to match.
3450 * @returns {Function} Returns the new spec function.
3451 */
3452function matchesStrictComparable(key, srcValue) {
3453 return function(object) {
3454 if (object == null) {
3455 return false;
3456 }
3457 return object[key] === srcValue &&
3458 (srcValue !== undefined || (key in Object(object)));
3459 };
3460}
3461
3462/**
3463 * Converts `string` to a property path array.
3464 *
3465 * @private
3466 * @param {string} string The string to convert.
3467 * @returns {Array} Returns the property path array.
3468 */
3469var stringToPath = memoize(function(string) {
3470 string = toString(string);
3471
3472 var result = [];
3473 if (reLeadingDot.test(string)) {
3474 result.push('');
3475 }
3476 string.replace(rePropName, function(match, number, quote, string) {
3477 result.push(quote ? string.replace(reEscapeChar, '$1') : (number || match));
3478 });
3479 return result;
3480});
3481
3482/**
3483 * Converts `value` to a string key if it's not a string or symbol.
3484 *
3485 * @private
3486 * @param {*} value The value to inspect.
3487 * @returns {string|symbol} Returns the key.
3488 */
3489function toKey(value) {
3490 if (typeof value == 'string' || isSymbol(value)) {
3491 return value;
3492 }
3493 var result = (value + '');
3494 return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
3495}
3496
3497/**
3498 * Converts `func` to its source code.
3499 *
3500 * @private
3501 * @param {Function} func The function to process.
3502 * @returns {string} Returns the source code.
3503 */
3504function toSource(func) {
3505 if (func != null) {
3506 try {
3507 return funcToString.call(func);
3508 } catch (e) {}
3509 try {
3510 return (func + '');
3511 } catch (e) {}
3512 }
3513 return '';
3514}
3515
3516/**
3517 * This method is like `_.uniq` except that it accepts `iteratee` which is
3518 * invoked for each element in `array` to generate the criterion by which
3519 * uniqueness is computed. The iteratee is invoked with one argument: (value).
3520 *
3521 * @static
3522 * @memberOf _
3523 * @since 4.0.0
3524 * @category Array
3525 * @param {Array} array The array to inspect.
3526 * @param {Function} [iteratee=_.identity]
3527 * The iteratee invoked per element.
3528 * @returns {Array} Returns the new duplicate free array.
3529 * @example
3530 *
3531 * _.uniqBy([2.1, 1.2, 2.3], Math.floor);
3532 * // => [2.1, 1.2]
3533 *
3534 * // The `_.property` iteratee shorthand.
3535 * _.uniqBy([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x');
3536 * // => [{ 'x': 1 }, { 'x': 2 }]
3537 */
3538function uniqBy(array, iteratee) {
3539 return (array && array.length)
3540 ? baseUniq(array, baseIteratee(iteratee, 2))
3541 : [];
3542}
3543
3544/**
3545 * Creates a function that memoizes the result of `func`. If `resolver` is
3546 * provided, it determines the cache key for storing the result based on the
3547 * arguments provided to the memoized function. By default, the first argument
3548 * provided to the memoized function is used as the map cache key. The `func`
3549 * is invoked with the `this` binding of the memoized function.
3550 *
3551 * **Note:** The cache is exposed as the `cache` property on the memoized
3552 * function. Its creation may be customized by replacing the `_.memoize.Cache`
3553 * constructor with one whose instances implement the
3554 * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)
3555 * method interface of `delete`, `get`, `has`, and `set`.
3556 *
3557 * @static
3558 * @memberOf _
3559 * @since 0.1.0
3560 * @category Function
3561 * @param {Function} func The function to have its output memoized.
3562 * @param {Function} [resolver] The function to resolve the cache key.
3563 * @returns {Function} Returns the new memoized function.
3564 * @example
3565 *
3566 * var object = { 'a': 1, 'b': 2 };
3567 * var other = { 'c': 3, 'd': 4 };
3568 *
3569 * var values = _.memoize(_.values);
3570 * values(object);
3571 * // => [1, 2]
3572 *
3573 * values(other);
3574 * // => [3, 4]
3575 *
3576 * object.a = 2;
3577 * values(object);
3578 * // => [1, 2]
3579 *
3580 * // Modify the result cache.
3581 * values.cache.set(object, ['a', 'b']);
3582 * values(object);
3583 * // => ['a', 'b']
3584 *
3585 * // Replace `_.memoize.Cache`.
3586 * _.memoize.Cache = WeakMap;
3587 */
3588function memoize(func, resolver) {
3589 if (typeof func != 'function' || (resolver && typeof resolver != 'function')) {
3590 throw new TypeError(FUNC_ERROR_TEXT);
3591 }
3592 var memoized = function() {
3593 var args = arguments,
3594 key = resolver ? resolver.apply(this, args) : args[0],
3595 cache = memoized.cache;
3596
3597 if (cache.has(key)) {
3598 return cache.get(key);
3599 }
3600 var result = func.apply(this, args);
3601 memoized.cache = cache.set(key, result);
3602 return result;
3603 };
3604 memoized.cache = new (memoize.Cache || MapCache);
3605 return memoized;
3606}
3607
3608// Assign cache to `_.memoize`.
3609memoize.Cache = MapCache;
3610
3611/**
3612 * Performs a
3613 * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
3614 * comparison between two values to determine if they are equivalent.
3615 *
3616 * @static
3617 * @memberOf _
3618 * @since 4.0.0
3619 * @category Lang
3620 * @param {*} value The value to compare.
3621 * @param {*} other The other value to compare.
3622 * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
3623 * @example
3624 *
3625 * var object = { 'a': 1 };
3626 * var other = { 'a': 1 };
3627 *
3628 * _.eq(object, object);
3629 * // => true
3630 *
3631 * _.eq(object, other);
3632 * // => false
3633 *
3634 * _.eq('a', 'a');
3635 * // => true
3636 *
3637 * _.eq('a', Object('a'));
3638 * // => false
3639 *
3640 * _.eq(NaN, NaN);
3641 * // => true
3642 */
3643function eq(value, other) {
3644 return value === other || (value !== value && other !== other);
3645}
3646
3647/**
3648 * Checks if `value` is likely an `arguments` object.
3649 *
3650 * @static
3651 * @memberOf _
3652 * @since 0.1.0
3653 * @category Lang
3654 * @param {*} value The value to check.
3655 * @returns {boolean} Returns `true` if `value` is an `arguments` object,
3656 * else `false`.
3657 * @example
3658 *
3659 * _.isArguments(function() { return arguments; }());
3660 * // => true
3661 *
3662 * _.isArguments([1, 2, 3]);
3663 * // => false
3664 */
3665function isArguments(value) {
3666 // Safari 8.1 makes `arguments.callee` enumerable in strict mode.
3667 return isArrayLikeObject(value) && hasOwnProperty.call(value, 'callee') &&
3668 (!propertyIsEnumerable.call(value, 'callee') || objectToString.call(value) == argsTag);
3669}
3670
3671/**
3672 * Checks if `value` is classified as an `Array` object.
3673 *
3674 * @static
3675 * @memberOf _
3676 * @since 0.1.0
3677 * @category Lang
3678 * @param {*} value The value to check.
3679 * @returns {boolean} Returns `true` if `value` is an array, else `false`.
3680 * @example
3681 *
3682 * _.isArray([1, 2, 3]);
3683 * // => true
3684 *
3685 * _.isArray(document.body.children);
3686 * // => false
3687 *
3688 * _.isArray('abc');
3689 * // => false
3690 *
3691 * _.isArray(_.noop);
3692 * // => false
3693 */
3694var isArray = Array.isArray;
3695
3696/**
3697 * Checks if `value` is array-like. A value is considered array-like if it's
3698 * not a function and has a `value.length` that's an integer greater than or
3699 * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
3700 *
3701 * @static
3702 * @memberOf _
3703 * @since 4.0.0
3704 * @category Lang
3705 * @param {*} value The value to check.
3706 * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
3707 * @example
3708 *
3709 * _.isArrayLike([1, 2, 3]);
3710 * // => true
3711 *
3712 * _.isArrayLike(document.body.children);
3713 * // => true
3714 *
3715 * _.isArrayLike('abc');
3716 * // => true
3717 *
3718 * _.isArrayLike(_.noop);
3719 * // => false
3720 */
3721function isArrayLike(value) {
3722 return value != null && isLength(value.length) && !isFunction(value);
3723}
3724
3725/**
3726 * This method is like `_.isArrayLike` except that it also checks if `value`
3727 * is an object.
3728 *
3729 * @static
3730 * @memberOf _
3731 * @since 4.0.0
3732 * @category Lang
3733 * @param {*} value The value to check.
3734 * @returns {boolean} Returns `true` if `value` is an array-like object,
3735 * else `false`.
3736 * @example
3737 *
3738 * _.isArrayLikeObject([1, 2, 3]);
3739 * // => true
3740 *
3741 * _.isArrayLikeObject(document.body.children);
3742 * // => true
3743 *
3744 * _.isArrayLikeObject('abc');
3745 * // => false
3746 *
3747 * _.isArrayLikeObject(_.noop);
3748 * // => false
3749 */
3750function isArrayLikeObject(value) {
3751 return isObjectLike(value) && isArrayLike(value);
3752}
3753
3754/**
3755 * Checks if `value` is classified as a `Function` object.
3756 *
3757 * @static
3758 * @memberOf _
3759 * @since 0.1.0
3760 * @category Lang
3761 * @param {*} value The value to check.
3762 * @returns {boolean} Returns `true` if `value` is a function, else `false`.
3763 * @example
3764 *
3765 * _.isFunction(_);
3766 * // => true
3767 *
3768 * _.isFunction(/abc/);
3769 * // => false
3770 */
3771function isFunction(value) {
3772 // The use of `Object#toString` avoids issues with the `typeof` operator
3773 // in Safari 8-9 which returns 'object' for typed array and other constructors.
3774 var tag = isObject(value) ? objectToString.call(value) : '';
3775 return tag == funcTag || tag == genTag;
3776}
3777
3778/**
3779 * Checks if `value` is a valid array-like length.
3780 *
3781 * **Note:** This method is loosely based on
3782 * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
3783 *
3784 * @static
3785 * @memberOf _
3786 * @since 4.0.0
3787 * @category Lang
3788 * @param {*} value The value to check.
3789 * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
3790 * @example
3791 *
3792 * _.isLength(3);
3793 * // => true
3794 *
3795 * _.isLength(Number.MIN_VALUE);
3796 * // => false
3797 *
3798 * _.isLength(Infinity);
3799 * // => false
3800 *
3801 * _.isLength('3');
3802 * // => false
3803 */
3804function isLength(value) {
3805 return typeof value == 'number' &&
3806 value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
3807}
3808
3809/**
3810 * Checks if `value` is the
3811 * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
3812 * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
3813 *
3814 * @static
3815 * @memberOf _
3816 * @since 0.1.0
3817 * @category Lang
3818 * @param {*} value The value to check.
3819 * @returns {boolean} Returns `true` if `value` is an object, else `false`.
3820 * @example
3821 *
3822 * _.isObject({});
3823 * // => true
3824 *
3825 * _.isObject([1, 2, 3]);
3826 * // => true
3827 *
3828 * _.isObject(_.noop);
3829 * // => true
3830 *
3831 * _.isObject(null);
3832 * // => false
3833 */
3834function isObject(value) {
3835 var type = typeof value;
3836 return !!value && (type == 'object' || type == 'function');
3837}
3838
3839/**
3840 * Checks if `value` is object-like. A value is object-like if it's not `null`
3841 * and has a `typeof` result of "object".
3842 *
3843 * @static
3844 * @memberOf _
3845 * @since 4.0.0
3846 * @category Lang
3847 * @param {*} value The value to check.
3848 * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
3849 * @example
3850 *
3851 * _.isObjectLike({});
3852 * // => true
3853 *
3854 * _.isObjectLike([1, 2, 3]);
3855 * // => true
3856 *
3857 * _.isObjectLike(_.noop);
3858 * // => false
3859 *
3860 * _.isObjectLike(null);
3861 * // => false
3862 */
3863function isObjectLike(value) {
3864 return !!value && typeof value == 'object';
3865}
3866
3867/**
3868 * Checks if `value` is classified as a `Symbol` primitive or object.
3869 *
3870 * @static
3871 * @memberOf _
3872 * @since 4.0.0
3873 * @category Lang
3874 * @param {*} value The value to check.
3875 * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
3876 * @example
3877 *
3878 * _.isSymbol(Symbol.iterator);
3879 * // => true
3880 *
3881 * _.isSymbol('abc');
3882 * // => false
3883 */
3884function isSymbol(value) {
3885 return typeof value == 'symbol' ||
3886 (isObjectLike(value) && objectToString.call(value) == symbolTag);
3887}
3888
3889/**
3890 * Checks if `value` is classified as a typed array.
3891 *
3892 * @static
3893 * @memberOf _
3894 * @since 3.0.0
3895 * @category Lang
3896 * @param {*} value The value to check.
3897 * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
3898 * @example
3899 *
3900 * _.isTypedArray(new Uint8Array);
3901 * // => true
3902 *
3903 * _.isTypedArray([]);
3904 * // => false
3905 */
3906var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
3907
3908/**
3909 * Converts `value` to a string. An empty string is returned for `null`
3910 * and `undefined` values. The sign of `-0` is preserved.
3911 *
3912 * @static
3913 * @memberOf _
3914 * @since 4.0.0
3915 * @category Lang
3916 * @param {*} value The value to process.
3917 * @returns {string} Returns the string.
3918 * @example
3919 *
3920 * _.toString(null);
3921 * // => ''
3922 *
3923 * _.toString(-0);
3924 * // => '-0'
3925 *
3926 * _.toString([1, 2, 3]);
3927 * // => '1,2,3'
3928 */
3929function toString(value) {
3930 return value == null ? '' : baseToString(value);
3931}
3932
3933/**
3934 * Gets the value at `path` of `object`. If the resolved value is
3935 * `undefined`, the `defaultValue` is returned in its place.
3936 *
3937 * @static
3938 * @memberOf _
3939 * @since 3.7.0
3940 * @category Object
3941 * @param {Object} object The object to query.
3942 * @param {Array|string} path The path of the property to get.
3943 * @param {*} [defaultValue] The value returned for `undefined` resolved values.
3944 * @returns {*} Returns the resolved value.
3945 * @example
3946 *
3947 * var object = { 'a': [{ 'b': { 'c': 3 } }] };
3948 *
3949 * _.get(object, 'a[0].b.c');
3950 * // => 3
3951 *
3952 * _.get(object, ['a', '0', 'b', 'c']);
3953 * // => 3
3954 *
3955 * _.get(object, 'a.b.c', 'default');
3956 * // => 'default'
3957 */
3958function get(object, path, defaultValue) {
3959 var result = object == null ? undefined : baseGet(object, path);
3960 return result === undefined ? defaultValue : result;
3961}
3962
3963/**
3964 * Checks if `path` is a direct or inherited property of `object`.
3965 *
3966 * @static
3967 * @memberOf _
3968 * @since 4.0.0
3969 * @category Object
3970 * @param {Object} object The object to query.
3971 * @param {Array|string} path The path to check.
3972 * @returns {boolean} Returns `true` if `path` exists, else `false`.
3973 * @example
3974 *
3975 * var object = _.create({ 'a': _.create({ 'b': 2 }) });
3976 *
3977 * _.hasIn(object, 'a');
3978 * // => true
3979 *
3980 * _.hasIn(object, 'a.b');
3981 * // => true
3982 *
3983 * _.hasIn(object, ['a', 'b']);
3984 * // => true
3985 *
3986 * _.hasIn(object, 'b');
3987 * // => false
3988 */
3989function hasIn(object, path) {
3990 return object != null && hasPath(object, path, baseHasIn);
3991}
3992
3993/**
3994 * Creates an array of the own enumerable property names of `object`.
3995 *
3996 * **Note:** Non-object values are coerced to objects. See the
3997 * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
3998 * for more details.
3999 *
4000 * @static
4001 * @since 0.1.0
4002 * @memberOf _
4003 * @category Object
4004 * @param {Object} object The object to query.
4005 * @returns {Array} Returns the array of property names.
4006 * @example
4007 *
4008 * function Foo() {
4009 * this.a = 1;
4010 * this.b = 2;
4011 * }
4012 *
4013 * Foo.prototype.c = 3;
4014 *
4015 * _.keys(new Foo);
4016 * // => ['a', 'b'] (iteration order is not guaranteed)
4017 *
4018 * _.keys('hi');
4019 * // => ['0', '1']
4020 */
4021function keys(object) {
4022 return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
4023}
4024
4025/**
4026 * This method returns the first argument it receives.
4027 *
4028 * @static
4029 * @since 0.1.0
4030 * @memberOf _
4031 * @category Util
4032 * @param {*} value Any value.
4033 * @returns {*} Returns `value`.
4034 * @example
4035 *
4036 * var object = { 'a': 1 };
4037 *
4038 * console.log(_.identity(object) === object);
4039 * // => true
4040 */
4041function identity(value) {
4042 return value;
4043}
4044
4045/**
4046 * This method returns `undefined`.
4047 *
4048 * @static
4049 * @memberOf _
4050 * @since 2.3.0
4051 * @category Util
4052 * @example
4053 *
4054 * _.times(2, _.noop);
4055 * // => [undefined, undefined]
4056 */
4057function noop() {
4058 // No operation performed.
4059}
4060
4061/**
4062 * Creates a function that returns the value at `path` of a given object.
4063 *
4064 * @static
4065 * @memberOf _
4066 * @since 2.4.0
4067 * @category Util
4068 * @param {Array|string} path The path of the property to get.
4069 * @returns {Function} Returns the new accessor function.
4070 * @example
4071 *
4072 * var objects = [
4073 * { 'a': { 'b': 2 } },
4074 * { 'a': { 'b': 1 } }
4075 * ];
4076 *
4077 * _.map(objects, _.property('a.b'));
4078 * // => [2, 1]
4079 *
4080 * _.map(_.sortBy(objects, _.property(['a', 'b'])), 'a.b');
4081 * // => [1, 2]
4082 */
4083function property(path) {
4084 return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path);
4085}
4086
4087module.exports = uniqBy;
4088
4089}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
4090},{}],5:[function(require,module,exports){
4091(function (global){
4092/**
4093 * lodash (Custom Build) <https://lodash.com/>
4094 * Build: `lodash modularize exports="npm" -o ./`
4095 * Copyright jQuery Foundation and other contributors <https://jquery.org/>
4096 * Released under MIT license <https://lodash.com/license>
4097 * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
4098 * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
4099 */
4100
4101/** Used as references for various `Number` constants. */
4102var INFINITY = 1 / 0;
4103
4104/** `Object#toString` result references. */
4105var symbolTag = '[object Symbol]';
4106
4107/** Detect free variable `global` from Node.js. */
4108var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
4109
4110/** Detect free variable `self`. */
4111var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
4112
4113/** Used as a reference to the global object. */
4114var root = freeGlobal || freeSelf || Function('return this')();
4115
4116/** Used for built-in method references. */
4117var objectProto = Object.prototype;
4118
4119/** Used to generate unique IDs. */
4120var idCounter = 0;
4121
4122/**
4123 * Used to resolve the
4124 * [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
4125 * of values.
4126 */
4127var objectToString = objectProto.toString;
4128
4129/** Built-in value references. */
4130var Symbol = root.Symbol;
4131
4132/** Used to convert symbols to primitives and strings. */
4133var symbolProto = Symbol ? Symbol.prototype : undefined,
4134 symbolToString = symbolProto ? symbolProto.toString : undefined;
4135
4136/**
4137 * The base implementation of `_.toString` which doesn't convert nullish
4138 * values to empty strings.
4139 *
4140 * @private
4141 * @param {*} value The value to process.
4142 * @returns {string} Returns the string.
4143 */
4144function baseToString(value) {
4145 // Exit early for strings to avoid a performance hit in some environments.
4146 if (typeof value == 'string') {
4147 return value;
4148 }
4149 if (isSymbol(value)) {
4150 return symbolToString ? symbolToString.call(value) : '';
4151 }
4152 var result = (value + '');
4153 return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
4154}
4155
4156/**
4157 * Checks if `value` is object-like. A value is object-like if it's not `null`
4158 * and has a `typeof` result of "object".
4159 *
4160 * @static
4161 * @memberOf _
4162 * @since 4.0.0
4163 * @category Lang
4164 * @param {*} value The value to check.
4165 * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
4166 * @example
4167 *
4168 * _.isObjectLike({});
4169 * // => true
4170 *
4171 * _.isObjectLike([1, 2, 3]);
4172 * // => true
4173 *
4174 * _.isObjectLike(_.noop);
4175 * // => false
4176 *
4177 * _.isObjectLike(null);
4178 * // => false
4179 */
4180function isObjectLike(value) {
4181 return !!value && typeof value == 'object';
4182}
4183
4184/**
4185 * Checks if `value` is classified as a `Symbol` primitive or object.
4186 *
4187 * @static
4188 * @memberOf _
4189 * @since 4.0.0
4190 * @category Lang
4191 * @param {*} value The value to check.
4192 * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
4193 * @example
4194 *
4195 * _.isSymbol(Symbol.iterator);
4196 * // => true
4197 *
4198 * _.isSymbol('abc');
4199 * // => false
4200 */
4201function isSymbol(value) {
4202 return typeof value == 'symbol' ||
4203 (isObjectLike(value) && objectToString.call(value) == symbolTag);
4204}
4205
4206/**
4207 * Converts `value` to a string. An empty string is returned for `null`
4208 * and `undefined` values. The sign of `-0` is preserved.
4209 *
4210 * @static
4211 * @memberOf _
4212 * @since 4.0.0
4213 * @category Lang
4214 * @param {*} value The value to process.
4215 * @returns {string} Returns the string.
4216 * @example
4217 *
4218 * _.toString(null);
4219 * // => ''
4220 *
4221 * _.toString(-0);
4222 * // => '-0'
4223 *
4224 * _.toString([1, 2, 3]);
4225 * // => '1,2,3'
4226 */
4227function toString(value) {
4228 return value == null ? '' : baseToString(value);
4229}
4230
4231/**
4232 * Generates a unique ID. If `prefix` is given, the ID is appended to it.
4233 *
4234 * @static
4235 * @since 0.1.0
4236 * @memberOf _
4237 * @category Util
4238 * @param {string} [prefix=''] The value to prefix the ID with.
4239 * @returns {string} Returns the unique ID.
4240 * @example
4241 *
4242 * _.uniqueId('contact_');
4243 * // => 'contact_104'
4244 *
4245 * _.uniqueId();
4246 * // => '105'
4247 */
4248function uniqueId(prefix) {
4249 var id = ++idCounter;
4250 return toString(prefix) + id;
4251}
4252
4253module.exports = uniqueId;
4254
4255}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
4256},{}],6:[function(require,module,exports){
4257'use strict';
4258module.exports = Number.isNaN || function (x) {
4259 return x !== x;
4260};
4261
4262},{}],7:[function(require,module,exports){
4263/**
4264 * @param {Object} obj
4265 * @returns {Function}
4266 */
4267
4268function staticProps (obj) {
4269 /**
4270 * @param {Object} props
4271 * @param {Boolean} [enumerable]
4272 */
4273 return function (props, enumerable) {
4274 var staticProps = {}
4275
4276 for (var propName in props) {
4277 var staticProp = {
4278 configurable: false,
4279 enumerable: enumerable
4280 }
4281 var prop = props[propName]
4282
4283 if (typeof prop === 'function') staticProp.get = prop
4284 else {
4285 staticProp.value = prop
4286
4287 staticProp.writable = false
4288 }
4289
4290 staticProps[propName] = staticProp
4291 }
4292 Object.defineProperties(obj, staticProps)
4293 }
4294}
4295module.exports = staticProps
4296
4297},{}],8:[function(require,module,exports){
4298// In browserify context, *strict-mode* fall back to a no op.
4299module.exports = function (cb) { cb() }
4300
4301},{}],9:[function(require,module,exports){
4302'use strict';
4303
4304var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
4305
4306function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
4307
4308var isequal = require('lodash.isequal');
4309var isInteger = require('is-integer');
4310var uniqueid = require('lodash.uniqueid');
4311var uniqby = require('lodash.uniqby');
4312var staticProps = require('static-props');
4313
4314var getDegree = require('./getDegree');
4315var getIncidentEdgeIds = require('./getIncidentEdgeIds');
4316var _getRank = require('./getRank');
4317
4318/**
4319 * Hypergraph
4320 *
4321 * http://en.wikipedia.org/wiki/Hypergraph
4322 *
4323 * @param {Object} [graph]
4324 * @param {Object} [graph.edges]
4325 * @param {Object} [graph.nodes]
4326 * @param {Boolean} [graph.multigraph] can contain duplicated edges
4327 * @param {Boolean} [graph.pseudograph] is a multigraph with loops allowed
4328 * @param {Number} [graph.uniform] all edges has the same cardinality (i.e. number of nodes)
4329 *
4330 * @class
4331 */
4332
4333// TODO add options like
4334// * rank, maxDegree, etc
4335// if it is directed, an a -> b edge is different from b -> a
4336
4337var Graph = function () {
4338 function Graph() {
4339 _classCallCheck(this, Graph);
4340
4341 var arg = arguments[0] || {};
4342 var obj = {};
4343
4344 if (isInteger(arg.uniform)) {
4345 if (arg.uniform < 2) {
4346 throw new TypeError('Argument uniform cannot be less than 2');
4347 } else {
4348 obj.uniform = arg.uniform;
4349 }
4350 }
4351
4352 if (arg.multigraph === true) obj.multigraph = true;
4353
4354 if (arg.pseudograph === true) {
4355 obj.multigraph = true;
4356 obj.pseudograph = true;
4357 }
4358
4359 obj.edges = arg.edges || {};
4360 obj.nodes = arg.nodes || {};
4361
4362 var enumerable = true;
4363 staticProps(this)(obj, enumerable);
4364 }
4365
4366 /**
4367 * Add an hyperedge that connects given nodeIds.
4368 *
4369 * @param {Array} nodeIds
4370 * @returns {String} id
4371 */
4372
4373 _createClass(Graph, [{
4374 key: 'addEdge',
4375 value: function addEdge(nodeIds) {
4376 var _this = this;
4377
4378 if (nodeIds.length < 2) {
4379 throw new Error('An edge must point at two or more nodes');
4380 }
4381
4382 var uniform = this.uniform;
4383
4384 if (uniform) {
4385 var cardinality = nodeIds.length;
4386
4387 if (uniform !== cardinality) {
4388 throw new Error('Cannot add an edge with cardinality ' + cardinality + ' to a ' + uniform + '-uniform graph');
4389 }
4390 }
4391
4392 if (!this.pseudograph) {
4393 if (uniqby(nodeIds).length < nodeIds.length) {
4394 throw new Error('This is not a pseudograph, it is not allowed to create loops');
4395 }
4396 }
4397
4398 if (!this.multigraph) {
4399 for (var edgeId in this.edges) {
4400 var edge = this.edges[edgeId];
4401
4402 if (isequal(nodeIds, edge)) {
4403 throw new Error('This is not a multigraph, you cannot add duplicated edges');
4404 }
4405 }
4406 }
4407
4408 var nodeIdsNotFound = nodeIds.filter(function (id) {
4409 return !_this.nodes.hasOwnProperty(id);
4410 });
4411
4412 if (nodeIdsNotFound.length > 0) {
4413 throw new Error('Edge points to some nodeId not found in this graph; ' + nodeIdsNotFound.join(','));
4414 }
4415
4416 var id = uniqueid();
4417
4418 this.edges[id] = nodeIds;
4419
4420 return id;
4421 }
4422
4423 /**
4424 * Add a node, containing given data.
4425 *
4426 * @param {*} data
4427 * @returns {String} id of the node created
4428 */
4429
4430 }, {
4431 key: 'addNode',
4432 value: function addNode(data) {
4433 var id = uniqueid();
4434
4435 this.nodes[id] = data;
4436
4437 return id;
4438 }
4439
4440 /**
4441 * Returns the degree of a node, that is the number of incident edges with loops counted twice.
4442 *
4443 * @param {String} nodeId
4444 * @returns {Number} degree
4445 */
4446
4447 }, {
4448 key: 'degreeOf',
4449 value: function degreeOf(nodeId) {
4450 return getDegree(this.edges, nodeId);
4451 }
4452
4453 /**
4454 * Delete edge by given id.
4455 *
4456 * @param {String} id
4457 * @returns {void}
4458 */
4459
4460 }, {
4461 key: 'delEdge',
4462 value: function delEdge(id) {
4463 delete this.edges[id];
4464 }
4465
4466 /**
4467 * Delete node by given id.
4468 *
4469 * @param {String} id
4470 * @returns {void}
4471 */
4472
4473 }, {
4474 key: 'delNode',
4475 value: function delNode(id) {
4476 delete this.nodes[id];
4477
4478 var incidentEdgeIds = getIncidentEdgeIds(this.edges, id);
4479
4480 // TODO in an hypergraph it should not remove the edge, but
4481 // remove the nodeIds from edges. and remove the edge if it is empty.
4482 // Document in the README and the jsdoc above that it removes also edges
4483 for (var edgeId in incidentEdgeIds) {
4484 this.delEdge(edgeId);
4485 }
4486 }
4487
4488 /**
4489 * Returns the max cardinality of any of the edges in the hypergraph.
4490 *
4491 * @returns {Number} rank
4492 */
4493
4494 }, {
4495 key: 'getRank',
4496 value: function getRank() {
4497 if (this.uniform) return this.uniform;
4498
4499 return _getRank(this.edges);
4500 }
4501 }]);
4502
4503 return Graph;
4504}();
4505
4506module.exports = Graph;
4507
4508},{"./getDegree":10,"./getIncidentEdgeIds":11,"./getRank":12,"is-integer":2,"lodash.isequal":3,"lodash.uniqby":4,"lodash.uniqueid":5,"static-props":7}],10:[function(require,module,exports){
4509"use strict";
4510
4511/**
4512 * The degree of a vertex is the number of incident edges, with loops counted twice.
4513 *
4514 * http://en.wikipedia.org/wiki/Degree_(graph_theory)
4515 *
4516 * @param {Object} edges
4517 * @param {String} nodeId
4518 * @returns {Number} degree
4519 */
4520
4521var getDegree = function getDegree(edges, nodeId) {
4522 var degree = 0;
4523
4524 var countIncidents = function countIncidents(id) {
4525 if (id === nodeId) {
4526 degree++;
4527 }
4528 };
4529
4530 for (var edgeId in edges) {
4531 var edge = edges[edgeId];
4532
4533 edge.forEach(countIncidents);
4534 }
4535
4536 return degree;
4537};
4538
4539module.exports = getDegree;
4540
4541},{}],11:[function(require,module,exports){
4542"use strict";
4543
4544/**
4545 * Edges incident to given node
4546 *
4547 * @param {Object} edges
4548 * @param {String} nodeId
4549 * @returns {Array} incidentEdgeIds
4550 */
4551
4552var getIncidentEdgeIds = function getIncidentEdgeIds(edges, nodeId) {
4553 var incidentEdgeIds = [];
4554
4555 var pushUniqueIncidents = function pushUniqueIncidents(edgeId, nodeId, id) {
4556 var isIncident = id === nodeId;
4557 var isUnique = incidentEdgeIds.indexOf(edgeId) < 0;
4558
4559 if (isIncident && isUnique) {
4560 incidentEdgeIds.push(edgeId);
4561 }
4562 };
4563
4564 for (var edgeId in edges) {
4565 var edge = edges[edgeId];
4566
4567 edge.forEach(pushUniqueIncidents.bind(null, edgeId, nodeId));
4568 }
4569
4570 return incidentEdgeIds;
4571};
4572
4573module.exports = getIncidentEdgeIds;
4574
4575},{}],12:[function(require,module,exports){
4576"use strict";
4577
4578/**
4579 The rank is the maximum cardinality of any of the edges in the hypergraph
4580 *
4581 * @params {Object} edges
4582 * @returns {Number} rank
4583 */
4584
4585var getRank = function getRank(edges) {
4586 var rank = 0;
4587
4588 for (var edgeId in edges) {
4589 var edge = edges[edgeId];
4590 rank = Math.max(rank, edge.length);
4591 }
4592
4593 return rank;
4594};
4595
4596module.exports = getRank;
4597
4598},{}],"iper":[function(require,module,exports){
4599'use strict';
4600
4601require('strict-mode')(function () {
4602 exports.Graph = require('./Graph');
4603});
4604
4605},{"./Graph":9,"strict-mode":8}]},{},[]);