16 var VERSION =
'4.17.4';
19 var FUNC_ERROR_TEXT =
'Expected a function';
22 var COMPARE_PARTIAL_FLAG = 1,
23 COMPARE_UNORDERED_FLAG = 2;
26 var WRAP_BIND_FLAG = 1,
27 WRAP_PARTIAL_FLAG = 32;
31 MAX_SAFE_INTEGER = 9007199254740991;
34 var argsTag =
'[object Arguments]',
35 arrayTag =
'[object Array]',
36 asyncTag =
'[object AsyncFunction]',
37 boolTag =
'[object Boolean]',
38 dateTag =
'[object Date]',
39 errorTag =
'[object Error]',
40 funcTag =
'[object Function]',
41 genTag =
'[object GeneratorFunction]',
42 numberTag =
'[object Number]',
43 objectTag =
'[object Object]',
44 proxyTag =
'[object Proxy]',
45 regexpTag =
'[object RegExp]',
46 stringTag =
'[object String]';
49 var reUnescapedHtml = /[&<>
"']/g,
50 reHasUnescapedHtml = RegExp(reUnescapedHtml.source);
62 var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
65 var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
68 var root = freeGlobal || freeSelf || Function('return this')();
71 var freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;
74 var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;
76 /*--------------------------------------------------------------------------*/
86 function arrayPush(array, values) {
87 array.push.apply(array, values);
102 function baseFindIndex(array, predicate, fromIndex, fromRight) {
103 var length = array.length,
104 index = fromIndex + (fromRight ? 1 : -1);
106 while ((fromRight ? index-- : ++index < length)) {
107 if (predicate(array[index], index, array)) {
121 function baseProperty(key) {
122 return function(object) {
123 return object == null ? undefined : object[key];
134 function basePropertyOf(object) {
135 return function(key) {
136 return object == null ? undefined : object[key];
153 function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) {
154 eachFunc(collection, function(value, index, collection) {
155 accumulator = initAccum
156 ? (initAccum = false, value)
157 : iteratee(accumulator, value, index, collection);
172 function baseValues(object, props) {
173 return baseMap(props, function(key) {
185 var escapeHtmlChar = basePropertyOf(htmlEscapes);
195 function overArg(func, transform) {
196 return function(arg) {
197 return func(transform(arg));
201 /*--------------------------------------------------------------------------*/
204 var arrayProto = Array.prototype,
205 objectProto = Object.prototype;
208 var hasOwnProperty = objectProto.hasOwnProperty;
218 var nativeObjectToString = objectProto.toString;
221 var oldDash = root._;
224 var objectCreate = Object.create,
225 propertyIsEnumerable = objectProto.propertyIsEnumerable;
227 /* Built-in method references for those with the same name as other `lodash` methods. */
228 var nativeIsFinite = root.isFinite,
229 nativeKeys = overArg(Object.keys, Object),
230 nativeMax = Math.max;
232 /*------------------------------------------------------------------------*/
351 function lodash(value) {
352 return value instanceof LodashWrapper
354 : new LodashWrapper(value);
365 var baseCreate = (function() {
367 return function(proto) {
368 if (!isObject(proto)) {
372 return objectCreate(proto);
374 object.prototype = proto;
375 var result = new object;
376 object.prototype = undefined;
388 function LodashWrapper(value, chainAll) {
389 this.__wrapped__ = value;
390 this.__actions__ = [];
391 this.__chain__ = !!chainAll;
394 LodashWrapper.prototype = baseCreate(lodash.prototype);
395 LodashWrapper.prototype.constructor = LodashWrapper;
397 /*------------------------------------------------------------------------*/
409 function assignValue(object, key, value) {
410 var objValue = object[key];
411 if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) ||
412 (value === undefined && !(key in object))) {
413 baseAssignValue(object, key, value);
426 function baseAssignValue(object, key, value) {
440 function baseDelay(func, wait, args) {
441 if (typeof func != 'function') {
442 throw new TypeError(FUNC_ERROR_TEXT);
444 return setTimeout(function() { func.apply(undefined, args); }, wait);
455 var baseEach = createBaseEach(baseForOwn);
466 function baseEvery(collection, predicate) {
468 baseEach(collection, function(value, index, collection) {
469 result = !!predicate(value, index, collection);
485 function baseExtremum(array, iteratee, comparator) {
487 length = array.length;
489 while (++index < length) {
490 var value = array[index],
491 current = iteratee(value);
493 if (current != null && (computed === undefined
494 ? (current === current && !false)
495 : comparator(current, computed)
497 var computed = current,
512 function baseFilter(collection, predicate) {
514 baseEach(collection, function(value, index, collection) {
515 if (predicate(value, index, collection)) {
533 function baseFlatten(array, depth, predicate, isStrict, result) {
535 length = array.length;
537 predicate || (predicate = isFlattenable);
538 result || (result = []);
540 while (++index < length) {
541 var value = array[index];
542 if (depth > 0 && predicate(value)) {
544 // Recursively flatten arrays (susceptible to call stack limits).
545 baseFlatten(value, depth - 1, predicate, isStrict, result);
547 arrayPush(result, value);
549 } else if (!isStrict) {
550 result[result.length] = value;
567 var baseFor = createBaseFor();
577 function baseForOwn(object, iteratee) {
578 return object && baseFor(object, iteratee, keys);
590 function baseFunctions(object, props) {
591 return baseFilter(props, function(key) {
592 return isFunction(object[key]);
603 function baseGetTag(value) {
604 return objectToString(value);
616 function baseGt(value, other) {
617 return value > other;
627 var baseIsArguments = noop;
636 function baseIsDate(value) {
637 return isObjectLike(value) && baseGetTag(value) == dateTag;
654 function baseIsEqual(value, other, bitmask, customizer, stack) {
655 if (value === other) {
658 if (value == null || other == null || (!isObjectLike(value) && !isObjectLike(other))) {
659 return value !== value && other !== other;
661 return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
678 function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
679 var objIsArr = isArray(object),
680 othIsArr = isArray(other),
681 objTag = objIsArr ? arrayTag : baseGetTag(object),
682 othTag = othIsArr ? arrayTag : baseGetTag(other);
684 objTag = objTag == argsTag ? objectTag : objTag;
685 othTag = othTag == argsTag ? objectTag : othTag;
687 var objIsObj = objTag == objectTag,
688 othIsObj = othTag == objectTag,
689 isSameTag = objTag == othTag;
691 stack || (stack = []);
692 var objStack = find(stack, function(entry) {
693 return entry[0] == object;
695 var othStack = find(stack, function(entry) {
696 return entry[0] == other;
698 if (objStack && othStack) {
699 return objStack[1] == other;
701 stack.push([object, other]);
702 stack.push([other, object]);
703 if (isSameTag && !objIsObj) {
704 var result = (objIsArr)
705 ? equalArrays(object, other, bitmask, customizer, equalFunc, stack)
706 : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
710 if (!(bitmask & COMPARE_PARTIAL_FLAG)) {
711 var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),
712 othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');
714 if (objIsWrapped || othIsWrapped) {
715 var objUnwrapped = objIsWrapped ? object.value() : object,
716 othUnwrapped = othIsWrapped ? other.value() : other;
718 var result = equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
726 var result = equalObjects(object, other, bitmask, customizer, equalFunc, stack);
738 function baseIsRegExp(value) {
739 return isObjectLike(value) && baseGetTag(value) == regexpTag;
749 function baseIteratee(func) {
750 if (typeof func == 'function') {
756 return (typeof func == 'object' ? baseMatches : baseProperty)(func);
768 function baseLt(value, other) {
769 return value < other;
780 function baseMap(collection, iteratee) {
782 result = isArrayLike(collection) ? Array(collection.length) : [];
784 baseEach(collection, function(value, key, collection) {
785 result[++index] = iteratee(value, key, collection);
797 function baseMatches(source) {
798 var props = nativeKeys(source);
799 return function(object) {
800 var length = props.length;
801 if (object == null) {
804 object = Object(object);
806 var key = props[length];
807 if (!(key in object &&
808 baseIsEqual(source[key], object[key], COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG)
826 function basePick(object, props) {
827 object = Object(object);
828 return reduce(props, function(result, key) {
830 result[key] = object[key];
844 function baseRest(func, start) {
845 return setToString(overRest(func, start, identity), func + '');
857 function baseSlice(array, start, end) {
859 length = array.length;
862 start = -start > length ? 0 : (length + start);
864 end = end > length ? length : end;
868 length = start > end ? 0 : ((end - start) >>> 0);
871 var result = Array(length);
872 while (++index < length) {
873 result[index] = array[index + start];
886 function copyArray(source) {
887 return baseSlice(source, 0, source.length);
899 function baseSome(collection, predicate) {
902 baseEach(collection, function(value, index, collection) {
903 result = predicate(value, index, collection);
919 function baseWrapperValue(value, actions) {
921 return reduce(actions, function(result, action) {
922 return action.func.apply(action.thisArg, arrayPush([result], action.args));
934 function compareAscending(value, other) {
935 if (value !== other) {
936 var valIsDefined = value !== undefined,
937 valIsNull = value === null,
938 valIsReflexive = value === value,
941 var othIsDefined = other !== undefined,
942 othIsNull = other === null,
943 othIsReflexive = other === other,
946 if ((!othIsNull && !othIsSymbol && !valIsSymbol && value > other) ||
947 (valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol) ||
948 (valIsNull && othIsDefined && othIsReflexive) ||
949 (!valIsDefined && othIsReflexive) ||
953 if ((!valIsNull && !valIsSymbol && !othIsSymbol && value < other) ||
954 (othIsSymbol && valIsDefined && valIsReflexive && !valIsNull && !valIsSymbol) ||
955 (othIsNull && valIsDefined && valIsReflexive) ||
956 (!othIsDefined && valIsReflexive) ||
974 function copyObject(source, props, object, customizer) {
976 object || (object = {});
979 length = props.length;
981 while (++index < length) {
982 var key = props[index];
984 var newValue = customizer
985 ? customizer(object[key], source[key], key, object, source)
988 if (newValue === undefined) {
989 newValue = source[key];
992 baseAssignValue(object, key, newValue);
994 assignValue(object, key, newValue);
1007 function createAssigner(assigner) {
1008 return baseRest(function(object, sources) {
1010 length = sources.length,
1011 customizer = length > 1 ? sources[length - 1] : undefined;
1013 customizer = (assigner.length > 3 && typeof customizer == 'function')
1014 ? (length--, customizer)
1017 object = Object(object);
1018 while (++index < length) {
1019 var source = sources[index];
1021 assigner(object, source, index, customizer);
1036 function createBaseEach(eachFunc, fromRight) {
1037 return function(collection, iteratee) {
1038 if (collection == null) {
1041 if (!isArrayLike(collection)) {
1042 return eachFunc(collection, iteratee);
1044 var length = collection.length,
1045 index = fromRight ? length : -1,
1046 iterable = Object(collection);
1048 while ((fromRight ? index-- : ++index < length)) {
1049 if (iteratee(iterable[index], index, iterable) === false) {
1064 function createBaseFor(fromRight) {
1065 return function(object, iteratee, keysFunc) {
1067 iterable = Object(object),
1068 props = keysFunc(object),
1069 length = props.length;
1072 var key = props[fromRight ? length : ++index];
1073 if (iteratee(iterable[key], key, iterable) === false) {
1089 function createCtor(Ctor) {
1091 // Use a `switch` statement to work with class constructors. See
1092 // http://ecma-international.org/ecma-262/7.0/#sec-ecmascript-function-objects-call-thisargument-argumentslist
1093 // for more details.
1094 var args = arguments;
1095 var thisBinding = baseCreate(Ctor.prototype),
1096 result = Ctor.apply(thisBinding, args);
1098 // Mimic the constructor's `return` behavior.
1099 // See https://es5.github.io/#x13.2.2 for more details.
1100 return isObject(result) ? result : thisBinding;
1111 function createFind(findIndexFunc) {
1112 return function(collection, predicate, fromIndex) {
1113 var iterable = Object(collection);
1114 if (!isArrayLike(collection)) {
1115 var iteratee = baseIteratee(predicate, 3);
1116 collection = keys(collection);
1117 predicate = function(key) { return iteratee(iterable[key], key, iterable); };
1119 var index = findIndexFunc(collection, predicate, fromIndex);
1120 return index > -1 ? iterable[iteratee ? collection[index] : index] : undefined;
1136 function createPartial(func, bitmask, thisArg, partials) {
1137 if (typeof func != 'function') {
1138 throw new TypeError(FUNC_ERROR_TEXT);
1140 var isBind = bitmask & WRAP_BIND_FLAG,
1141 Ctor = createCtor(func);
1143 function wrapper() {
1145 argsLength = arguments.length,
1147 leftLength = partials.length,
1148 args = Array(leftLength + argsLength),
1149 fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
1151 while (++leftIndex < leftLength) {
1152 args[leftIndex] = partials[leftIndex];
1154 while (argsLength--) {
1155 args[leftIndex++] = arguments[++argsIndex];
1157 return fn.apply(isBind ? thisArg : this, args);
1174 function customDefaultsAssignIn(objValue, srcValue, key, object) {
1175 if (objValue === undefined ||
1176 (eq(objValue, objectProto[key]) && !hasOwnProperty.call(object, key))) {
1195 function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
1196 var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
1197 arrLength = array.length,
1198 othLength = other.length;
1200 if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
1205 seen = (bitmask & COMPARE_UNORDERED_FLAG) ? [] : undefined;
1207 // Ignore non-index properties.
1208 while (++index < arrLength) {
1209 var arrValue = array[index],
1210 othValue = other[index];
1213 if (compared !== undefined) {
1220 // Recursively compare arrays (susceptible to call stack limits).
1222 if (!baseSome(other, function(othValue, othIndex) {
1223 if (!indexOf(seen, othIndex) &&
1224 (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
1225 return seen.push(othIndex);
1232 arrValue === othValue ||
1233 equalFunc(arrValue, othValue, bitmask, customizer, stack)
1259 function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
1265 // Coerce booleans to `1` or `0` and dates to milliseconds.
1266 // Invalid dates are coerced to `NaN`.
1267 return eq(+object, +other);
1270 return object.name == other.name && object.message == other.message;
1274 // Coerce regexes to strings and treat strings, primitives and objects,
1275 // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring
1276 // for more details.
1277 return object == (other + '');
1296 function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
1297 var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
1298 objProps = keys(object),
1299 objLength = objProps.length,
1300 othProps = keys(other),
1301 othLength = othProps.length;
1303 if (objLength != othLength && !isPartial) {
1306 var index = objLength;
1308 var key = objProps[index];
1309 if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) {
1315 var skipCtor = isPartial;
1316 while (++index < objLength) {
1317 key = objProps[index];
1318 var objValue = object[key],
1319 othValue = other[key];
1322 // Recursively compare objects (susceptible to call stack limits).
1323 if (!(compared === undefined
1324 ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack))
1330 skipCtor || (skipCtor = key == 'constructor');
1332 if (result && !skipCtor) {
1333 var objCtor = object.constructor,
1334 othCtor = other.constructor;
1336 // Non `Object` object instances with different constructors are not equal.
1337 if (objCtor != othCtor &&
1338 ('constructor' in object && 'constructor' in other) &&
1339 !(typeof objCtor == 'function' && objCtor instanceof objCtor &&
1340 typeof othCtor == 'function' && othCtor instanceof othCtor)) {
1354 function flatRest(func) {
1355 return setToString(overRest(func, undefined, flatten), func + '');
1365 function isFlattenable(value) {
1366 return isArray(value) || isArguments(value);
1378 function nativeKeysIn(object) {
1380 if (object != null) {
1381 for (var key in Object(object)) {
1395 function objectToString(value) {
1396 return nativeObjectToString.call(value);
1408 function overRest(func, start, transform) {
1409 start = nativeMax(start === undefined ? (func.length - 1) : start, 0);
1411 var args = arguments,
1413 length = nativeMax(args.length - start, 0),
1414 array = Array(length);
1416 while (++index < length) {
1417 array[index] = args[start + index];
1420 var otherArgs = Array(start + 1);
1421 while (++index < start) {
1422 otherArgs[index] = args[index];
1424 otherArgs[start] = transform(array);
1425 return func.apply(this, otherArgs);
1437 var setToString = identity;
1439 /*------------------------------------------------------------------------*/
1456 function compact(array) {
1457 return baseFilter(array, Boolean);
1483 var length = arguments.length;
1487 var args = Array(length - 1),
1488 array = arguments[0],
1492 args[index - 1] = arguments[index];
1494 return arrayPush(isArray(array) ? copyArray(array) : [array], baseFlatten(args, 1));
1532 function findIndex(array, predicate, fromIndex) {
1533 var length = array == null ? 0 : array.length;
1537 var index = fromIndex == null ? 0 : toInteger(fromIndex);
1539 index = nativeMax(length + index, 0);
1541 return baseFindIndex(array, baseIteratee(predicate, 3), index);
1558 function flatten(array) {
1559 var length = array == null ? 0 : array.length;
1560 return length ? baseFlatten(array, 1) : [];
1577 function flattenDeep(array) {
1578 var length = array == null ? 0 : array.length;
1579 return length ? baseFlatten(array, INFINITY) : [];
1600 function head(array) {
1601 return (array && array.length) ? array[0] : undefined;
1627 function indexOf(array, value, fromIndex) {
1628 var length = array == null ? 0 : array.length;
1629 if (typeof fromIndex == 'number') {
1630 fromIndex = fromIndex < 0 ? nativeMax(length + fromIndex, 0) : fromIndex;
1634 var index = (fromIndex || 0) - 1,
1635 isReflexive = value === value;
1637 while (++index < length) {
1638 var other = array[index];
1639 if ((isReflexive ? other === value : other !== other)) {
1660 function last(array) {
1661 var length = array == null ? 0 : array.length;
1662 return length ? array[length - 1] : undefined;
1681 function slice(array, start, end) {
1682 var length = array == null ? 0 : array.length;
1683 start = start == null ? 0 : +start;
1684 end = end === undefined ? length : +end;
1685 return length ? baseSlice(array, start, end) : [];
1688 /*------------------------------------------------------------------------*/
1719 function chain(value) {
1720 var result = lodash(value);
1721 result.__chain__ = true;
1748 function tap(value, interceptor) {
1776 function thru(value, interceptor) {
1777 return interceptor(value);
1807 function wrapperChain() {
1825 function wrapperValue() {
1826 return baseWrapperValue(this.__wrapped__, this.__actions__);
1829 /*------------------------------------------------------------------------*/
1872 function every(collection, predicate, guard) {
1873 predicate = guard ? undefined : predicate;
1874 return baseEvery(collection, baseIteratee(predicate));
1914 function filter(collection, predicate) {
1915 return baseFilter(collection, baseIteratee(predicate));
1954 var find = createFind(findIndex);
1986 function forEach(collection, iteratee) {
1987 return baseEach(collection, baseIteratee(iteratee));
2032 function map(collection, iteratee) {
2033 return baseMap(collection, baseIteratee(iteratee));
2073 function reduce(collection, iteratee, accumulator) {
2074 return baseReduce(collection, baseIteratee(iteratee), accumulator, arguments.length < 3, baseEach);
2098 function size(collection) {
2099 if (collection == null) {
2102 collection = isArrayLike(collection) ? collection : nativeKeys(collection);
2103 return collection.length;
2142 function some(collection, predicate, guard) {
2143 predicate = guard ? undefined : predicate;
2144 return baseSome(collection, baseIteratee(predicate));
2176 function sortBy(collection, iteratee) {
2178 iteratee = baseIteratee(iteratee);
2180 return baseMap(baseMap(collection, function(value, key, collection) {
2181 return { 'value': value, 'index': index++, 'criteria': iteratee(value, key, collection) };
2182 }).sort(function(object, other) {
2183 return compareAscending(object.criteria, other.criteria) || (object.index - other.index);
2184 }), baseProperty('value'));
2187 /*------------------------------------------------------------------------*/
2206 function before(n, func) {
2208 if (typeof func != 'function') {
2209 throw new TypeError(FUNC_ERROR_TEXT);
2214 result = func.apply(this, arguments);
2258 var bind = baseRest(function(func, thisArg, partials) {
2259 return createPartial(func, WRAP_BIND_FLAG | WRAP_PARTIAL_FLAG, thisArg, partials);
2280 var defer = baseRest(function(func, args) {
2281 return baseDelay(func, 1, args);
2303 var delay = baseRest(function(func, wait, args) {
2304 return baseDelay(func, toNumber(wait) || 0, args);
2327 function negate(predicate) {
2328 if (typeof predicate != 'function') {
2329 throw new TypeError(FUNC_ERROR_TEXT);
2332 var args = arguments;
2333 return !predicate.apply(this, args);
2355 function once(func) {
2356 return before(2, func);
2359 /*------------------------------------------------------------------------*/
2387 function clone(value) {
2388 if (!isObject(value)) {
2391 return isArray(value) ? copyArray(value) : copyObject(value, nativeKeys(value));
2426 function eq(value, other) {
2427 return value === other || (value !== value && other !== other);
2448 var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {
2449 return isObjectLike(value) && hasOwnProperty.call(value, 'callee') &&
2450 !propertyIsEnumerable.call(value, 'callee');
2476 var isArray = Array.isArray;
2503 function isArrayLike(value) {
2504 return value != null && isLength(value.length) && !isFunction(value);
2524 function isBoolean(value) {
2525 return value === true || value === false ||
2526 (isObjectLike(value) && baseGetTag(value) == boolTag);
2546 var isDate = baseIsDate;
2581 function isEmpty(value) {
2582 if (isArrayLike(value) &&
2583 (isArray(value) || isString(value) ||
2584 isFunction(value.splice) || isArguments(value))) {
2585 return !value.length;
2587 return !nativeKeys(value).length;
2618 function isEqual(value, other) {
2619 return baseIsEqual(value, other);
2648 function isFinite(value) {
2649 return typeof value == 'number' && nativeIsFinite(value);
2669 function isFunction(value) {
2670 if (!isObject(value)) {
2673 // The use of `Object#toString` avoids issues with the `typeof` operator
2674 // in Safari 9 which returns 'object' for typed arrays and other constructors.
2675 var tag = baseGetTag(value);
2676 return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
2705 function isLength(value) {
2706 return typeof value == 'number' &&
2707 value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
2735 function isObject(value) {
2736 var type = typeof value;
2737 return value != null && (type == 'object' || type == 'function');
2764 function isObjectLike(value) {
2765 return value != null && typeof value == 'object';
2796 function isNaN(value) {
2797 // An `NaN` primitive is the only value that is not equal to itself.
2798 // Perform the `toStringTag` check first to avoid errors with some
2799 // ActiveX objects in IE.
2800 return isNumber(value) && value != +value;
2820 function isNull(value) {
2821 return value === null;
2850 function isNumber(value) {
2851 return typeof value == 'number' ||
2852 (isObjectLike(value) && baseGetTag(value) == numberTag);
2872 var isRegExp = baseIsRegExp;
2891 function isString(value) {
2892 return typeof value == 'string' ||
2893 (!isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag);
2913 function isUndefined(value) {
2914 return value === undefined;
2940 function toArray(value) {
2941 if (!isArrayLike(value)) {
2942 return values(value);
2944 return value.length ? copyArray(value) : [];
2973 var toInteger = Number;
2998 var toNumber = Number;
3021 function toString(value) {
3022 if (typeof value == 'string') {
3025 return value == null ? '' : (value + '');
3028 /*------------------------------------------------------------------------*/
3062 var assign = createAssigner(function(object, source) {
3063 copyObject(source, nativeKeys(source), object);
3097 var assignIn = createAssigner(function(object, source) {
3098 copyObject(source, nativeKeysIn(source), object);
3130 var assignInWith = createAssigner(function(object, source, srcIndex, customizer) {
3131 copyObject(source, keysIn(source), object, customizer);
3168 function create(prototype, properties) {
3169 var result = baseCreate(prototype);
3170 return properties == null ? result : assign(result, properties);
3194 var defaults = baseRest(function(args) {
3195 args.push(undefined, customDefaultsAssignIn);
3196 return assignInWith.apply(undefined, args);
3226 function has(object, path) {
3227 return object != null && hasOwnProperty.call(object, path);
3258 var keys = nativeKeys;
3283 var keysIn = nativeKeysIn;
3302 var pick = flatRest(function(object, paths) {
3303 return object == null ? {} : basePick(object, paths);
3335 function result(object, path, defaultValue) {
3336 var value = object == null ? undefined : object[path];
3337 if (value === undefined) {
3338 value = defaultValue;
3340 return isFunction(value) ? value.call(object) : value;
3369 function values(object) {
3370 return object == null ? [] : baseValues(object, keys(object));
3373 /*------------------------------------------------------------------------*/
3403 function escape(string) {
3404 string = toString(string);
3405 return (string && reHasUnescapedHtml.test(string))
3406 ? string.replace(reUnescapedHtml, escapeHtmlChar)
3410 /*------------------------------------------------------------------------*/
3428 function identity(value) {
3474 var iteratee = baseIteratee;
3504 function matches(source) {
3505 return baseMatches(assign({}, source));
3544 function mixin(object, source, options) {
3545 var props = keys(source),
3546 methodNames = baseFunctions(source, props);
3548 if (options == null &&
3549 !(isObject(source) && (methodNames.length || !props.length))) {
3553 methodNames = baseFunctions(source, keys(source));
3555 var chain = !(isObject(options) && 'chain' in options) || !!options.chain,
3556 isFunc = isFunction(object);
3558 baseEach(methodNames, function(methodName) {
3559 var func = source[methodName];
3560 object[methodName] = func;
3562 object.prototype[methodName] = function() {
3563 var chainAll = this.__chain__;
3564 if (chain || chainAll) {
3565 var result = object(this.__wrapped__),
3566 actions = result.__actions__ = copyArray(this.__actions__);
3568 actions.push({ 'func': func, 'args': arguments, 'thisArg': object });
3569 result.__chain__ = chainAll;
3572 return func.apply(object, arrayPush([this.value()], arguments));
3593 function noConflict() {
3594 if (root._ === this) {
3613 // No operation performed.
3633 function uniqueId(prefix) {
3634 var id = ++idCounter;
3635 return toString(prefix) + id;
3638 /*------------------------------------------------------------------------*/
3658 function max(array) {
3659 return (array && array.length)
3660 ? baseExtremum(array, identity, baseGt)
3682 function min(array) {
3683 return (array && array.length)
3684 ? baseExtremum(array, identity, baseLt)
3688 /*------------------------------------------------------------------------*/
3690 // Add methods that return wrapped values in chain sequences.
3691 lodash.assignIn = assignIn;
3692 lodash.before = before;
3694 lodash.chain = chain;
3695 lodash.compact = compact;
3696 lodash.concat = concat;
3697 lodash.create = create;
3698 lodash.defaults = defaults;
3699 lodash.defer = defer;
3700 lodash.delay = delay;
3701 lodash.filter = filter;
3702 lodash.flatten = flatten;
3703 lodash.flattenDeep = flattenDeep;
3704 lodash.iteratee = iteratee;
3707 lodash.matches = matches;
3708 lodash.mixin = mixin;
3709 lodash.negate = negate;
3712 lodash.slice = slice;
3713 lodash.sortBy = sortBy;
3716 lodash.toArray = toArray;
3717 lodash.values = values;
3720 lodash.extend = assignIn;
3722 // Add methods to `lodash.prototype`.
3723 mixin(lodash, lodash);
3725 /*------------------------------------------------------------------------*/
3727 // Add methods that return unwrapped values in chain sequences.
3728 lodash.clone = clone;
3729 lodash.escape = escape;
3730 lodash.every = every;
3732 lodash.forEach = forEach;
3735 lodash.identity = identity;
3736 lodash.indexOf = indexOf;
3737 lodash.isArguments = isArguments;
3738 lodash.isArray = isArray;
3739 lodash.isBoolean = isBoolean;
3740 lodash.isDate = isDate;
3741 lodash.isEmpty = isEmpty;
3742 lodash.isEqual = isEqual;
3743 lodash.isFinite = isFinite;
3744 lodash.isFunction = isFunction;
3745 lodash.isNaN = isNaN;
3746 lodash.isNull = isNull;
3747 lodash.isNumber = isNumber;
3748 lodash.isObject = isObject;
3749 lodash.isRegExp = isRegExp;
3750 lodash.isString = isString;
3751 lodash.isUndefined = isUndefined;
3755 lodash.noConflict = noConflict;
3757 lodash.reduce = reduce;
3758 lodash.result = result;
3761 lodash.uniqueId = uniqueId;
3764 lodash.each = forEach;
3765 lodash.first = head;
3767 mixin(lodash, (function() {
3769 baseForOwn(lodash, function(func, methodName) {
3770 if (!hasOwnProperty.call(lodash.prototype, methodName)) {
3771 source[methodName] = func;
3775 }()), { 'chain': false });
3777 /*------------------------------------------------------------------------*/
3786 lodash.VERSION = VERSION;
3788 // Add `Array` methods to `lodash.prototype`.
3789 baseEach(['pop', 'join', 'replace', 'reverse', 'split', 'push', 'shift', 'sort', 'splice', 'unshift'], function(methodName) {
3790 var func = (/^(?:replace|split)$/.test(methodName) ? String.prototype : arrayProto)[methodName],
3791 chainName = /^(?:push|sort|unshift)$/.test(methodName) ? 'tap' : 'thru',
3792 retUnwrapped = /^(?:pop|join|replace|shift)$/.test(methodName);
3794 lodash.prototype[methodName] = function() {
3795 var args = arguments;
3796 if (retUnwrapped && !this.__chain__) {
3797 var value = this.value();
3798 return func.apply(isArray(value) ? value : [], args);
3800 return this[chainName](function(value) {
3801 return func.apply(isArray(value) ? value : [], args);
3806 // Add chain sequence methods to the `lodash` wrapper.
3807 lodash.prototype.toJSON = lodash.prototype.valueOf = lodash.prototype.value = wrapperValue;
3809 /*--------------------------------------------------------------------------*/
3811 // Some AMD build optimizers, like r.js, check for condition patterns like:
3812 if (typeof define == 'function' && typeof define.amd == 'object' && define.amd) {
3813 // Expose Lodash on the global object to prevent errors when Lodash is
3814 // loaded by a script tag in the presence of an AMD loader.
3815 // See http://requirejs.org/docs/errors.html#mismatch for more details.
3816 // Use `_.noConflict` to remove Lodash from the global object.
3819 // Define as an anonymous module so, through path mapping, it can be
3820 // referenced as the "underscore
" module.
3825 // Check for `exports` after `define` in case a build optimizer adds it.
3826 else if (freeModule) {
3827 // Export for Node.js.
3828 (freeModule.exports = lodash)._ = lodash;
3829 // Export for CommonJS support.
3830 freeExports._ = lodash;
3833 // Export to the global object.