diff --git a/dist/lodash.compat.js b/dist/lodash.compat.js
index d8b92be3f..34b66d2ed 100644
--- a/dist/lodash.compat.js
+++ b/dist/lodash.compat.js
@@ -22,7 +22,8 @@
CURRY_RIGHT_FLAG = 8,
CURRY_BOUND_FLAG = 16,
PARTIAL_FLAG = 32,
- PARTIAL_RIGHT_FLAG = 64;
+ PARTIAL_RIGHT_FLAG = 64,
+ REARG_FLAG = 128;
/** Used as default options for `_.trunc` */
var DEFAULT_TRUNC_LENGTH = 30,
@@ -80,7 +81,7 @@
var reHostCtor = /^\[object .+?Constructor\]$/;
/** Used to match latin-1 supplement letters (excluding mathematical operators) */
- var reLatin1 = /[\xC0-\xD6\xD8-\xDE\xDF-\xF6\xF8-\xFF]/g;
+ var reLatin1 = /[\xc0-\xd6\xd8-\xde\xdf-\xf6\xf8-\xff]/g;
/** Used to ensure capturing order of template delimiters */
var reNoMatch = /($^)/;
@@ -100,8 +101,8 @@
/** Used to match words to create compound words */
var reWords = (function() {
- var upper = '[A-Z\\xC0-\\xD6\\xD8-\\xDE]',
- lower = '[a-z\\xDF-\\xF6\\xF8-\\xFF]+';
+ var upper = '[A-Z\\xc0-\\xd6\\xd8-\\xde]',
+ lower = '[a-z\\xdf-\\xf6\\xf8-\\xff]+';
return RegExp(upper + '{2,}(?=' + upper + lower + ')|' + upper + '?' + lower + '|' + upper + '+|[0-9]+', 'g');
}());
@@ -109,13 +110,13 @@
/** Used to detect and test whitespace */
var whitespace = (
// whitespace
- ' \t\x0B\f\xA0\ufeff' +
+ ' \t\x0b\f\xa0\ufeff' +
// line terminators
'\n\r\u2028\u2029' +
// unicode category "Zs" space separators
- '\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000'
+ '\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000'
);
/** Used to assign default `context` object properties */
@@ -202,23 +203,23 @@
/** Used to map latin-1 supplementary letters to basic latin letters */
var deburredLetters = {
- '\xC0': 'A', '\xC1': 'A', '\xC2': 'A', '\xC3': 'A', '\xC4': 'A', '\xC5': 'A',
- '\xE0': 'a', '\xE1': 'a', '\xE2': 'a', '\xE3': 'a', '\xE4': 'a', '\xE5': 'a',
- '\xC7': 'C', '\xE7': 'c',
- '\xD0': 'D', '\xF0': 'd',
- '\xC8': 'E', '\xC9': 'E', '\xCA': 'E', '\xCB': 'E',
- '\xE8': 'e', '\xE9': 'e', '\xEA': 'e', '\xEB': 'e',
- '\xCC': 'I', '\xCD': 'I', '\xCE': 'I', '\xCF': 'I',
- '\xEC': 'i', '\xED': 'i', '\xEE': 'i', '\xEF': 'i',
- '\xD1': 'N', '\xF1': 'n',
- '\xD2': 'O', '\xD3': 'O', '\xD4': 'O', '\xD5': 'O', '\xD6': 'O', '\xD8': 'O',
- '\xF2': 'o', '\xF3': 'o', '\xF4': 'o', '\xF5': 'o', '\xF6': 'o', '\xF8': 'o',
- '\xD9': 'U', '\xDA': 'U', '\xDB': 'U', '\xDC': 'U',
- '\xF9': 'u', '\xFA': 'u', '\xFB': 'u', '\xFC': 'u',
- '\xDD': 'Y', '\xFD': 'y', '\xFF': 'y',
- '\xC6': 'Ae', '\xE6': 'ae',
- '\xDE': 'Th', '\xFE': 'th',
- '\xDF': 'ss'
+ '\xc0': 'A', '\xc1': 'A', '\xc2': 'A', '\xc3': 'A', '\xc4': 'A', '\xc5': 'A',
+ '\xe0': 'a', '\xe1': 'a', '\xe2': 'a', '\xe3': 'a', '\xe4': 'a', '\xe5': 'a',
+ '\xc7': 'C', '\xe7': 'c',
+ '\xd0': 'D', '\xf0': 'd',
+ '\xc8': 'E', '\xc9': 'E', '\xca': 'E', '\xcb': 'E',
+ '\xe8': 'e', '\xe9': 'e', '\xea': 'e', '\xeb': 'e',
+ '\xcC': 'I', '\xcd': 'I', '\xce': 'I', '\xcf': 'I',
+ '\xeC': 'i', '\xed': 'i', '\xee': 'i', '\xef': 'i',
+ '\xd1': 'N', '\xf1': 'n',
+ '\xd2': 'O', '\xd3': 'O', '\xd4': 'O', '\xd5': 'O', '\xd6': 'O', '\xd8': 'O',
+ '\xf2': 'o', '\xf3': 'o', '\xf4': 'o', '\xf5': 'o', '\xf6': 'o', '\xf8': 'o',
+ '\xd9': 'U', '\xda': 'U', '\xdb': 'U', '\xdc': 'U',
+ '\xf9': 'u', '\xfa': 'u', '\xfb': 'u', '\xfc': 'u',
+ '\xdd': 'Y', '\xfd': 'y', '\xff': 'y',
+ '\xc6': 'Ae', '\xe6': 'ae',
+ '\xde': 'Th', '\xfe': 'th',
+ '\xdf': 'ss'
};
/**
@@ -473,26 +474,6 @@
return false;
}
- /**
- * The base implementation of `_.at` without support for strings and individual
- * key arguments.
- *
- * @private
- * @param {Array|Object} collection The collection to iterate over.
- * @param {number[]|string[]} [props] The property names or indexes of elements to pick.
- * @returns {Array} Returns the new array of picked elements.
- */
- function baseAt(collection, props) {
- var index = -1,
- length = props.length,
- result = Array(length);
-
- while(++index < length) {
- result[index] = collection[props[index]];
- }
- return result;
- }
-
/**
* The base implementation of `compareAscending` which compares values and
* sorts them in ascending order without guaranteeing a stable sort.
@@ -561,19 +542,6 @@
return result;
}
- /**
- * An implementation of `_.contains` for cache objects that mimics the return
- * signature of `_.indexOf` by returning `0` if the value is found, else `-1`.
- *
- * @private
- * @param {Object} cache The cache object to inspect.
- * @param {*} value The value to search for.
- * @returns {number} Returns `0` if `value` is found, else `-1`.
- */
- function cacheIndexOf(cache, value) {
- return cache.has(value) ? 0 : -1;
- }
-
/**
* Used by `_.max` and `_.min` as the default callback for string values.
*
@@ -657,7 +625,7 @@
// for `object` and `other`. See https://github.com/jashkenas/underscore/pull/1247
//
// This also ensures a stable sort in V8 and other engines.
- // See https://code.google.com/p/v8/issues/detail?id=90
+ // See https://code.google.com/p/v8/issues/detail?id=90.
return object.index - other.index;
}
@@ -738,6 +706,19 @@
};
}());
+ /**
+ * Checks if `value` is valid array-like index.
+ *
+ * @private
+ * @param {*} value The value to check.
+ * @param {number} [length] The upper bound of a valid index.
+ * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
+ */
+ function isIndex(value, length) {
+ value = +value;
+ return value > -1 && value % 1 == 0 && (length == null || value < length);
+ }
+
/**
* Used by `trimmedLeftIndex` and `trimmedRightIndex` to determine if a
* character code is whitespace.
@@ -1031,11 +1012,12 @@
* `initial`, `intersection`, `invert`, `invoke`, `keys`, `keysIn`, `map`,
* `mapValues`, `matches`, `memoize`, `merge`, `mixin`, `negate`, `noop`,
* `omit`, `once`, `pairs`, `partial`, `partialRight`, `partition`, `pick`,
- * `pluck`, `property`, `pull`, `pullAt`, `push`, `range`, `reject`, `remove`,
- * `rest`, `reverse`, `shuffle`, `slice`, `sort`, `sortBy`, `splice`, `take`,
- * `takeRight`, `takeRightWhile`, `takeWhile`, `tap`, `throttle`, `thru`,
- * `times`, `toArray`, `transform`, `union`, `uniq`, `unshift`, `unzip`,
- * `values`, `valuesIn`, `where`, `without`, `wrap`, `xor`, `zip`, and `zipObject`
+ * `pluck`, `property`, `propertyOf`, `pull`, `pullAt`, `push`, `range`,
+ * `rearg`, `reject`, `remove`, `rest`, `reverse`, `shuffle`, `slice`, `sort`,
+ * `sortBy`, `splice`, `take`, `takeRight`, `takeRightWhile`, `takeWhile`,
+ * `tap`, `throttle`, `thru`, `times`, `toArray`, `transform`, `union`, `uniq`,
+ * `unshift`, `unzip`, `values`, `valuesIn`, `where`, `without`, `wrap`, `xor`,
+ * `zip`, and `zipObject`
*
* The non-chainable wrapper functions are:
* `attempt`, `camelCase`, `capitalize`, `clone`, `cloneDeep`, `contains`,
@@ -1044,12 +1026,12 @@
* `has`, `identity`, `indexOf`, `isArguments`, `isArray`, `isBoolean`, isDate`,
* `isElement`, `isEmpty`, `isEqual`, `isError`, `isFinite`, `isFunction`,
* `isNative`, `isNaN`, `isNull`, `isNumber`, `isObject`, `isPlainObject`,
- * `isRegExp`, `isString`, `isUndefined`, `join`, `kebabCase`, `last`, `lastIndexOf`,
- * `max`, `min`, `noConflict`, `now`, `pad`, `padLeft`, `padRight`, `parseInt`,
- * `pop`, `random`, `reduce`, `reduceRight`, `repeat`, `result`, `runInContext`,
- * `shift`, `size`, `snakeCase`, `some`, `sortedIndex`, `sortedLastIndex`,
- * `startsWith`, `template`, `trim`, `trimLeft`, `trimRight`, `trunc`, `unescape`,
- * `uniqueId`, `value`, and `words`
+ * `isRegExp`, `isString`, `isUndefined`, `join`, `kebabCase`, `last`,
+ * `lastIndexOf`, `max`, `min`, `noConflict`, `now`, `pad`, `padLeft`, `padRight`,
+ * `parseInt`, `pop`, `random`, `reduce`, `reduceRight`, `repeat`, `result`,
+ * `runInContext`, `shift`, `size`, `snakeCase`, `some`, `sortedIndex`,
+ * `sortedLastIndex`, `startsWith`, `template`, `trim`, `trimLeft`, `trimRight`,
+ * `trunc`, `unescape`, `uniqueId`, `value`, and `words`
*
* The wrapper function `sample` will return a wrapped value when `n` is provided,
* otherwise it will return an unwrapped value.
@@ -1077,17 +1059,31 @@
* // => true
*/
function lodash(value) {
- if (value && typeof value == 'object') {
+ if (value && typeof value == 'object' && !isArray(value)) {
if (value instanceof LodashWrapper) {
return value;
}
- if (!isArray(value) && hasOwnProperty.call(value, '__wrapped__')) {
+ if (hasOwnProperty.call(value, '__wrapped__')) {
return new LodashWrapper(value.__wrapped__, value.__chain__, baseSlice(value.__queue__));
}
}
return new LodashWrapper(value);
}
+ /**
+ * The base constructor for creating `lodash` wrapper objects.
+ *
+ * @private
+ * @param {*} value The value to wrap.
+ * @param {boolean} [chainAll=false] Enable chaining for all wrapper methods.
+ * @param {Array} [queue=[]] Actions to peform to resolve the unwrapped value.
+ */
+ function LodashWrapper(value, chainAll, queue) {
+ this.__chain__ = !!chainAll;
+ this.__queue__ = queue || [];
+ this.__wrapped__ = value;
+ }
+
/**
* An object environment feature flags.
*
@@ -1196,12 +1192,11 @@
* Detect if `Array#shift` and `Array#splice` augment array-like objects
* correctly.
*
- * Firefox < 10, IE compatibility mode, and IE < 9 have buggy Array `shift()`
+ * Firefox < 10, compatibility modes of IE 8, and IE < 9 have buggy Array `shift()`
* and `splice()` functions that fail to remove the last element, `value[0]`,
* of array-like objects even though the `length` property is set to `0`.
- * The `shift()` method is buggy in IE 8 compatibility mode, while `splice()`
- * is buggy regardless of mode in IE < 9 and buggy in compatibility mode
- * in IE 9.
+ * The `shift()` method is buggy in compatibility modes of IE 8, while `splice()`
+ * is buggy regardless of mode in IE < 9.
*
* @memberOf _.support
* @type boolean
@@ -1313,6 +1308,230 @@
/*------------------------------------------------------------------------*/
+ /**
+ * Creates a lazy wrapper object which wraps `value` to enable lazy evaluation.
+ *
+ * @private
+ * @param {*} value The value to wrap.
+ */
+ function LazyWrapper(value) {
+ this.dir = 1;
+ this.dropCount = 0;
+ this.filtered = false;
+ this.iteratees = null;
+ this.takeCount = POSITIVE_INFINITY;
+ this.views = null;
+ this.wrapped = value;
+ }
+
+ /**
+ * Creates a clone of the lazy wrapper object.
+ *
+ * @private
+ * @name clone
+ * @memberOf LazyWrapper
+ * @returns {Object} Returns the cloned `LazyWrapper` object.
+ */
+ function lazyClone() {
+ var iteratees = this.iteratees,
+ views = this.views,
+ result = new LazyWrapper(this.wrapped);
+
+ result.dir = this.dir;
+ result.dropCount = this.dropCount;
+ result.filtered = this.filtered;
+ result.iteratees = iteratees ? baseSlice(iteratees) : null;
+ result.takeCount = this.takeCount;
+ result.views = views ? baseSlice(views) : null;
+ return result;
+ }
+
+ /**
+ * Reverses the direction of lazy iteration.
+ *
+ * @private
+ * @name reverse
+ * @memberOf LazyWrapper
+ * @returns {Object} Returns the new reversed `LazyWrapper` object.
+ */
+ function lazyReverse() {
+ var filtered = this.filtered,
+ result = filtered ? new LazyWrapper(this) : this.clone();
+
+ result.dir = this.dir * -1;
+ result.filtered = filtered;
+ return result;
+ }
+
+ /**
+ * Extracts the unwrapped value from its lazy wrapper.
+ *
+ * @private
+ * @name value
+ * @memberOf LazyWrapper
+ * @returns {*} Returns the unwrapped value.
+ */
+ function lazyValue() {
+ var array = this.wrapped.value(),
+ dir = this.dir,
+ isRight = dir < 0,
+ length = array.length,
+ view = getView(0, length, this.views),
+ start = view.start,
+ end = view.end,
+ dropCount = this.dropCount,
+ takeCount = nativeMin(end - start, this.takeCount - dropCount),
+ index = isRight ? end : start - 1,
+ iteratees = this.iteratees,
+ iterLength = iteratees ? iteratees.length : 0,
+ resIndex = 0,
+ result = [];
+
+ outer:
+ while (length-- && resIndex < takeCount) {
+ index += dir;
+
+ var iterIndex = -1,
+ value = array[index];
+
+ while (++iterIndex < iterLength) {
+ var data = iteratees[iterIndex],
+ iteratee = data.iteratee,
+ computed = iteratee(value, index, array),
+ type = data.type;
+
+ if (type == LAZY_MAP_FLAG) {
+ value = computed;
+ } else if (!computed) {
+ if (type == LAZY_FILTER_FLAG) {
+ continue outer;
+ } else {
+ break outer;
+ }
+ }
+ }
+ if (dropCount) {
+ dropCount--;
+ } else {
+ result[resIndex++] = value;
+ }
+ }
+ return isRight ? result.reverse() : result;
+ }
+
+ /*------------------------------------------------------------------------*/
+
+ /**
+ * Creates a cache object to store key/value pairs.
+ *
+ * @private
+ * @static
+ * @name Cache
+ * @memberOf _.memoize
+ */
+ function MapCache() {
+ this.__data__ = {};
+ }
+
+ /**
+ * Gets the cached value for `key`.
+ *
+ * @private
+ * @name get
+ * @memberOf _.memoize.Cache
+ * @param {string} key The key of the value to retrieve.
+ * @returns {*} Returns the cached value.
+ */
+ function mapGet(key) {
+ return this.__data__[key];
+ }
+
+ /**
+ * Checks if a cached value for `key` exists.
+ *
+ * @private
+ * @name has
+ * @memberOf _.memoize.Cache
+ * @param {string} key The name of the entry to check.
+ * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
+ */
+ function mapHas(key) {
+ return key != '__proto__' && hasOwnProperty.call(this.__data__, key);
+ }
+
+ /**
+ * Adds `value` to `key` of the cache.
+ *
+ * @private
+ * @name set
+ * @memberOf _.memoize.Cache
+ * @param {string} key The key of the value to cache.
+ * @param {*} value The value to cache.
+ * @returns {Object} Returns the cache object.
+ */
+ function mapSet(key, value) {
+ if (key != '__proto__') {
+ this.__data__[key] = value;
+ }
+ return this;
+ }
+
+ /*------------------------------------------------------------------------*/
+
+ /**
+ *
+ * Creates a cache object to store unique values.
+ *
+ * @private
+ * @param {Array} [values] The values to cache.
+ */
+ function SetCache(values) {
+ var length = values ? values.length : 0;
+
+ this.data = { 'number': {}, 'set': new Set };
+ while (length--) {
+ this.push(values[length]);
+ }
+ }
+
+ /**
+ * Checks if `value` is in `cache` mimicking the return signature of
+ * `_.indexOf` by returning `0` if the value is found, else `-1`.
+ *
+ * @private
+ * @param {Object} cache The cache to search.
+ * @param {*} value The value to search for.
+ * @returns {number} Returns `0` if `value` is found, else `-1`.
+ */
+ function cacheIndexOf(cache, value) {
+ var type = typeof value,
+ data = cache.data,
+ result = type == 'number' ? data[type][value] : data.set.has(value);
+
+ return result ? 0 : -1;
+ }
+
+ /**
+ * Adds `value` to the cache.
+ *
+ * @private
+ * @name push
+ * @memberOf SetCache
+ * @param {*} value The value to cache.
+ */
+ function cachePush(value) {
+ var data = this.data,
+ type = typeof value;
+
+ if (type == 'number') {
+ data[type][value] = true;
+ } else {
+ data.set.add(value);
+ }
+ }
+
+ /*------------------------------------------------------------------------*/
+
/**
* A specialized version of `_.max` for arrays without support for iteratees.
*
@@ -1386,18 +1605,6 @@
: objectValue;
}
- /**
- * Used by `_.matches` to clone `source` values, letting uncloneable values
- * passthu instead of returning empty objects.
- *
- * @private
- * @param {*} value The value to clone.
- * @returns {*} Returns the cloned value.
- */
- function clonePassthru(value) {
- return isCloneable(value) ? undefined : value;
- }
-
/**
* The base implementation of `_.assign` without support for argument juggling,
* multiple sources, and `this` binding.
@@ -1422,6 +1629,34 @@
return object;
}
+ /**
+ * The base implementation of `_.at` without support for strings and individual
+ * key arguments.
+ *
+ * @private
+ * @param {Array|Object} collection The collection to iterate over.
+ * @param {number[]|string[]} [props] The property names or indexes of elements to pick.
+ * @returns {Array} Returns the new array of picked elements.
+ */
+ function baseAt(collection, props) {
+ var index = -1,
+ length = collection ? collection.length : 0,
+ isArr = isLength(length),
+ propsLength = props.length,
+ result = Array(propsLength);
+
+ while(++index < propsLength) {
+ var key = props[index];
+ if (isArr) {
+ key = parseFloat(key);
+ result[index] = isIndex(key, length) ? collection[key] : undefined;
+ } else {
+ result[index] = collection[key];
+ }
+ }
+ return result;
+ }
+
/**
* The base implementation of `_.bindAll` without support for individual
* method name arguments.
@@ -1437,7 +1672,7 @@
while (++index < length) {
var key = methodNames[index];
- object[key] = createWrapper(object[key], BIND_FLAG, null, object);
+ object[key] = createWrapper(object[key], BIND_FLAG, object);
}
return object;
}
@@ -1593,23 +1828,6 @@
}());
}
- /**
- * The base implementation of `_.curry` and `_.curryRight` which handles
- * resolving the default arity of `func`.
- *
- * @private
- * @param {Function} func The function to curry.
- * @param {number} bitmask The bitmask of flags to compose.
- * @param {number} [arity=func.length] The arity of `func`.
- * @returns {Function} Returns the new curried function.
- */
- function baseCurry(func, bitmask, arity) {
- if (typeof arity != 'number') {
- arity = arity == null ? (func ? func.length : 0) : nativeMax(+arity || 0, 0);
- }
- return createWrapper(func, bitmask, arity);
- }
-
/**
* The base implementation of `_.difference` which accepts a single array
* of values to exclude.
@@ -1626,15 +1844,15 @@
}
var index = -1,
indexOf = getIndexOf(),
- prereq = indexOf == baseIndexOf,
- isLarge = prereq && createCache && values && values.length >= 200,
- isCommon = prereq && !isLarge,
+ isCommon = indexOf == baseIndexOf,
+ cache = isCommon && values.length >= 200 && createCache(values),
result = [],
valuesLength = values.length;
- if (isLarge) {
+ if (cache) {
indexOf = cacheIndexOf;
- values = createCache(values);
+ isCommon = false;
+ values = cache;
}
outer:
while (++index < length) {
@@ -2181,8 +2399,8 @@
var isSrcArr = isArrayLike(source);
(isSrcArr ? arrayEach : baseForOwn)(source, function(srcValue, key, source) {
- var isArr = srcValue && isArrayLike(srcValue),
- isObj = srcValue && isPlainObject(srcValue),
+ var isArr = isArrayLike(srcValue),
+ isObj = isPlainObject(srcValue),
value = object[key];
if (!(isArr || isObj)) {
@@ -2228,31 +2446,6 @@
return object;
}
- /**
- * The base implementation of `_.partial` and `_.partialRight` which accepts
- * an array of arguments to partially apply and handles resolving the arity
- * of `func`.
- *
- * @private
- * @param {Function} func The function to partially apply arguments to.
- * @param {number} bitmask The bitmask of flags to compose.
- * @param {Array} args The arguments to be partially applied.
- * @param {Array} holders The `args` placeholder indexes.
- * @param {*} [thisArg] The `this` binding of `func`.
- * @returns {Function} Returns the new partially applied function.
- */
- function basePartial(func, bitmask, args, holders, thisArg) {
- if (func) {
- var data = getData(func),
- arity = data ? data[2] : func.length;
-
- arity = nativeMax(arity - args.length, 0);
- }
- return (bitmask & PARTIAL_FLAG)
- ? createWrapper(func, bitmask, arity, thisArg, args, holders)
- : createWrapper(func, bitmask, arity, thisArg, null, null, args, holders);
- }
-
/**
* The base implementation of `_.pullAt` without support for individual
* index arguments.
@@ -2269,7 +2462,7 @@
indexes.sort(baseCompareAscending);
while (length--) {
var index = parseFloat(indexes[length]);
- if (index != previous && index > -1 && index % 1 == 0) {
+ if (index != previous && isIndex(index)) {
var previous = index;
splice.call(array, index, 1);
}
@@ -2402,15 +2595,16 @@
var index = -1,
indexOf = getIndexOf(),
length = array.length,
- prereq = indexOf == baseIndexOf,
- isLarge = prereq && createCache && length >= 200,
- isCommon = prereq && !isLarge,
+ isCommon = indexOf == baseIndexOf,
+ isLarge = isCommon && length >= 200,
+ seen = isLarge && createCache(),
result = [];
- if (isLarge) {
- var seen = createCache();
+ if (seen) {
indexOf = cacheIndexOf;
+ isCommon = false;
} else {
+ isLarge = false;
seen = iteratee ? [] : result;
}
outer:
@@ -2492,29 +2686,41 @@
};
}
+ /**
+ * Used by `_.matches` to clone `source` values, letting uncloneable values
+ * passthu instead of returning empty objects.
+ *
+ * @private
+ * @param {*} value The value to clone.
+ * @returns {*} Returns the cloned value.
+ */
+ function clonePassthru(value) {
+ return isCloneable(value) ? undefined : value;
+ }
+
/**
* Creates an array that is the composition of partially applied arguments,
* placeholders, and provided arguments into a single array of arguments.
*
* @private
- * @param {Array} partialArgs The arguments to prepend to those provided.
- * @param {Array} partialHolders The `partialArgs` placeholder indexes.
* @param {Array|Object} args The provided arguments.
+ * @param {Array} partials The arguments to prepend to those provided.
+ * @param {Array} holders The `partials` placeholder indexes.
* @returns {Array} Returns the new array of composed arguments.
*/
- function composeArgs(partialArgs, partialHolders, args) {
- var holdersLength = partialHolders.length,
+ function composeArgs(args, partials, holders) {
+ var holdersLength = holders.length,
argsIndex = -1,
argsLength = nativeMax(args.length - holdersLength, 0),
leftIndex = -1,
- leftLength = partialArgs.length,
+ leftLength = partials.length,
result = Array(argsLength + leftLength);
while (++leftIndex < leftLength) {
- result[leftIndex] = partialArgs[leftIndex];
+ result[leftIndex] = partials[leftIndex];
}
while (++argsIndex < holdersLength) {
- result[partialHolders[argsIndex]] = args[argsIndex];
+ result[holders[argsIndex]] = args[argsIndex];
}
while (argsLength--) {
result[leftIndex++] = args[argsIndex++];
@@ -2527,18 +2733,18 @@
* is tailored for `_.partialRight`.
*
* @private
- * @param {Array} partialRightArgs The arguments to append to those provided.
- * @param {Array} partialRightHolders The `partialRightArgs` placeholder indexes.
* @param {Array|Object} args The provided arguments.
+ * @param {Array} partials The arguments to append to those provided.
+ * @param {Array} holders The `partials` placeholder indexes.
* @returns {Array} Returns the new array of composed arguments.
*/
- function composeArgsRight(partialRightArgs, partialRightHolders, args) {
+ function composeArgsRight(args, partials, holders) {
var holdersIndex = -1,
- holdersLength = partialRightHolders.length,
+ holdersLength = holders.length,
argsIndex = -1,
argsLength = nativeMax(args.length - holdersLength, 0),
rightIndex = -1,
- rightLength = partialRightArgs.length,
+ rightLength = partials.length,
result = Array(argsLength + rightLength);
while (++argsIndex < argsLength) {
@@ -2546,10 +2752,10 @@
}
var pad = argsIndex;
while (++rightIndex < rightLength) {
- result[pad + rightIndex] = partialRightArgs[rightIndex];
+ result[pad + rightIndex] = partials[rightIndex];
}
while (++holdersIndex < holdersLength) {
- result[pad + partialRightHolders[holdersIndex]] = args[argsIndex++];
+ result[pad + holders[holdersIndex]] = args[argsIndex++];
}
return result;
}
@@ -2640,21 +2846,14 @@
}
/**
- * Creates a cache object to optimize linear searches of large arrays.
+ * Creates a `Set` cache object to optimize linear searches of large arrays.
*
* @private
- * @param {Array} [array=[]] The array to search.
- * @returns {Object} Returns the new cache object.
+ * @param {Array} [values] The values to cache.
+ * @returns {null|Object} Returns the new cache object if `Set` is supported, else `null`.
*/
- var createCache = Set && function(array) {
- var cache = new Set,
- length = array ? array.length : 0;
-
- cache.push = cache.add;
- while (length--) {
- cache.push(array[length]);
- }
- return cache;
+ var createCache = !Set ? constant(null) : function(values) {
+ return new SetCache(values);
};
/**
@@ -2705,15 +2904,16 @@
* @private
* @param {Function|string} func The function or method name to reference.
* @param {number} bitmask The bitmask of flags. See `createWrapper` for more details.
- * @param {number} arity The arity of `func`.
* @param {*} [thisArg] The `this` binding of `func`.
- * @param {Array} [partialArgs] The arguments to prepend to those provided to the new function.
- * @param {Array} [partialHolders] The `partialArgs` placeholder indexes.
- * @param {Array} [partialRightArgs] The arguments to append to those provided to the new function.
- * @param {Array} [partialRightHolders] The `partialRightArgs` placeholder indexes.
+ * @param {Array} [partials] The arguments to prepend to those provided to the new function.
+ * @param {Array} [holders] The `partials` placeholder indexes.
+ * @param {Array} [partialsRight] The arguments to append to those provided to the new function.
+ * @param {Array} [holdersRight] The `partialsRight` placeholder indexes.
+ * @param {Array} [argPos] The argument positions of the new function.
+ * @param {number} arity The arity of `func`.
* @returns {Function} Returns the new wrapped function.
*/
- function createHybridWrapper(func, bitmask, arity, thisArg, partialArgs, partialHolders, partialRightArgs, partialRightHolders) {
+ function createHybridWrapper(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, arity) {
var isBind = bitmask & BIND_FLAG,
isBindKey = bitmask & BIND_KEY_FLAG,
isCurry = bitmask & CURRY_FLAG,
@@ -2731,23 +2931,27 @@
while (index--) {
args[index] = arguments[index];
}
- if (partialArgs) {
- args = composeArgs(partialArgs, partialHolders, args);
+ if (argPos) {
+ args = arrayReduceRight(argPos, reorder, args);
}
- if (partialRightArgs) {
- args = composeArgsRight(partialRightArgs, partialRightHolders, args);
+ if (partials) {
+ args = composeArgs(args, partials, holders);
+ }
+ if (partialsRight) {
+ args = composeArgsRight(args, partialsRight, holdersRight);
}
if (isCurry || isCurryRight) {
var placeholder = wrapper.placeholder,
- holders = replaceHolders(args, placeholder);
+ argsHolders = replaceHolders(args, placeholder);
- length -= holders.length;
+ length -= argsHolders.length;
if (length < arity) {
- var newArity = nativeMax(arity - length, 0),
- newPartialArgs = isCurry ? args : null,
- newPartialHolders = isCurry ? holders : null,
- newPartialRightArgs = isCurry ? null : args,
- newPartialRightHolders = isCurry ? null : holders;
+ var newArgPos = argPos ? baseSlice(argPos) : null,
+ newArity = nativeMax(arity - length, 0),
+ newsHolders = isCurry ? argsHolders : null,
+ newHoldersRight = isCurry ? null : argsHolders,
+ newPartials = isCurry ? args : null,
+ newPartialsRight = isCurry ? null : args;
bitmask |= (isCurry ? PARTIAL_FLAG : PARTIAL_RIGHT_FLAG);
bitmask &= ~(isCurry ? PARTIAL_RIGHT_FLAG : PARTIAL_FLAG);
@@ -2755,9 +2959,9 @@
if (!isCurryBound) {
bitmask &= ~(BIND_FLAG | BIND_KEY_FLAG);
}
- var result = createHybridWrapper(func, bitmask, newArity, thisArg, newPartialArgs, newPartialHolders, newPartialRightArgs, newPartialRightHolders);
+ var result = createHybridWrapper(func, bitmask, thisArg, newPartials, newsHolders, newPartialsRight, newHoldersRight, newArgPos, newArity);
result.placeholder = placeholder;
- return setData(result, [func, bitmask, newArity, thisArg, newPartialArgs, newPartialHolders, newPartialRightArgs, newPartialRightHolders]);
+ return result;
}
}
var thisBinding = isBind ? thisArg : this;
@@ -2800,25 +3004,25 @@
* @private
* @param {Function} func The function to partially apply arguments to.
* @param {number} bitmask The bitmask of flags. See `createWrapper` for more details.
- * @param {Array} partialArgs The arguments to prepend to those provided to the new function.
+ * @param {Array} partials The arguments to prepend to those provided to the new function.
* @param {*} [thisArg] The `this` binding of `func`.
* @returns {Function} Returns the new bound function.
*/
- function createPartialWrapper(func, bitmask, partialArgs, thisArg) {
+ function createPartialWrapper(func, bitmask, partials, thisArg) {
var isBind = bitmask & BIND_FLAG,
Ctor = createCtorWrapper(func);
function wrapper() {
// avoid `arguments` object use disqualifying optimizations by
- // converting it to an array before passing it to `composeArgs`
+ // converting it to an array before providing it to `composeArgs`
var argsIndex = -1,
argsLength = arguments.length,
leftIndex = -1,
- leftLength = partialArgs.length,
+ leftLength = partials.length,
args = Array(argsLength + leftLength);
while (++leftIndex < leftLength) {
- args[leftIndex] = partialArgs[leftIndex];
+ args[leftIndex] = partials[leftIndex];
}
while (argsLength--) {
args[leftIndex++] = arguments[++argsIndex];
@@ -2836,37 +3040,44 @@
* @param {Function|string} func The function or method name to reference.
* @param {number} bitmask The bitmask of flags.
* The bitmask may be composed of the following flags:
- * 1 - `_.bind`
- * 2 - `_.bindKey`
- * 4 - `_.curry`
- * 8 - `_.curryRight`
- * 16 - `_.curry` or `_.curryRight` of a bound function
- * 32 - `_.partial`
- * 64 - `_.partialRight`
- * @param {number} arity The arity of `func`.
+ * 1 - `_.bind`
+ * 2 - `_.bindKey`
+ * 4 - `_.curry`
+ * 8 - `_.curryRight`
+ * 16 - `_.curry` or `_.curryRight` of a bound function
+ * 32 - `_.partial`
+ * 64 - `_.partialRight`
+ * 128 - `_.rearg`
* @param {*} [thisArg] The `this` binding of `func`.
- * @param {Array} [partialArgs] The arguments to prepend to those provided to the new function.
- * @param {Array} [partialHolders] The `partialArgs` placeholder indexes.
- * @param {Array} [partialRightArgs] The arguments to append to those provided to the new function.
- * @param {Array} [partialRightHolders] The `partialRightArgs` placeholder indexes.
+ * @param {Array} [partials] The arguments to be partially applied.
+ * @param {Array} [holders] The `partialArgs` placeholder indexes.
+ * @param {Array} [argPos] The argument positions of the new function.
+ * @param {number} [arity] The arity of `func`.
* @returns {Function} Returns the new wrapped function.
*/
- function createWrapper(func, bitmask, arity, thisArg, partialArgs, partialHolders, partialRightArgs, partialRightHolders) {
+ function createWrapper(func, bitmask, thisArg, partials, holders, argPos, arity) {
var isBindKey = bitmask & BIND_KEY_FLAG;
if (!isBindKey && !isFunction(func)) {
throw new TypeError(FUNC_ERROR_TEXT);
}
- var isPartial = bitmask & PARTIAL_FLAG;
- if (isPartial && !partialArgs.length) {
- bitmask &= ~PARTIAL_FLAG;
- isPartial = false;
- partialArgs = partialHolders = null;
+ var length = partials ? partials.length : 0;
+ if (!length) {
+ bitmask &= ~(PARTIAL_FLAG | PARTIAL_RIGHT_FLAG);
+ partials = holders = null;
}
- var isPartialRight = bitmask & PARTIAL_RIGHT_FLAG;
- if (isPartialRight && !partialRightArgs.length) {
- bitmask &= ~PARTIAL_RIGHT_FLAG;
- isPartialRight = false;
- partialRightArgs = partialRightHolders = null;
+ if (partials && !holders) {
+ holders = [];
+ }
+ var oldPartials = partials,
+ oldHolders = holders,
+ isPartial = bitmask & PARTIAL_FLAG,
+ isPartialRight = bitmask & PARTIAL_RIGHT_FLAG;
+
+ if (!isPartial) {
+ var partialsRight = partials,
+ holdersRight = holders;
+
+ partials = holders = null;
}
var data = (data = !isBindKey && getData(func)) && data !== true && data;
if (data) {
@@ -2878,45 +3089,59 @@
func = data[0];
bitmask |= funcBitmask;
- // use metadata `arity` if not provided
- if (arity == null) {
- arity = data[2];
- }
// use metadata `thisArg` if available
if (funcIsBind) {
- thisArg = data[3];
+ thisArg = data[2];
}
// set if currying a bound function
if (!isBind && funcIsBind) {
bitmask |= CURRY_BOUND_FLAG;
}
- // append partial left arguments
- var funcArgs = data[4];
- if (funcArgs) {
- var funcHolders = data[5];
- partialArgs = isPartial ? composeArgs(funcArgs, funcHolders, partialArgs) : baseSlice(funcArgs);
- partialHolders = isPartial ? replaceHolders(partialArgs, PLACEHOLDER) : baseSlice(funcHolders);
+ // compose partial arguments
+ var value = data[3];
+ if (value) {
+ var funcHolders = data[4];
+ partials = isPartial ? composeArgs(partials, value, funcHolders) : baseSlice(value);
+ holders = isPartial ? replaceHolders(partials, PLACEHOLDER) : baseSlice(funcHolders);
}
- // prepend partial right arguments
- funcArgs = data[6];
- if (funcArgs) {
- funcHolders = data[7];
- partialRightArgs = isPartialRight ? composeArgsRight(funcArgs, funcHolders, partialRightArgs) : baseSlice(funcArgs);
- partialRightHolders = isPartialRight ? replaceHolders(partialRightArgs, PLACEHOLDER) : baseSlice(funcHolders);
+ // compose partial right arguments
+ value = data[5];
+ if (value) {
+ funcHolders = data[6];
+ partialsRight = isPartialRight ? composeArgsRight(partialsRight, value, funcHolders) : baseSlice(value);
+ holdersRight = isPartialRight ? replaceHolders(partialsRight, PLACEHOLDER) : baseSlice(funcHolders);
+ }
+ // append argument positions
+ value = data[7];
+ if (value) {
+ value = baseSlice(value);
+ if (argPos) {
+ push.apply(value, argPos);
+ }
+ argPos = value;
+ }
+ // use metadata `arity` if not provided
+ if (arity == null) {
+ arity = data[8];
}
}
if (arity == null) {
arity = isBindKey ? 0 : func.length;
+ } else {
+ arity = nativeMax(+arity || 0, 0);
+ }
+ if (oldPartials) {
+ arity = nativeMax(arity - (oldPartials.length - oldHolders.length), 0);
}
if (bitmask == BIND_FLAG) {
var result = createBindWrapper(func, thisArg);
- } else if ((bitmask == PARTIAL_FLAG || bitmask == (BIND_FLAG | PARTIAL_FLAG)) && !partialHolders.length) {
- result = createPartialWrapper(func, bitmask, partialArgs, thisArg);
+ } else if ((bitmask == PARTIAL_FLAG || bitmask == (BIND_FLAG | PARTIAL_FLAG)) && !holders.length) {
+ result = createPartialWrapper(func, bitmask, partials, thisArg);
} else {
- result = createHybridWrapper(func, bitmask, arity, thisArg, partialArgs, partialHolders, partialRightArgs, partialRightHolders);
+ result = createHybridWrapper(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, arity);
}
var setter = data ? baseSetData : setData;
- return setter(result, [func, bitmask, arity, thisArg, partialArgs, partialHolders, partialRightArgs, partialRightHolders]);
+ return setter(result, [func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, arity]);
}
/**
@@ -3106,12 +3331,12 @@
if (!isObject(object)) {
return false;
}
- var type = typeof index,
- prereq = type == 'string';
-
+ var type = typeof index;
if (type == 'number') {
- var length = object.length;
- prereq = (isLength(length) && index > -1 && index < length && index % 1 == 0);
+ var length = object.length,
+ prereq = isLength(length) && isIndex(index, length);
+ } else {
+ prereq = type == 'string';
}
return prereq && object[index] === value;
}
@@ -3184,6 +3409,28 @@
return result;
}
+ /**
+ * Reorder `array` according to the specified indexes where the element at
+ * the first index is assigned as the first element, the element at
+ * the second index is assigned as the second element, and so on.
+ *
+ * @private
+ * @param {Array} array The array to reorder.
+ * @param {Array} indexes The arranged array indexes.
+ * @returns {Array} Returns `array`.
+ */
+ function reorder(array, indexes) {
+ var arrLength = array.length,
+ length = nativeMin(indexes.length, arrLength),
+ oldArray = baseSlice(array);
+
+ while (length--) {
+ var index = indexes[length];
+ array[length] = isIndex(index, arrLength) ? oldArray[index] : undefined;
+ }
+ return array;
+ }
+
/**
* Sets metadata for `func`.
*
@@ -3267,22 +3514,20 @@
*/
function shimKeys(object) {
var props = keysIn(object),
- length = props.length,
- objLength = length && object.length,
+ propsLength = props.length,
+ length = propsLength && object.length,
support = lodash.support;
- var allowIndexes = typeof objLength == 'number' && objLength > 0 &&
+ var allowIndexes = typeof length == 'number' && length > 0 &&
(isArray(object) || (support.nonEnumStrings && isString(object)) ||
(support.nonEnumArgs && isArguments(object)));
- var keyIndex,
- index = -1,
+ var index = -1,
result = [];
- while (++index < length) {
+ while (++index < propsLength) {
var key = props[index];
- if ((allowIndexes && (keyIndex = +key, keyIndex > -1 && keyIndex < objLength && keyIndex % 1 == 0)) ||
- hasOwnProperty.call(object, key)) {
+ if ((allowIndexes && isIndex(key, length)) || hasOwnProperty.call(object, key)) {
result.push(key);
}
}
@@ -3353,12 +3598,13 @@
* // => [['a', 'b', 'c'], ['d']]
*/
function chunk(array, size, guard) {
+ size = (guard || size == null) ? 1 : nativeMax(+size || 1, 1);
+
var index = 0,
length = array ? array.length : 0,
resIndex = -1,
- result = [];
+ result = Array(ceil(length / size));
- size = (guard || size == null) ? 1 : nativeMax(+size || 1, 1);
while (index < length) {
result[++resIndex] = slice(array, index, (index += size));
}
@@ -3424,7 +3670,7 @@
break;
}
}
- return baseDifference(arguments[index], baseFlatten(arguments, false, true, ++index));
+ return baseDifference(value, baseFlatten(arguments, false, true, ++index));
}
/**
@@ -3516,17 +3762,17 @@
* // => [1]
*
* var users = [
- * { 'user': 'barney', 'employer': 'slate' },
- * { 'user': 'fred', 'employer': 'slate', 'blocked': true },
- * { 'user': 'pebbles', 'employer': 'na', 'blocked': true }
+ * { 'user': 'barney', 'status': 'busy', 'active': false },
+ * { 'user': 'fred', 'status': 'busy', 'active': true },
+ * { 'user': 'pebbles', 'status': 'away', 'active': true }
* ];
*
* // using "_.pluck" callback shorthand
- * _.pluck(_.dropRightWhile(users, 'blocked'), 'user');
+ * _.pluck(_.dropRightWhile(users, 'active'), 'user');
* // => ['barney']
*
* // using "_.where" callback shorthand
- * _.pluck(_.dropRightWhile(users, { 'employer': 'na' }), 'user');
+ * _.pluck(_.dropRightWhile(users, { 'status': 'away' }), 'user');
* // => ['barney', 'fred']
*/
function dropRightWhile(array, predicate, thisArg) {
@@ -3564,17 +3810,17 @@
* // => [3]
*
* var users = [
- * { 'user': 'barney', 'employer': 'slate', 'blocked': true },
- * { 'user': 'fred', 'employer': 'slate' },
- * { 'user': 'pebbles', 'employer': 'na', 'blocked': true }
+ * { 'user': 'barney', 'status': 'busy', 'active': true },
+ * { 'user': 'fred', 'status': 'busy', 'active': false },
+ * { 'user': 'pebbles', 'status': 'away', 'active': true }
* ];
*
* // using "_.pluck" callback shorthand
- * _.pluck(_.dropWhile(users, 'blocked'), 'user');
+ * _.pluck(_.dropWhile(users, 'active'), 'user');
* // => ['fred', 'pebbles']
*
* // using "_.where" callback shorthand
- * _.pluck(_.dropWhile(users, { 'employer': 'slate' }), 'user');
+ * _.pluck(_.dropWhile(users, { 'status': 'busy' }), 'user');
* // => ['pebbles']
*/
function dropWhile(array, predicate, thisArg) {
@@ -3609,22 +3855,20 @@
* @example
*
* var users = [
- * { 'user': 'barney', 'age': 36 },
- * { 'user': 'fred', 'age': 40, 'blocked': true },
- * { 'user': 'pebbles', 'age': 1 }
+ * { 'user': 'barney', 'age': 36, 'active': false },
+ * { 'user': 'fred', 'age': 40, 'active': true },
+ * { 'user': 'pebbles', 'age': 1, 'active': false }
* ];
*
- * _.findIndex(users, function(chr) {
- * return chr.age < 20;
- * });
- * // => 2
- *
- * // using "_.where" callback shorthand
- * _.findIndex(users, { 'age': 36 });
+ * _.findIndex(users, function(chr) { return chr.age < 40; });
* // => 0
*
+ * // using "_.where" callback shorthand
+ * _.findIndex(users, { 'age': 1 });
+ * // => 2
+ *
* // using "_.pluck" callback shorthand
- * _.findIndex(users, 'blocked');
+ * _.findIndex(users, 'active');
* // => 1
*/
function findIndex(array, predicate, thisArg) {
@@ -3663,23 +3907,21 @@
* @example
*
* var users = [
- * { 'user': 'barney', 'age': 36, 'blocked': true },
- * { 'user': 'fred', 'age': 40 },
- * { 'user': 'pebbles', 'age': 1, 'blocked': true }
+ * { 'user': 'barney', 'age': 36, 'active': true },
+ * { 'user': 'fred', 'age': 40, 'active': false },
+ * { 'user': 'pebbles', 'age': 1, 'active': false }
* ];
*
- * _.findLastIndex(users, function(chr) {
- * return chr.age > 30;
- * });
- * // => 1
+ * _.findLastIndex(users, function(chr) { return chr.age < 40; });
+ * // => 2
*
* // using "_.where" callback shorthand
- * _.findLastIndex(users, { 'age': 36 });
- * // => 0
+ * _.findLastIndex(users, { 'age': 40});
+ * // => 1
*
* // using "_.pluck" callback shorthand
- * _.findLastIndex(users, 'blocked');
- * // => 2
+ * _.findLastIndex(users, 'active');
+ * // => 0
*/
function findLastIndex(array, predicate, thisArg) {
var length = array ? array.length : 0;
@@ -3823,8 +4065,8 @@
}
/**
- * Creates an array of unique values present in all provided arrays using
- * `SameValueZero` for equality comparisons.
+ * Creates an array of unique values in all provided arrays using `SameValueZero`
+ * for equality comparisons.
*
* **Note:** `SameValueZero` comparisons are like strict equality comparisons,
* e.g. `===`, except that `NaN` matches `NaN`. See the
@@ -3847,14 +4089,13 @@
argsLength = arguments.length,
caches = [],
indexOf = getIndexOf(),
- prereq = createCache && indexOf == baseIndexOf;
+ isCommon = indexOf == baseIndexOf;
while (++argsIndex < argsLength) {
var value = arguments[argsIndex];
if (isArray(value) || isArguments(value)) {
args.push(value);
- caches.push(prereq && value.length >= 120 &&
- createCache(argsIndex && value));
+ caches.push(isCommon && value.length >= 120 && createCache(argsIndex && value));
}
}
argsLength = args.length;
@@ -4301,17 +4542,17 @@
* // => [2, 3]
*
* var users = [
- * { 'user': 'barney', 'employer': 'slate' },
- * { 'user': 'fred', 'employer': 'slate', 'blocked': true },
- * { 'user': 'pebbles', 'employer': 'na', 'blocked': true }
+ * { 'user': 'barney', 'status': 'busy', 'active': false },
+ * { 'user': 'fred', 'status': 'busy', 'active': true },
+ * { 'user': 'pebbles', 'status': 'away', 'active': true }
* ];
*
* // using "_.pluck" callback shorthand
- * _.pluck(_.takeRightWhile(users, 'blocked'), 'user');
+ * _.pluck(_.takeRightWhile(users, 'active'), 'user');
* // => ['fred', 'pebbles']
*
* // using "_.where" callback shorthand
- * _.pluck(_.takeRightWhile(users, { 'employer': 'na' }), 'user');
+ * _.pluck(_.takeRightWhile(users, { 'status': 'away' }), 'user');
* // => ['pebbles']
*/
function takeRightWhile(array, predicate, thisArg) {
@@ -4349,17 +4590,17 @@
* // => [1, 2]
*
* var users = [
- * { 'user': 'barney', 'employer': 'slate', 'blocked': true },
- * { 'user': 'fred', 'employer': 'slate' },
- * { 'user': 'pebbles', 'employer': 'na', 'blocked': true }
+ * { 'user': 'barney', 'status': 'busy', 'active': true },
+ * { 'user': 'fred', 'status': 'busy', 'active': false },
+ * { 'user': 'pebbles', 'status': 'away', 'active': true }
* ];
*
* // using "_.pluck" callback shorthand
- * _.pluck(_.takeWhile(users, 'blocked'), 'user');
+ * _.pluck(_.takeWhile(users, 'active'), 'user');
* // => ['barney']
*
* // using "_.where" callback shorthand
- * _.pluck(_.takeWhile(users, { 'employer': 'slate' }), 'user');
+ * _.pluck(_.takeWhile(users, { 'status': 'busy' }), 'user');
* // => ['barney', 'fred']
*/
function takeWhile(array, predicate, thisArg) {
@@ -4618,7 +4859,7 @@
* @memberOf _
* @category Chain
* @param {*} value The value to wrap.
- * @returns {Object} Returns the new `LodashWrapper` object.
+ * @returns {Object} Returns the new `lodash` object.
* @example
*
* var users = [
@@ -4688,30 +4929,13 @@
return interceptor.call(thisArg, value);
}
- /*------------------------------------------------------------------------*/
-
- /**
- * A fast path for creating `lodash` wrapper objects.
- *
- * @private
- * @param {*} value The value to wrap.
- * @param {boolean} [chainAll=false] Enable chaining for all methods.
- * @param {Array} [queue=[]] Actions to peform to resolve the unwrapped value.
- * @returns {Object} Returns a `LodashWrapper` instance.
- */
- function LodashWrapper(value, chainAll, queue) {
- this.__chain__ = !!chainAll;
- this.__queue__ = queue || [];
- this.__wrapped__ = value;
- }
-
/**
* Enables explicit method chaining on the wrapper object.
*
* @name chain
* @memberOf _
* @category Chain
- * @returns {*} Returns the `LodashWrapper` object.
+ * @returns {*} Returns the `lodash` object.
* @example
*
* var users = [
@@ -4743,7 +4967,7 @@
* @name chain
* @memberOf _
* @category Chain
- * @returns {Object} Returns the new reversed `LodashWrapper` object.
+ * @returns {Object} Returns the new reversed `lodash` object.
* @example
*
* var array = [1, 2, 3];
@@ -4811,120 +5035,6 @@
/*------------------------------------------------------------------------*/
- /**
- * Wraps `value` as a `LazyWrapper` object.
- *
- * @private
- * @param {*} value The value to wrap.
- * @returns {Object} Returns a `LazyWrapper` instance.
- */
- function LazyWrapper(value) {
- this.dir = 1;
- this.dropCount = 0;
- this.filtered = false;
- this.iteratees = null;
- this.takeCount = POSITIVE_INFINITY;
- this.views = null;
- this.wrapped = value;
- }
-
- /**
- * Creates a clone of the `LazyWrapper` object.
- *
- * @private
- * @name clone
- * @memberOf LazyWrapper
- * @returns {Object} Returns the cloned `LazyWrapper` object.
- */
- function lazyClone() {
- var iteratees = this.iteratees,
- views = this.views,
- result = new LazyWrapper(this.wrapped);
-
- result.dir = this.dir;
- result.dropCount = this.dropCount;
- result.filtered = this.filtered;
- result.iteratees = iteratees ? baseSlice(iteratees) : null;
- result.takeCount = this.takeCount;
- result.views = views ? baseSlice(views) : null;
- return result;
- }
-
- /**
- * Reverses the direction of lazy iteration.
- *
- * @private
- * @name reverse
- * @memberOf LazyWrapper
- * @returns {Object} Returns the new reversed `LazyWrapper` object.
- */
- function lazyReverse() {
- var filtered = this.filtered,
- result = filtered ? new LazyWrapper(this) : this.clone();
-
- result.dir = this.dir * -1;
- result.filtered = filtered;
- return result;
- }
-
- /**
- * Extracts the unwrapped value from its wrapper.
- *
- * @private
- * @name value
- * @memberOf LazyWrapper
- * @returns {*} Returns the unwrapped value.
- */
- function lazyValue() {
- var array = this.wrapped.value(),
- dir = this.dir,
- isRight = dir < 0,
- length = array.length,
- view = getView(0, length, this.views),
- start = view.start,
- end = view.end,
- dropCount = this.dropCount,
- takeCount = nativeMin(end - start, this.takeCount - dropCount),
- index = isRight ? end : start - 1,
- iteratees = this.iteratees,
- iterLength = iteratees ? iteratees.length : 0,
- resIndex = 0,
- result = [];
-
- outer:
- while (length-- && resIndex < takeCount) {
- index += dir;
-
- var iterIndex = -1,
- value = array[index];
-
- while (++iterIndex < iterLength) {
- var data = iteratees[iterIndex],
- iteratee = data.iteratee,
- computed = iteratee(value, index, array),
- type = data.type;
-
- if (type == LAZY_MAP_FLAG) {
- value = computed;
- } else if (!computed) {
- if (type == LAZY_FILTER_FLAG) {
- continue outer;
- } else {
- break outer;
- }
- }
- }
- if (dropCount) {
- dropCount--;
- } else {
- result[resIndex++] = value;
- }
- }
- return isRight ? result.reverse() : result;
- }
-
- /*------------------------------------------------------------------------*/
-
/**
* Creates an array of elements corresponding to the specified keys, or indexes,
* of the collection. Keys may be specified as individual arguments or as arrays
@@ -4953,9 +5063,9 @@
}
/**
- * Checks if `value` is present in `collection` using `SameValueZero` for
- * equality comparisons. If `fromIndex` is negative, it is used as the offset
- * from the end of the collection.
+ * Checks if `value` is in `collection` using `SameValueZero` for equality
+ * comparisons. If `fromIndex` is negative, it is used as the offset from
+ * the end of the collection.
*
* **Note:** `SameValueZero` comparisons are like strict equality comparisons,
* e.g. `===`, except that `NaN` matches `NaN`. See the
@@ -4967,7 +5077,7 @@
* @alias include
* @category Collection
* @param {Array|Object|string} collection The collection to search.
- * @param {*} target The value to check for.
+ * @param {*} target The value to search for.
* @param {number} [fromIndex=0] The index to search from.
* @returns {boolean} Returns `true` if a matching element is found, else `false`.
* @example
@@ -5119,17 +5229,17 @@
* // => [2, 4]
*
* var users = [
- * { 'user': 'barney', 'age': 36 },
- * { 'user': 'fred', 'age': 40, 'blocked': true }
+ * { 'user': 'barney', 'age': 36, 'active': false },
+ * { 'user': 'fred', 'age': 40, 'active': true }
* ];
*
* // using "_.pluck" callback shorthand
- * _.filter(users, 'blocked');
- * // => [{ 'user': 'fred', 'age': 40, 'blocked': true }]
+ * _.pluck(_.filter(users, 'active'), 'user');
+ * // => ['fred']
*
* // using "_.where" callback shorthand
- * _.filter(users, { 'age': 36 });
- * // => [{ 'user': 'barney', 'age': 36 }]
+ * _.pluck(_.filter(users, { 'age': 36 }), 'user');
+ * // => ['barney']
*/
function filter(collection, predicate, thisArg) {
var func = isArray(collection) ? arrayFilter : baseFilter;
@@ -5163,23 +5273,21 @@
* @example
*
* var users = [
- * { 'user': 'barney', 'age': 36 },
- * { 'user': 'fred', 'age': 40, 'blocked': true },
- * { 'user': 'pebbles', 'age': 1 }
+ * { 'user': 'barney', 'age': 36, 'active': false },
+ * { 'user': 'fred', 'age': 40, 'active': true },
+ * { 'user': 'pebbles', 'age': 1, 'active': false }
* ];
*
- * _.find(users, function(chr) {
- * return chr.age < 40;
- * });
- * // => { 'user': 'barney', 'age': 36 }
+ * _.result(_.find(users, function(chr) { return chr.age < 40; }), 'user');
+ * // => 'barney'
*
* // using "_.where" callback shorthand
- * _.find(users, { 'age': 1 });
- * // => { 'user': 'pebbles', 'age': 1 }
+ * _.result(_.find(users, { 'age': 1 }), 'user');
+ * // => 'pebbles'
*
* // using "_.pluck" callback shorthand
- * _.find(users, 'blocked');
- * // => { 'user': 'fred', 'age': 40, 'blocked': true }
+ * _.result(_.find(users, 'active'), 'user');
+ * // => 'fred'
*/
function find(collection, predicate, thisArg) {
if (isArray(collection)) {
@@ -5227,15 +5335,15 @@
* @example
*
* var users = [
- * { 'user': 'barney', 'age': 36, 'employer': 'slate' },
- * { 'user': 'fred', 'age': 40, 'employer': 'slate' }
+ * { 'user': 'barney', 'age': 36, 'status': 'busy' },
+ * { 'user': 'fred', 'age': 40, 'status': 'busy' }
* ];
*
- * _.findWhere(users, { 'employer': 'slate' });
- * // => { 'user': 'barney', 'age': 36, 'employer': 'slate' }
+ * _.findWhere(users, { 'status': 'busy' });
+ * // => { 'user': 'barney', 'age': 36, 'status': 'busy' }
*
* _.findWhere(users, { 'age': 40 });
- * // => { 'user': 'fred', 'age': 40, 'employer': 'slate' }
+ * // => { 'user': 'fred', 'age': 40, 'status': 'busy' }
*/
function findWhere(collection, source) {
return find(collection, matches(source));
@@ -5627,9 +5735,9 @@
* // => [[1, 3], [2]]
*
* var users = [
- * { 'user': 'barney', 'age': 36 },
- * { 'user': 'fred', 'age': 40, 'blocked': true },
- * { 'user': 'pebbles', 'age': 1 }
+ * { 'user': 'barney', 'age': 36, 'active': false },
+ * { 'user': 'fred', 'age': 40, 'active': true },
+ * { 'user': 'pebbles', 'age': 1, 'active': false }
* ];
*
* // using "_.where" callback shorthand
@@ -5637,7 +5745,7 @@
* // => [['pebbles'], ['barney', 'fred']]
*
* // using "_.pluck" callback shorthand
- * _.map(_.partition(users, 'blocked'), function(array) { return _.pluck(array, 'user'); });
+ * _.map(_.partition(users, 'active'), function(array) { return _.pluck(array, 'user'); });
* // => [['fred'], ['barney', 'pebbles']]
*/
var partition = createAggregator(function(result, value, key) {
@@ -5754,17 +5862,17 @@
* // => [1, 3]
*
* var users = [
- * { 'user': 'barney', 'age': 36 },
- * { 'user': 'fred', 'age': 40, 'blocked': true }
+ * { 'user': 'barney', 'age': 36, 'active': false },
+ * { 'user': 'fred', 'age': 40, 'active': true }
* ];
*
* // using "_.pluck" callback shorthand
- * _.reject(users, 'blocked');
- * // => [{ 'user': 'barney', 'age': 36 }]
+ * _.pluck(_.reject(users, 'active'), 'user');
+ * // => ['barney']
*
* // using "_.where" callback shorthand
- * _.reject(users, { 'age': 36 });
- * // => [{ 'user': 'fred', 'age': 40, 'blocked': true }]
+ * _.pluck(_.reject(users, { 'age': 36 }), 'user');
+ * // => ['fred']
*/
function reject(collection, predicate, thisArg) {
var func = isArray(collection) ? arrayFilter : baseFilter;
@@ -5891,12 +5999,12 @@
* // => true
*
* var users = [
- * { 'user': 'barney', 'age': 36 },
- * { 'user': 'fred', 'age': 40, 'blocked': true }
+ * { 'user': 'barney', 'age': 36, 'active': false },
+ * { 'user': 'fred', 'age': 40, 'active': true }
* ];
*
* // using "_.pluck" callback shorthand
- * _.some(users, 'blocked');
+ * _.some(users, 'active');
* // => true
*
* // using "_.where" callback shorthand
@@ -6034,8 +6142,8 @@
* @example
*
* var users = [
- * { 'user': 'barney', 'age': 36, 'employer': 'slate', 'pets': ['hoppy'] },
- * { 'user': 'fred', 'age': 40, 'employer': 'slate', 'pets': ['baby puss', 'dino'] }
+ * { 'user': 'barney', 'age': 36, 'status': 'busy', 'pets': ['hoppy'] },
+ * { 'user': 'fred', 'age': 40, 'status': 'busy', 'pets': ['baby puss', 'dino'] }
* ];
*
* _.pluck(_.where(users, { 'age': 36 }), 'user');
@@ -6044,7 +6152,7 @@
* _.pluck(_.where(users, { 'pets': ['dino'] }), 'user');
* // => ['fred']
*
- * _.pluck(_.where(users, { 'employer': 'slate' }), 'user');
+ * _.pluck(_.where(users, { 'status': 'busy' }), 'user');
* // => ['barney', 'fred']
*/
function where(collection, source) {
@@ -6157,13 +6265,14 @@
* // => 'hi fred'
*/
function bind(func, thisArg) {
- if (arguments.length < 3) {
- return createWrapper(func, BIND_FLAG, null, thisArg);
- }
- var args = slice(arguments, 2),
- holders = replaceHolders(args, bind.placeholder);
+ var bitmask = BIND_FLAG;
+ if (arguments.length > 2) {
+ var partials = slice(arguments, 2),
+ holders = replaceHolders(partials, bind.placeholder);
- return basePartial(func, BIND_FLAG | PARTIAL_FLAG, args, holders, thisArg);
+ bitmask |= PARTIAL_FLAG;
+ }
+ return createWrapper(func, bitmask, thisArg, partials, holders);
}
/**
@@ -6238,17 +6347,17 @@
function bindKey(object, key) {
var bitmask = BIND_FLAG | BIND_KEY_FLAG;
if (arguments.length > 2) {
- var args = slice(arguments, 2),
- holders = replaceHolders(args, bindKey.placeholder);
+ var partials = slice(arguments, 2),
+ holders = replaceHolders(partials, bindKey.placeholder);
+
+ bitmask |= PARTIAL_FLAG;
}
- return args
- ? createWrapper(key, bitmask, null, object, args, holders)
- : createWrapper(key, bitmask, null, object);
+ return createWrapper(key, bitmask, object, partials, holders);
}
/**
* Creates a function that accepts one or more arguments of `func` that when
- * called either invokes `func` returning its result if all `func` arguments
+ * called either invokes `func` returning its result, if all `func` arguments
* have been provided, or returns a function that accepts one or more of the
* remaining `func` arguments, and so on. The arity of `func` can be specified
* if `func.length` is not sufficient.
@@ -6265,7 +6374,7 @@
* @example
*
* var curried = _.curry(function(a, b, c) {
- * console.log([a, b, c]);
+ * return [a, b, c];
* });
*
* curried(1)(2)(3);
@@ -6278,7 +6387,7 @@
* // => [1, 2, 3]
*/
function curry(func, arity, guard) {
- var result = baseCurry(func, CURRY_FLAG, guard ? null : arity);
+ var result = createWrapper(func, CURRY_FLAG, null, null, null, null, guard ? null : arity);
result.placeholder = curry.placeholder;
return result;
}
@@ -6299,7 +6408,7 @@
* @example
*
* var curried = _.curryRight(function(a, b, c) {
- * console.log([a, b, c]);
+ * return [a, b, c];
* });
*
* curried(3)(2)(1);
@@ -6312,7 +6421,7 @@
* // => [1, 2, 3]
*/
function curryRight(func, arity, guard) {
- var result = baseCurry(func, CURRY_RIGHT_FLAG, guard ? null : arity);
+ var result = createWrapper(func, CURRY_RIGHT_FLAG, null, null, null, null, guard ? null : arity);
result.placeholder = curryRight.placeholder;
return result;
}
@@ -6512,8 +6621,8 @@
if (!isFunction(func)) {
throw new TypeError(FUNC_ERROR_TEXT);
}
- var args = slice(arguments, 1);
- return setTimeout(function() { func.apply(undefined, args); }, 1);
+ var args = arguments;
+ return setTimeout(function() { func.apply(undefined, slice(args, 1)); }, 1);
}
/**
@@ -6536,8 +6645,8 @@
if (!isFunction(func)) {
throw new TypeError(FUNC_ERROR_TEXT);
}
- var args = slice(arguments, 2);
- return setTimeout(function() { func.apply(undefined, args); }, wait);
+ var args = arguments;
+ return setTimeout(function() { func.apply(undefined, slice(args, 2)); }, wait);
}
/**
@@ -6737,7 +6846,7 @@
* initialize();
* // `initialize` invokes `createApplication` once
*/
- var once = basePartial(before,PARTIAL_FLAG, [2], []);
+ var once = createWrapper(before, PARTIAL_FLAG, null, [2]);
/**
* Creates a function that invokes `func` with `partial` arguments prepended
@@ -6761,10 +6870,10 @@
* // => 'hello fred'
*/
function partial(func) {
- var args = slice(arguments, 1),
- holders = replaceHolders(args, partial.placeholder);
+ var partials = slice(arguments, 1),
+ holders = replaceHolders(partials, partial.placeholder);
- return basePartial(func, PARTIAL_FLAG, args, holders);
+ return createWrapper(func, PARTIAL_FLAG, null, partials, holders);
}
/**
@@ -6799,10 +6908,43 @@
* // => { 'a': { 'b': { 'c': 1, 'd': 2 } } }
*/
function partialRight(func) {
- var args = slice(arguments, 1),
- holders = replaceHolders(args, partialRight.placeholder);
+ var partials = slice(arguments, 1),
+ holders = replaceHolders(partials, partialRight.placeholder);
- return basePartial(func, PARTIAL_RIGHT_FLAG, args, holders);
+ return createWrapper(func, PARTIAL_RIGHT_FLAG, null, partials, holders);
+ }
+
+ /**
+ * Creates a function that invokes `func` with arguments arranged according
+ * to the specified indexes where the argument value at the first index is
+ * provided as the first argument, the argument value at the second index is
+ * provided as the second argument, and so on.
+ *
+ * @static
+ * @memberOf _
+ * @category Function
+ * @param {Function} func The function to rearrange arguments for.
+ * @param {...(number|number[])} [indexes] The arranged argument indexes,
+ * specified as individual indexes or arrays of indexes.
+ * @returns {Function} Returns the new function.
+ * @example
+ *
+ * var rearged = _.rearg(function(a, b, c) {
+ * return [a, b, c];
+ * }, 2, 0, 1);
+ *
+ * rearged('b', 'c', 'a')
+ * // => ['a', 'b', 'c']
+ *
+ * var map = _.rearg(_.map, [1, 0]);
+ * map(function(n) { return n * 3; }, [1, 2, 3]);
+ * // => [3, 6, 9]
+ */
+ function rearg(func) {
+ var indexes = baseFlatten(arguments, false, false, 1);
+ return indexes.length
+ ? createWrapper(func, REARG_FLAG, null, null, null, [indexes])
+ : createWrapper(func);
}
/**
@@ -6884,64 +7026,8 @@
* // => '
fred, barney, & pebbles
'
*/
function wrap(value, wrapper) {
- return basePartial(wrapper, PARTIAL_FLAG, [value], []);
- }
-
- /*------------------------------------------------------------------------*/
-
- /**
- * Creates the cache used by `_.memoize`.
- *
- * @private
- * @static
- * @name Cache
- * @memberOf _.memoize
- */
- function MemCache() {
- this.__wrapped__ = {};
- }
-
- /**
- * Gets the value associated with `key`.
- *
- * @private
- * @name get
- * @memberOf _.memoize.Cache
- * @param {string} key The key of the value to retrieve.
- * @returns {*} Returns the cached value.
- */
- function memGet(key) {
- return this.__wrapped__[key];
- }
-
- /**
- * Checks if an entry for `key` exists.
- *
- * @private
- * @name get
- * @memberOf _.memoize.Cache
- * @param {string} key The name of the entry to check.
- * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
- */
- function memHas(key) {
- return key != '__proto__' && hasOwnProperty.call(this.__wrapped__, key);
- }
-
- /**
- * Sets the value associated with `key`.
- *
- * @private
- * @name get
- * @memberOf _.memoize.Cache
- * @param {string} key The key of the value to set.
- * @param {*} value The value to set.
- * @returns {Object} Returns the cache object.
- */
- function memSet(key, value) {
- if (key != '__proto__') {
- this.__wrapped__[key] = value;
- }
- return this;
+ wrapper = wrapper == null ? identity : wrapper;
+ return createWrapper(wrapper, PARTIAL_FLAG, null, [value]);
}
/*------------------------------------------------------------------------*/
@@ -7326,14 +7412,18 @@
* // => false
*/
function isFunction(value) {
- // avoid a Chakra bug in IE 11
- // https://github.com/jashkenas/underscore/issues/1621
+ // Use `|| false` to avoid a Chakra bug in compatibility modes of IE 11.
+ // See https://github.com/jashkenas/underscore/issues/1621.
return typeof value == 'function' || false;
}
- // fallback for older versions of Chrome and Safari
- if (isFunction(/x/)) {
+ // fallback for environments that return incorrect `typeof` operator results
+ if (isFunction(/x/) || !Uint8Array || !isFunction(Uint8Array)) {
isFunction = function(value) {
- return typeof value == 'function' && toString.call(value) == funcClass;
+ // the use of `Object#toString` avoids issues with the `typeof` operator
+ // in older versions of Chrome and Safari which return 'function' for
+ // regexes and modern Safari which returns 'object' for typed array
+ // constructors
+ return toString.call(value) == funcClass;
};
}
@@ -7360,8 +7450,8 @@
* // => false
*/
function isObject(value) {
- // avoid a V8 bug in Chrome 19-20
- // https://code.google.com/p/v8/issues/detail?id=2291
+ // Avoid a V8 bug in Chrome 19-20.
+ // See https://code.google.com/p/v8/issues/detail?id=2291.
var type = typeof value;
return type == 'function' || (value && type == 'object') || false;
}
@@ -7415,10 +7505,13 @@
* // => false
*/
function isNative(value) {
- if (isFunction(value)) {
+ if (value == null) {
+ return false;
+ }
+ if (toString.call(value) == funcClass) {
return reNative.test(fnToString.call(value));
}
- return (value && typeof value == 'object' &&
+ return (typeof value == 'object' &&
(isHostObject(value) ? reNative : reHostCtor).test(value)) || false;
}
@@ -7593,15 +7686,15 @@
* @returns {Object} Returns the destination object.
* @example
*
- * _.assign({ 'user': 'fred' }, { 'age': 40 }, { 'employer': 'slate' });
- * // => { 'user': 'fred', 'age': 40, 'employer': 'slate' }
+ * _.assign({ 'user': 'fred' }, { 'age': 40 }, { 'status': 'busy' });
+ * // => { 'user': 'fred', 'age': 40, 'status': 'busy' }
*
* var defaults = _.partialRight(_.assign, function(value, other) {
* return typeof value == 'undefined' ? other : value;
* });
*
- * defaults({ 'user': 'barney' }, { 'age': 36 }, { 'user': 'fred', 'employer': 'slate' });
- * // => { 'user': 'barney', 'age': 36, 'employer': 'slate' }
+ * defaults({ 'user': 'barney' }, { 'age': 36 }, { 'user': 'fred', 'status': 'busy' });
+ * // => { 'user': 'barney', 'age': 36, 'status': 'busy' }
*/
var assign = createAssigner(baseAssign);
@@ -7659,8 +7752,8 @@
* @returns {Object} Returns the destination object.
* @example
*
- * _.defaults({ 'user': 'barney' }, { 'age': 36 }, { 'user': 'fred', 'employer': 'slate' });
- * // => { 'user': 'barney', 'age': 36, 'employer': 'slate' }
+ * _.defaults({ 'user': 'barney' }, { 'age': 36 }, { 'user': 'fred', 'status': 'busy' });
+ * // => { 'user': 'barney', 'age': 36, 'status': 'busy' }
*/
function defaults(object) {
if (object == null) {
@@ -7694,14 +7787,12 @@
* @example
*
* var users = {
- * 'barney': { 'age': 36 },
- * 'fred': { 'age': 40, 'blocked': true },
- * 'pebbles': { 'age': 1 }
+ * 'barney': { 'age': 36, 'active': true },
+ * 'fred': { 'age': 40, 'active': false },
+ * 'pebbles': { 'age': 1, 'active': true }
* };
*
- * _.findKey(users, function(chr) {
- * return chr.age < 40;
- * });
+ * _.findKey(users, function(chr) { return chr.age < 40; });
* // => 'barney' (iteration order is not guaranteed)
*
* // using "_.where" callback shorthand
@@ -7709,8 +7800,8 @@
* // => 'pebbles'
*
* // using "_.pluck" callback shorthand
- * _.findKey(users, 'blocked');
- * // => 'fred'
+ * _.findKey(users, 'active');
+ * // => 'barney'
*/
function findKey(object, predicate, thisArg) {
predicate = getCallback(predicate, thisArg, 3);
@@ -7740,22 +7831,20 @@
* @example
*
* var users = {
- * 'barney': { 'age': 36, 'blocked': true },
- * 'fred': { 'age': 40 },
- * 'pebbles': { 'age': 1, 'blocked': true }
+ * 'barney': { 'age': 36, 'active': true },
+ * 'fred': { 'age': 40, 'active': false },
+ * 'pebbles': { 'age': 1, 'active': true }
* };
*
- * _.findLastKey(users, function(chr) {
- * return chr.age < 40;
- * });
- * // => returns `pebbles`, assuming `_.findKey` returns `barney`
+ * _.findLastKey(users, function(chr) { return chr.age < 40; });
+ * // => returns `pebbles` assuming `_.findKey` returns `barney`
*
* // using "_.where" callback shorthand
* _.findLastKey(users, { 'age': 40 });
* // => 'fred'
*
* // using "_.pluck" callback shorthand
- * _.findLastKey(users, 'blocked');
+ * _.findLastKey(users, 'active');
* // => 'pebbles'
*/
function findLastKey(object, predicate, thisArg) {
@@ -8033,8 +8122,7 @@
(isArray(object) || (support.nonEnumStrings && isString(object)) ||
(support.nonEnumArgs && isArguments(object))) && length) || 0;
- var keyIndex,
- Ctor = object.constructor,
+ var Ctor = object.constructor,
index = -1,
proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto,
isProto = proto === object,
@@ -8049,11 +8137,11 @@
// Lo-Dash skips the `constructor` property when it infers it is iterating
// over a `prototype` object because IE < 9 can't set the `[[Enumerable]]`
// attribute of an existing property and the `constructor` property of a
- // prototype defaults to non-enumerable.
+ // prototype defaults to non-enumerable
for (var key in object) {
if (!(skipProto && key == 'prototype') &&
!(skipErrorProps && (key == 'message' || key == 'name')) &&
- !(skipIndexes && (keyIndex = +key, keyIndex > -1 && keyIndex < length && keyIndex % 1 == 0)) &&
+ !(skipIndexes && isIndex(key, length)) &&
!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {
result.push(key);
}
@@ -8106,7 +8194,7 @@
* // => { 'a': 3, 'b': 6, 'c': 9 }
*
* var users = {
- * 'fred': { 'user': 'fred', 'age': 40 },
+ * 'fred': { 'user': 'fred', 'age': 40 },
* 'pebbles': { 'user': 'pebbles', 'age': 1 }
* };
*
@@ -9477,8 +9565,8 @@
* `undefined` or `0`, a `radix` of `10` is used unless `value` is a hexadecimal,
* in which case a `radix` of `16` is used.
*
- * **Note:** This method avoids differences in native ES3 and ES5 `parseInt`
- * implementations. See the [ES5 spec](http://es5.github.io/#E) for more details.
+ * **Note:** This method aligns with the ES5 implementation of `parseInt`.
+ * See the [ES5 spec](http://es5.github.io/#E) for more details.
*
* @static
* @memberOf _
@@ -9500,7 +9588,7 @@
parseInt = function(value, radix, guard) {
// Firefox < 21 and Opera < 15 follow ES3 for `parseInt` and
// Chrome fails to trim leading whitespace characters.
- // See https://code.google.com/p/v8/issues/detail?id=3109
+ // See https://code.google.com/p/v8/issues/detail?id=3109.
value = trim(value);
radix = guard ? 0 : +radix;
return nativeParseInt(value, radix || (reHexPrefix.test(value) ? 16 : 10));
@@ -9508,8 +9596,8 @@
}
/**
- * Creates a "_.pluck" style function which returns the `key` value of a
- * given object.
+ * Creates a "_.pluck" style function which returns the property value
+ * of `key` on a given object.
*
* @static
* @memberOf _
@@ -9526,17 +9614,43 @@
* var getName = _.property('user');
*
* _.map(users, getName);
- * // => ['barney', 'fred']
+ * // => ['fred', barney']
*
- * _.sortBy(users, getName);
- * // => [{ 'user': 'barney', 'age': 36 }, { 'user': 'fred', 'age': 40 }]
+ * _.pluck(_.sortBy(users, getName), 'user');
+ * // => ['barney', 'fred']
*/
function property(key) {
+ key = String(key);
return function(object) {
return object == null ? undefined : object[key];
};
}
+ /**
+ * The inverse of `_.property`; this method creates a function which returns
+ * the property value of a given key on `object`.
+ *
+ * @static
+ * @memberOf _
+ * @category Utility
+ * @param {Object} object The object to inspect.
+ * @returns {Function} Returns the new function.
+ * @example
+ *
+ * var fred = { 'user': 'fred', 'age': 40, 'active': true };
+ * _.map(['age', 'active'], _.propertyOf(fred));
+ * // => [40, true]
+ *
+ * var object = { 'a': 3, 'b': 1, 'c': 2 };
+ * _.sortBy(['a', 'b', 'c'], _.propertyOf(object));
+ * // => ['b', 'c', 'a']
+ */
+ function propertyOf(object) {
+ return function(key) {
+ return object == null ? undefined : object[key];
+ };
+ }
+
/**
* Produces a random number between `min` and `max` (inclusive). If only one
* argument is provided a number between `0` and the given number is returned.
@@ -9687,8 +9801,8 @@
* _.result(object, 'age');
* // => 40
*
- * _.result(object, 'employer', 'slate');
- * // => 'slate'
+ * _.result(object, 'status', 'busy');
+ * // => 'busy'
*/
function result(object, key, defaultValue) {
var value = object == null ? undefined : object[key];
@@ -9716,7 +9830,7 @@
* // => [3, 6, 4]
*
* _.times(3, function(n) { mage.castSpell(n); });
- * // => invokes `mage.castSpell(n)` three times, passing `n` of `0`, `1`, and `2` respectively
+ * // => invokes `mage.castSpell(n)` three times with `n` of `0`, `1`, and `2` respectively
*
* _.times(3, function(n) { this.cast(n); }, mage);
* // => also invokes `mage.castSpell(n)` three times
@@ -9764,13 +9878,16 @@
// ensure `new LodashWrapper` is an instance of `lodash`
LodashWrapper.prototype = lodash.prototype;
- // add functions to the memoize cache
- MemCache.prototype.get = memGet;
- MemCache.prototype.has = memHas;
- MemCache.prototype.set = memSet;
+ // add functions to the `Map` cache
+ MapCache.prototype.get = mapGet;
+ MapCache.prototype.has = mapHas;
+ MapCache.prototype.set = mapSet;
+
+ // add functions to the `Set` cache
+ SetCache.prototype.push = cachePush;
// assign cache to `_.memoize`
- memoize.Cache = MemCache;
+ memoize.Cache = MapCache;
// add functions that return wrapped values when chaining
lodash.after = after;
@@ -9834,9 +9951,11 @@
lodash.pick = pick;
lodash.pluck = pluck;
lodash.property = property;
+ lodash.propertyOf = propertyOf;
lodash.pull = pull;
lodash.pullAt = pullAt;
lodash.range = range;
+ lodash.rearg = rearg;
lodash.reject = reject;
lodash.remove = remove;
lodash.rest = rest;
@@ -10106,7 +10225,7 @@
return result;
};
- // add `LazyWrapper` methods to `LodashWrapper`
+ // add `LazyWrapper` methods to `lodash.prototype`
baseForOwn(LazyWrapper.prototype, function(func, methodName) {
var retUnwrapped = /^(?:first|last)$/.test(methodName);
@@ -10133,7 +10252,7 @@
};
});
- // add `Array.prototype` functions to `LodashWrapper`
+ // add `Array.prototype` functions to `lodash.prototype`
arrayEach(['concat', 'join', 'pop', 'push', 'shift', 'sort', 'splice', 'unshift'], function(methodName) {
var arrayFunc = arrayProto[methodName],
chainName = /^(?:push|sort|unshift)$/.test(methodName) ? 'tap' : 'thru',
diff --git a/dist/lodash.compat.min.js b/dist/lodash.compat.min.js
index fe03e4116..1e9d2f22a 100644
--- a/dist/lodash.compat.min.js
+++ b/dist/lodash.compat.min.js
@@ -4,79 +4,81 @@
* Build: `lodash -o ./dist/lodash.compat.js`
*/
;(function(){function n(n,t){for(var r=-1,e=n.length;++rt||!r||typeof n=="undefined"&&e)return 1;if(n=n&&9<=n&&13>=n||32==n||160==n||5760==n||6158==n||8192<=n&&(8202>=n||8232==n||8233==n||8239==n||8287==n||12288==n||65279==n)}function x(n,t){for(var r=-1,e=n.length,u=-1,o=[];++re&&(e=u)}return e}function $t(n){for(var t=-1,r=n.length,e=Gu;++tu(t,i)&&a.push(i);return a}function Ht(n,t){var r=n?n.length:0;if(!qr(r))return ar(n,t);for(var e=-1,u=Yr(n);++ec))return false}else{var g=p&&bu.call(n,"__wrapped__"),h=h&&bu.call(t,"__wrapped__");if(g||h)return cr(g?n.value():n,h?t.value():t,r,e,u,o);if(!s)return false;if(!a&&!p){switch(l){case yt:case dt:return+n==+t;case bt:return n!=+n?t!=+t:0==n?1/n==1/t:n==+t;
-case xt:case jt:return n==pu(t)}return false}if(Wt.support.argsClass||(c=De(n),i=De(t)),g=c?cu:n.constructor,l=i?cu:t.constructor,a){if(g.prototype.name!=l.prototype.name)return false}else if(p=!c&&bu.call(n,"constructor"),h=!i&&bu.call(t,"constructor"),p!=h||!p&&g!=l&&"constructor"in n&&"constructor"in t&&!(typeof g=="function"&&g instanceof g&&typeof l=="function"&&l instanceof l))return false;if(g=a?["message","name"]:mo(n),l=a?g:mo(t),c&&g.push("length"),i&&l.push("length"),c=g.length,p=l.length,c!=p&&!e)return false
-}for(u||(u=[]),o||(o=[]),l=u.length;l--;)if(u[l]==n)return o[l]==t;if(u.push(n),o.push(t),i=true,f)for(;i&&++le(f,p)&&((t||i)&&f.push(p),a.push(c))}return a}function br(n,t){for(var r=-1,e=t(n),u=e.length,o=uu(u);++rt||null==r)return r;if(3t?0:t)}function Gr(n,t,r){var e=n?n.length:0;return t=e-((r||null==t?1:t)||0),ne(n,0,0>t?0:t)}function Jr(n,t,r){var e=-1,u=n?n.length:0;for(t=Dr(t,r,3);++er?zu(e+r,0):r||0;else if(r)return r=te(n,t),n=n[r],(t===t?t===n:n!==n)?r:-1;return l(n,t,r)}function Qr(n){return Zr(n,1)
-}function ne(n,t,r){var e=-1,u=n?n.length:0,o=typeof r;if(r&&"number"!=o&&$r(n,t,r)&&(t=0,r=u),t=null==t?0:+t||0,0>t&&(t=-t>u?0:u+t),r="undefined"==o||r>u?u:+r||0,0>r&&(r+=u),r&&r==u&&!t)return c(n);for(u=t>r?0:r-t,r=uu(u);++er?zu(e+r,0):r||0:0,typeof n=="string"||!ho(n)&&Pe(n)?ri||r===Zu&&r===a)&&(i=r,a=n)}),a}function de(n,t){return ve(n,eu(t))}function me(n,t,r,e){return(ho(n)?u:yr)(n,Dr(t,e,4),r,3>arguments.length,Ht)
-}function _e(n,t,r,e){return(ho(n)?o:yr)(n,Dr(t,e,4),r,3>arguments.length,Qt)}function be(n){n=Vr(n);for(var t=-1,r=n.length,e=uu(r);++targuments.length)return Sr(n,k,null,t);
-var r=ne(arguments,2),e=x(r,je.placeholder);return gr(n,k|T,r,e,t)}function Ae(n,t){var r=k|F;if(2=r||r>t?(a&&Iu(a),r=p,a=s=p=I,r&&(h=jo(),f=n.apply(c,i),s||a||(i=c=null))):s=Du(e,r)}function u(){s&&Iu(s),a=s=p=I,(v||g!==t)&&(h=jo(),f=n.apply(c,i),s||a||(i=c=null))
-}function o(){if(i=arguments,l=jo(),c=this,p=v&&(s||!y),false===g)var r=y&&!s;else{a||y||(h=l);var o=g-(l-h),d=0>=o||o>g;d?(a&&(a=Iu(a)),h=l,f=n.apply(c,i)):a||(a=Du(u,o))}return d&&s?s=Iu(s):s||t===g||(s=Du(e,t)),r&&(d=true,f=n.apply(c,i)),!d||s||a||(i=c=null),f}var i,a,f,l,c,s,p,h=0,g=false,v=true;if(!Ue(n))throw new hu(B);if(t=0>t?0:t,true===r)var y=true,v=false;else We(r)&&(y=r.leading,g="maxWait"in r&&zu(+r.maxWait||0,t),v="trailing"in r?r.trailing:v);return o.cancel=function(){s&&Iu(s),a&&Iu(a),a=s=p=I},o}function Oe(){var n=arguments,r=n.length-1;
-if(0>r)return function(){};if(!t(n,Ue))throw new hu(B);return function(){for(var t=r,e=n[t].apply(this,arguments);t--;)e=n[t].call(this,e);return e}}function ke(n,t){function r(){var e=r.cache,u=t?t.apply(this,arguments):arguments[0];if(e.has(u))return e.get(u);var o=n.apply(this,arguments);return e.set(u,o),o}if(!Ue(n)||t&&!Ue(t))throw new hu(B);return r.cache=new ke.Cache,r}function Fe(n){var t=ne(arguments,1),r=x(t,Fe.placeholder);return gr(n,T,t,r)}function Re(n){var t=ne(arguments,1),r=x(t,Re.placeholder);
-return gr(n,N,t,r)}function Se(){this.__wrapped__={}}function De(n){return qr(n&&typeof n=="object"?n.length:I)&&xu.call(n)==gt||false}function Te(n){return n&&typeof n=="object"&&1===n.nodeType&&(Wt.support.nodeClass?-1t||null==n||!qu(t))return r;n=pu(n);do t%2&&(r+=n),t=Ou(t/2),n+=n;while(t);return r}function Ze(n,t,r){return(n=null==n?"":pu(n))?r||null==t?n.slice(j(n),A(n)+1):(t=pu(t),n.slice(h(n,t),g(n,t)+1)):n}function Ge(n,t,r){return(n=null!=n&&pu(n))&&n.match((r?null:t)||ct)||[]}function Je(n){try{return n()}catch(t){return Ne(t)?t:iu(t)}}function Xe(n,t,r){return Kt(n,r?I:t)}function He(n){return n}function Qe(n){var t=mo(n),r=t.length;if(1==r){var e=t[0],u=n[e];if(Pr(u))return function(n){return null!=n&&u===n[e]&&bu.call(n,e)
-}}for(var o=r,i=uu(r),a=uu(r);o--;){var u=n[t[o]],f=Pr(u);i[o]=f?u:Vt(u,true,Bt),a[o]=f}return function(n){if(o=r,null==n)return!o;for(;o--;)if(a[o]?i[o]!==n[t[o]]:!bu.call(n,t[o]))return false;for(o=r;o--;)if(a[o]?!bu.call(n,t[o]):!cr(i[o],n[t[o]],null,true))return false;return true}}function nu(n,t,r){var e=true,u=We(t),o=null==r,i=o&&u&&mo(t),a=i&&lr(t,i);(i&&i.length&&!a.length||o&&!u)&&(o&&(r=t),a=false,t=n,n=this),a||(a=lr(t,mo(t))),false===r?e=false:We(r)&&"chain"in r&&(e=r.chain),r=-1,u=Ue(n);for(o=a.length;++r=L)return r}else n=0;return uo(r,e)}}(),fo=Ar(function(n,t,r){bu.call(n,r)?++n[r]:n[r]=1}),lo=Ar(function(n,t,r){bu.call(n,r)?n[r].push(t):n[r]=[t]}),co=Ar(function(n,t,r){n[r]=t}),so=Ar(function(n,t,r){n[r?0:1].push(t)
-},function(){return[[],[]]}),po=gr(xe,T,[2],[]);eo.argsClass||(De=function(n){return qr(n&&typeof n=="object"?n.length:I)&&bu.call(n,"callee")&&!Ru.call(n,"callee")||false});var ho=$u||function(n){return n&&typeof n=="object"&&typeof n.length=="number"&&xu.call(n)==vt||false};eo.dom||(Te=function(n){return n&&typeof n=="object"&&1===n.nodeType&&!vo(n)||false});var go=Ku||function(n){return typeof n=="number"&&qu(n)};Ue(/x/)&&(Ue=function(n){return typeof n=="function"&&xu.call(n)==_t});var vo=ku?function(n){if(!n||xu.call(n)!=wt||!Wt.support.argsClass&&De(n))return false;
-var t=n.valueOf,r=Le(t)&&(r=ku(t))&&ku(r);return r?n==r||ku(n)==r:Mr(n)}:Mr,yo=Er(Mt),mo=Pu?function(n){if(n)var t=n.constructor,r=n.length;return typeof t=="function"&&t.prototype===n||typeof r=="number"&&0--n?t.apply(this,arguments):void 0
-}},Wt.assign=yo,Wt.at=function(n){return(!n||qr(n.length))&&(n=Vr(n)),a(n,er(arguments,false,false,1))},Wt.before=xe,Wt.bind=je,Wt.bindAll=function(n){for(var t=n,r=1(p?s(p,i):u(c,i))){for(t=r;--t;){var h=e[t];if(0>(h?s(h,i):u(n[t],i)))continue n}p&&p.push(i),c.push(i)
-}return c},Wt.invert=function(n,t,r){t=r?null:t,r=-1;for(var e=mo(n),u=e.length,o={};++rt?0:t)},Wt.takeRight=function(n,t,r){var e=n?n.length:0;return t=e-((r||null==t?1:t)||0),ne(n,0>t?0:t)},Wt.takeRightWhile=function(n,t,r){var e=n?n.length:0;for(t=Dr(t,r,3);e--&&t(n[e],e,n););return ne(n,e+1)},Wt.takeWhile=function(n,t,r){var e=-1,u=n?n.length:0;for(t=Dr(t,r,3);++er?0:+r||0,e))-t.length,0<=r&&n.indexOf(t,r)==r},Wt.escape=function(n){return(n=null==n?"":pu(n))&&(J.lastIndex=0,J.test(n))?n.replace(J,m):n},Wt.escapeRegExp=Ve,Wt.every=ce,Wt.find=pe,Wt.findIndex=Jr,Wt.findKey=function(n,t,r){return t=Dr(t,r,3),rr(n,t,ar,true)
-},Wt.findLast=function(n,t,r){return t=Dr(t,r,3),rr(n,t,Qt)},Wt.findLastIndex=function(n,t,r){var e=n?n.length:0;for(t=Dr(t,r,3);e--;)if(t(n[e],e,n))return e;return-1},Wt.findLastKey=function(n,t,r){return t=Dr(t,r,3),rr(n,t,fr,true)},Wt.findWhere=function(n,t){return pe(n,Qe(t))},Wt.first=Xr,Wt.has=function(n,t){return n?bu.call(n,t):false},Wt.identity=He,Wt.indexOf=Hr,Wt.isArguments=De,Wt.isArray=ho,Wt.isBoolean=function(n){return true===n||false===n||n&&typeof n=="object"&&xu.call(n)==yt||false},Wt.isDate=function(n){return n&&typeof n=="object"&&xu.call(n)==dt||false
-},Wt.isElement=Te,Wt.isEmpty=function(n){if(null==n)return true;var t=n.length;return qr(t)&&(ho(n)||Pe(n)||De(n)||typeof n=="object"&&Ue(n.splice))?!t:!mo(n).length},Wt.isEqual=function(n,t,r,e){return r=typeof r=="function"&&Kt(r,e,3),!r&&Pr(n)&&Pr(t)?n===t:cr(n,t,r)},Wt.isError=Ne,Wt.isFinite=go,Wt.isFunction=Ue,Wt.isNaN=function(n){return $e(n)&&n!=+n},Wt.isNative=Le,Wt.isNull=function(n){return null===n},Wt.isNumber=$e,Wt.isObject=We,Wt.isPlainObject=vo,Wt.isRegExp=qe,Wt.isString=Pe,Wt.isUndefined=function(n){return typeof n=="undefined"
-},Wt.kebabCase=wo,Wt.last=function(n){var t=n?n.length:0;return t?n[t-1]:I},Wt.lastIndexOf=function(n,t,r){var e=n?n.length:0;if(!e)return-1;var u=e;if(typeof r=="number")u=(0>r?zu(e+r,0):Bu(r||0,e-1))+1;else if(r)return u=re(n,t)-1,n=n[u],(t===t?t===n:n!==n)?u:-1;if(t!==t)return b(n,u,true);for(;u--;)if(n[u]===t)return u;return-1},Wt.max=ye,Wt.min=function(n,t,r){r&&$r(n,t,r)&&(t=null);var e=null==t,u=e&&ho(n),o=!u&&Pe(n);if(e&&!o)return $t(u?n:Vr(n));var i=Gu,a=i;return t=e&&o?p:Dr(t,r,3),Ht(n,function(n,r,e){r=t(n,r,e),(rr?0:+r||0,n.length),n.lastIndexOf(t,r)==r},Wt.template=function(n,t,r){var e=Wt.templateSettings;r&&$r(n,t,r)&&(t=r=null),n=pu(null==n?"":n),t=yo({},r||t,e,Pt),r=yo({},t.imports,e.imports,Pt);
-var u,o,i=mo(r),a=Me(r),f=0;r=t.interpolate||it;var l="__p+='";if(r=su((t.escape||it).source+"|"+r.source+"|"+(r===Q?nt:it).source+"|"+(t.evaluate||it).source+"|$","g"),n.replace(r,function(t,r,e,i,a,c){return e||(e=i),l+=n.slice(f,c).replace(lt,_),r&&(u=true,l+="'+__e("+r+")+'"),a&&(o=true,l+="';"+a+";\n__p+='"),e&&(l+="'+((__t=("+e+"))==null?'':__t)+'"),f=c+t.length,t}),l+="';",(t=t.variable)||(l="with(obj){"+l+"}"),l=(o?l.replace(V,""):l).replace(Y,"$1").replace(Z,"$1;"),l="function("+(t||"obj")+"){"+(t?"":"obj||(obj={});")+"var __t,__p=''"+(u?",__e=_.escape":"")+(o?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+l+"return __p}",t=Je(function(){return au(i,"return "+l).apply(I,a)
-}),t.source=l,Ne(t))throw t;return t},Wt.trim=Ze,Wt.trimLeft=function(n,t,r){return(n=null==n?"":pu(n))?r||null==t?n.slice(j(n)):(t=pu(t),n.slice(h(n,t))):n},Wt.trimRight=function(n,t,r){return(n=null==n?"":pu(n))?r||null==t?n.slice(0,A(n)+1):(t=pu(t),n.slice(0,g(n,t)+1)):n},Wt.trunc=function(n,t,r){t=r?null:t;var e=U;if(r=W,We(t)){var u="separator"in t?t.separator:u,e="length"in t?+t.length||0:e;r="omission"in t?pu(t.omission):r}else null!=t&&(e=+t||0);if(n=null==n?"":pu(n),e>=n.length)return n;
-if(e-=r.length,1>e)return r;if(t=n.slice(0,e),null==u)return t+r;if(qe(u)){if(n.slice(e).search(u)){var o,i=n.slice(0,e);for(u.global||(u=su(u.source,(tt.exec(u)||"")+"g")),u.lastIndex=0;n=u.exec(i);)o=n.index;t=t.slice(0,null==o?e:o)}}else n.indexOf(u,e)!=e&&(u=t.lastIndexOf(u),-1t?0:+t||0,n.length),n)},Wt.prototype.sample=function(n,t){return n=t?null:n,this.__chain__||null!=n?this.thru(function(t){return Wt.sample(t,n)}):Wt.sample(this.value())},Wt.VERSION=O,n("bind bindKey curry curryRight partial partialRight".split(" "),function(n){Wt[n].placeholder=Wt}),n(["filter","map","takeWhile"],function(n,t){fe.prototype[n]=function(n,r){n=Dr(n,r,3);
-var e=this.clone(),u=e.filtered,o=e.iteratees||(e.iteratees=[]);return e.filtered=u||t==q||t==z&&0>e.dir,o.push({iteratee:n,type:t}),e}}),n(["drop","take"],function(n,t){var r=n+"Count",e=n+"While";fe.prototype[n]=function(e){e=null==e?1:zu(+e||0,0);var u=this.clone();if(u.filtered){var o=u[r];u[r]=t?Bu(o,e):o+e}else(u.views||(u.views=[])).push({size:e,type:n+(0>u.dir?"Right":"")});return u},fe.prototype[n+"Right"]=function(t){return this.reverse()[n](t).reverse()},fe.prototype[n+"RightWhile"]=function(n,t){return this.reverse()[e](n,t).reverse()
-}}),n(["first","last"],function(n,t){var r="take"+(t?"Right":"");fe.prototype[n]=function(){return this[r](1).value()[0]}}),n(["initial","rest"],function(n,t){var r="drop"+(t?"":"Right");fe.prototype[n]=function(){return this[r](1)}}),fe.prototype.dropWhile=function(n,t){n=Dr(n,t,3);var r,e,u=0>this.dir;return this.filter(function(t,o,i){return r=r&&(u?oe),e=o,r||(r=!n(t,o,i))})},fe.prototype.reject=function(n,t){return n=Dr(n,t,3),this.filter(function(t,r,e){return!n(t,r,e)})},fe.prototype.slice=function(n,t){n=null==n?0:+n||0;
-var r=0>n?this.takeRight(-n):this.drop(n);return typeof t!="undefined"&&(t=+t||0,r=0>t?r.dropRight(-t):r.take(t-n)),r},ar(fe.prototype,function(n,t){var r=/^(?:first|last)$/.test(t);Wt.prototype[t]=function(){var e=arguments,u=this.__chain__,o=this.__wrapped__,i=o instanceof fe;return r&&!u?i?n.call(o):Wt[t](this.value()):i||ho(o)?(o=n.apply(i?o:new fe(this),e),new ae(o,u)):this.thru(function(n){return n=[n],Fu.apply(n,e),Wt[t].apply(Wt,n)})}}),n("concat join pop push shift sort splice unshift".split(" "),function(n){var t=gu[n],r=/^(?:push|sort|unshift)$/.test(n)?"tap":"thru",e=/^(?:join|pop|shift)$/.test(n),u=eo.spliceObjects||!/^(?:pop|shift|splice)$/.test(n)?t:function(){var n=t.apply(this,arguments);
-return 0===this.length&&delete this[0],n};Wt.prototype[n]=function(){var n=arguments;return e&&!this.__chain__?u.apply(this.value(),n):this[r](function(t){return u.apply(t,n)})}}),fe.prototype.clone=function(){var n=this.iteratees,t=this.views,r=new fe(this.wrapped);return r.dir=this.dir,r.dropCount=this.dropCount,r.filtered=this.filtered,r.iteratees=n?c(n):null,r.takeCount=this.takeCount,r.views=t?c(t):null,r},fe.prototype.reverse=function(){var n=this.filtered,t=n?new fe(this):this.clone();return t.dir=-1*this.dir,t.filtered=n,t
-},fe.prototype.value=function(){var n,t=this.wrapped.value(),r=this.dir,e=0>r,u=t.length;n=u;for(var o=this.views,i=0,a=-1,f=o?o.length:0;++a"'`]/g,X=/<%-([\s\S]+?)%>/g,H=/<%([\s\S]+?)%>/g,Q=/<%=([\s\S]+?)%>/g,nt=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,tt=/\w*$/,rt=/^\s*function[ \n\r\t]+\w/,et=/^0[xX]/,ut=/^\[object .+?Constructor\]$/,ot=/[\xC0-\xD6\xD8-\xDE\xDF-\xF6\xF8-\xFF]/g,it=/($^)/,at=/[.*+?^${}()|[\]\/\\]/g,ft=/\bthis\b/,lt=/['\n\r\u2028\u2029\\]/g,ct=RegExp("[A-Z\\xC0-\\xD6\\xD8-\\xDE]{2,}(?=[A-Z\\xC0-\\xD6\\xD8-\\xDE][a-z\\xDF-\\xF6\\xF8-\\xFF]+)|[A-Z\\xC0-\\xD6\\xD8-\\xDE]?[a-z\\xDF-\\xF6\\xF8-\\xFF]+|[A-Z\\xC0-\\xD6\\xD8-\\xDE]+|[0-9]+","g"),st=" \t\x0B\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000",pt="Array ArrayBuffer Date Error Float32Array Float64Array Function Int8Array Int16Array Int32Array Math Number Object RegExp Set String _ clearTimeout document isFinite parseInt setTimeout TypeError Uint8Array Uint8ClampedArray Uint16Array Uint32Array WeakMap window WinRTError".split(" "),ht="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" "),gt="[object Arguments]",vt="[object Array]",yt="[object Boolean]",dt="[object Date]",mt="[object Error]",_t="[object Function]",bt="[object Number]",wt="[object Object]",xt="[object RegExp]",jt="[object String]",At="[object ArrayBuffer]",Et="[object Float32Array]",Ct="[object Float64Array]",It="[object Int8Array]",Ot="[object Int16Array]",kt="[object Int32Array]",Ft="[object Uint8Array]",Rt="[object Uint8ClampedArray]",St="[object Uint16Array]",Dt="[object Uint32Array]",Tt={};
-Tt[gt]=Tt[vt]=Tt[Et]=Tt[Ct]=Tt[It]=Tt[Ot]=Tt[kt]=Tt[Ft]=Tt[Rt]=Tt[St]=Tt[Dt]=true,Tt[At]=Tt[yt]=Tt[dt]=Tt[mt]=Tt[_t]=Tt["[object Map]"]=Tt[bt]=Tt[wt]=Tt[xt]=Tt["[object Set]"]=Tt[jt]=Tt["[object WeakMap]"]=false;var Nt={};Nt[gt]=Nt[vt]=Nt[At]=Nt[yt]=Nt[dt]=Nt[Et]=Nt[Ct]=Nt[It]=Nt[Ot]=Nt[kt]=Nt[bt]=Nt[wt]=Nt[xt]=Nt[jt]=Nt[Ft]=Nt[Rt]=Nt[St]=Nt[Dt]=true,Nt[mt]=Nt[_t]=Nt["[object Map]"]=Nt["[object Set]"]=Nt["[object WeakMap]"]=false;var Ut={leading:false,maxWait:0,trailing:false},Wt={"\xc0":"A","\xc1":"A","\xc2":"A","\xc3":"A","\xc4":"A","\xc5":"A","\xe0":"a","\xe1":"a","\xe2":"a","\xe3":"a","\xe4":"a","\xe5":"a","\xc7":"C","\xe7":"c","\xd0":"D","\xf0":"d","\xc8":"E","\xc9":"E","\xca":"E","\xcb":"E","\xe8":"e","\xe9":"e","\xea":"e","\xeb":"e","\xcc":"I","\xcd":"I","\xce":"I","\xcf":"I","\xec":"i","\xed":"i","\xee":"i","\xef":"i","\xd1":"N","\xf1":"n","\xd2":"O","\xd3":"O","\xd4":"O","\xd5":"O","\xd6":"O","\xd8":"O","\xf2":"o","\xf3":"o","\xf4":"o","\xf5":"o","\xf6":"o","\xf8":"o","\xd9":"U","\xda":"U","\xdb":"U","\xdc":"U","\xf9":"u","\xfa":"u","\xfb":"u","\xfc":"u","\xdd":"Y","\xfd":"y","\xff":"y","\xc6":"Ae","\xe6":"ae","\xde":"Th","\xfe":"th","\xdf":"ss"},Lt={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"},$t={"&":"&","<":"<",">":">",""":'"',"'":"'","`":"`"},qt={"function":true,object:true},Pt={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},zt=qt[typeof window]&&window!==(this&&this.window)?window:this,Bt=qt[typeof exports]&&exports&&!exports.nodeType&&exports,Mt=qt[typeof module]&&module&&!module.nodeType&&module,Kt=Bt&&Mt&&typeof global=="object"&&global;
-!Kt||Kt.global!==Kt&&Kt.window!==Kt&&Kt.self!==Kt||(zt=Kt);var Vt=Mt&&Mt.exports===Bt&&Bt,Yt=function(){try{String({toString:0}+"")}catch(n){return function(){return false}}return function(n){return typeof n.toString!="function"&&typeof(n+"")=="string"}}(),Zt=C();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(zt._=Zt, define(function(){return Zt})):Bt&&Mt?Vt?(Mt.exports=Zt)._=Zt:Bt._=Zt:zt._=Zt}).call(this);
\ No newline at end of file
+return r}function i(n,t){for(var r=-1,e=n.length;++rt||!r||typeof n=="undefined"&&e)return 1;if(n=n&&9<=n&&13>=n||32==n||160==n||5760==n||6158==n||8192<=n&&(8202>=n||8232==n||8233==n||8239==n||8287==n||12288==n||65279==n)
+}function w(n,t){for(var r=-1,e=n.length,u=-1,o=[];++re&&(e=u)}return e}function Kt(n){for(var t=-1,r=n.length,e=Hu;++tu(t,i)&&a.push(i);return a}function rr(n,t){var r=n?n.length:0;if(!Mr(r))return sr(n,t);for(var e=-1,u=Hr(n);++ec))return false}else{var g=p&&ju.call(n,"__wrapped__"),h=h&&ju.call(t,"__wrapped__");if(g||h)return gr(g?n.value():n,h?t.value():t,r,e,u,o);if(!s)return false;if(!a&&!p){switch(l){case yt:case dt:return+n==+t;case bt:return n!=+n?t!=+t:0==n?1/n==1/t:n==+t;case xt:case jt:return n==vu(t)}return false}if(Lt.support.argsClass||(c=Ue(n),i=Ue(t)),g=c?hu:n.constructor,l=i?hu:t.constructor,a){if(g.prototype.name!=l.prototype.name)return false}else if(p=!c&&ju.call(n,"constructor"),h=!i&&ju.call(t,"constructor"),p!=h||!p&&g!=l&&"constructor"in n&&"constructor"in t&&!(typeof g=="function"&&g instanceof g&&typeof l=="function"&&l instanceof l))return false;
+if(g=a?["message","name"]:wo(n),l=a?g:wo(t),c&&g.push("length"),i&&l.push("length"),c=g.length,p=l.length,c!=p&&!e)return false}for(u||(u=[]),o||(o=[]),l=u.length;l--;)if(u[l]==n)return o[l]==t;if(u.push(n),o.push(t),i=true,f)for(;i&&++le(a,s)&&((t||i)&&a.push(s),l.push(c))}return l}function jr(n,t){for(var r=-1,e=t(n),u=e.length,o=au(u);++rt||null==r)return r;
+if(3t?0:t)}function ne(n,t,r){var e=n?n.length:0;return t=e-((r||null==t?1:t)||0),oe(n,0,0>t?0:t)}function te(n,t,r){var e=-1,u=n?n.length:0;for(t=Lr(t,r,3);++er?Ku(e+r,0):r||0;else if(r)return r=ie(n,t),n=n[r],(t===t?t===n:n!==n)?r:-1;return f(n,t,r)}function ue(n){return Qr(n,1)
+}function oe(n,t,r){var e=-1,u=n?n.length:0,o=typeof r;if(r&&"number"!=o&&Dr(n,t,r)&&(t=0,r=u),t=null==t?0:+t||0,0>t&&(t=-t>u?0:u+t),r="undefined"==o||r>u?u:+r||0,0>r&&(r+=u),r&&r==u&&!t)return l(n);for(u=t>r?0:r-t,r=au(u);++er?Ku(e+r,0):r||0:0,typeof n=="string"||!yo(n)&&De(n)?ri||r===Xu&&r===a)&&(i=r,a=n)}),a}function be(n,t){return me(n,iu(t))}function we(n,t,r,e){return(yo(n)?u:_r)(n,Lr(t,e,4),r,3>arguments.length,rr)}function xe(n,t,r,e){return(yo(n)?o:_r)(n,Lr(t,e,4),r,3>arguments.length,er)}function je(n){n=Xr(n);for(var t=-1,r=n.length,e=au(r);++t=r||r>t?(a&&Ru(a),r=p,a=s=p=I,r&&(h=Io(),f=n.apply(c,i),s||a||(i=c=null))):s=Wu(e,r)}function u(){s&&Ru(s),a=s=p=I,(v||g!==t)&&(h=Io(),f=n.apply(c,i),s||a||(i=c=null))}function o(){if(i=arguments,l=Io(),c=this,p=v&&(s||!y),false===g)var r=y&&!s;else{a||y||(h=l);var o=g-(l-h),d=0>=o||o>g;d?(a&&(a=Ru(a)),h=l,f=n.apply(c,i)):a||(a=Wu(u,o))}return d&&s?s=Ru(s):s||t===g||(s=Wu(e,t)),r&&(d=true,f=n.apply(c,i)),!d||s||a||(i=c=null),f
+}var i,a,f,l,c,s,p,h=0,g=false,v=true;if(!$e(n))throw new yu(D);if(t=0>t?0:t,true===r)var y=true,v=false;else qe(r)&&(y=r.leading,g="maxWait"in r&&Ku(+r.maxWait||0,t),v="trailing"in r?r.trailing:v);return o.cancel=function(){s&&Ru(s),a&&Ru(a),a=s=p=I},o}function Se(){var n=arguments,r=n.length-1;if(0>r)return function(){};if(!t(n,$e))throw new yu(D);return function(){for(var t=r,e=n[t].apply(this,arguments);t--;)e=n[t].call(this,e);return e}}function Fe(n,t){function r(){var e=r.cache,u=t?t.apply(this,arguments):arguments[0];
+if(e.has(u))return e.get(u);var o=n.apply(this,arguments);return e.set(u,o),o}if(!$e(n)||t&&!$e(t))throw new yu(D);return r.cache=new Fe.Cache,r}function Te(n){var t=oe(arguments,1),r=w(t,Te.placeholder);return Wr(n,T,null,t,r)}function Ne(n){var t=oe(arguments,1),r=w(t,Ne.placeholder);return Wr(n,N,null,t,r)}function Ue(n){return Mr(n&&typeof n=="object"?n.length:I)&&Eu.call(n)==gt||false}function We(n){return n&&typeof n=="object"&&1===n.nodeType&&(Lt.support.nodeClass?-1t||null==n||!Du(t))return r;n=vu(n);do t%2&&(r+=n),t=Su(t/2),n+=n;while(t);return r}function Je(n,t,r){return(n=null==n?"":vu(n))?r||null==t?n.slice(x(n),j(n)+1):(t=vu(t),n.slice(s(n,t),p(n,t)+1)):n
+}function Xe(n,t,r){return(n=null!=n&&vu(n))&&n.match((r?null:t)||ct)||[]}function He(n){try{return n()}catch(t){return Le(t)?t:lu(t)}}function Qe(n,t,r){return Ht(n,r?I:t)}function nu(n){return function(){return n}}function tu(n){return n}function ru(n){var t=wo(n),r=t.length;if(1==r){var e=t[0],u=n[e];if(Kr(u))return function(n){return null!=n&&u===n[e]&&ju.call(n,e)}}for(var o=r,i=au(r),a=au(r);o--;){var u=n[t[o]],f=Kr(u);i[o]=f?u:Qt(u,true,Er),a[o]=f}return function(n){if(o=r,null==n)return!o;for(;o--;)if(a[o]?i[o]!==n[t[o]]:!ju.call(n,t[o]))return false;
+for(o=r;o--;)if(a[o]?!ju.call(n,t[o]):!gr(i[o],n[t[o]],null,true))return false;return true}}function eu(n,t,r){var e=true,u=qe(t),o=null==r,i=o&&u&&wo(t),a=i&&hr(t,i);(i&&i.length&&!a.length||o&&!u)&&(o&&(r=t),a=false,t=n,n=this),a||(a=hr(t,wo(t))),false===r?e=false:qe(r)&&"chain"in r&&(e=r.chain),r=-1,u=$e(n);for(o=a.length;++r=$)return r}else n=0;return ao(r,e)}}(),so=Cr(function(n,t,r){ju.call(n,r)?++n[r]:n[r]=1}),po=Cr(function(n,t,r){ju.call(n,r)?n[r].push(t):n[r]=[t]}),ho=Cr(function(n,t,r){n[r]=t}),go=Cr(function(n,t,r){n[r?0:1].push(t)},function(){return[[],[]]
+}),vo=Wr(Ee,T,null,[2]);io.argsClass||(Ue=function(n){return Mr(n&&typeof n=="object"?n.length:I)&&ju.call(n,"callee")&&!Nu.call(n,"callee")||false});var yo=Bu||function(n){return n&&typeof n=="object"&&typeof n.length=="number"&&Eu.call(n)==vt||false};io.dom||(We=function(n){return n&&typeof n=="object"&&1===n.nodeType&&!_o(n)||false});var mo=Zu||function(n){return typeof n=="number"&&Du(n)};!$e(/x/)&&$u&&$e($u)||($e=function(n){return Eu.call(n)==_t});var _o=Fu?function(n){if(!n||Eu.call(n)!=wt||!Lt.support.argsClass&&Ue(n))return false;
+var t=n.valueOf,r=Pe(t)&&(r=Fu(t))&&Fu(r);return r?n==r||Fu(n)==r:Gr(n)}:Gr,bo=kr(Jt),wo=Mu?function(n){if(n)var t=n.constructor,r=n.length;return typeof t=="function"&&t.prototype===n||typeof r=="number"&&0--n?t.apply(this,arguments):void 0}},Lt.assign=bo,Lt.at=function(n){return(!n||Mr(n.length))&&(n=Xr(n)),Xt(n,ar(arguments,false,false,1))},Lt.before=Ee,Lt.bind=Ie,Lt.bindAll=function(n){for(var t=n,r=1(s?Dt(s,i):u(c,i))){for(t=r;--t;){var p=e[t];if(0>(p?Dt(p,i):u(n[t],i)))continue n}s&&s.push(i),c.push(i)
+}return c},Lt.invert=function(n,t,r){t=r?null:t,r=-1;for(var e=wo(n),u=e.length,o={};++rt?0:t)},Lt.takeRight=function(n,t,r){var e=n?n.length:0;return t=e-((r||null==t?1:t)||0),oe(n,0>t?0:t)},Lt.takeRightWhile=function(n,t,r){var e=n?n.length:0;for(t=Lr(t,r,3);e--&&t(n[e],e,n););return oe(n,e+1)},Lt.takeWhile=function(n,t,r){var e=-1,u=n?n.length:0;for(t=Lr(t,r,3);++er?0:+r||0,e))-t.length,0<=r&&n.indexOf(t,r)==r},Lt.escape=function(n){return(n=null==n?"":vu(n))&&(J.lastIndex=0,J.test(n))?n.replace(J,y):n},Lt.escapeRegExp=Ze,Lt.every=he,Lt.find=ve,Lt.findIndex=te,Lt.findKey=function(n,t,r){return t=Lr(t,r,3),ir(n,t,sr,true)},Lt.findLast=function(n,t,r){return t=Lr(t,r,3),ir(n,t,er)
+},Lt.findLastIndex=function(n,t,r){var e=n?n.length:0;for(t=Lr(t,r,3);e--;)if(t(n[e],e,n))return e;return-1},Lt.findLastKey=function(n,t,r){return t=Lr(t,r,3),ir(n,t,pr,true)},Lt.findWhere=function(n,t){return ve(n,ru(t))},Lt.first=re,Lt.has=function(n,t){return n?ju.call(n,t):false},Lt.identity=tu,Lt.indexOf=ee,Lt.isArguments=Ue,Lt.isArray=yo,Lt.isBoolean=function(n){return true===n||false===n||n&&typeof n=="object"&&Eu.call(n)==yt||false},Lt.isDate=function(n){return n&&typeof n=="object"&&Eu.call(n)==dt||false
+},Lt.isElement=We,Lt.isEmpty=function(n){if(null==n)return true;var t=n.length;return Mr(t)&&(yo(n)||De(n)||Ue(n)||typeof n=="object"&&$e(n.splice))?!t:!wo(n).length},Lt.isEqual=function(n,t,r,e){return r=typeof r=="function"&&Ht(r,e,3),!r&&Kr(n)&&Kr(t)?n===t:gr(n,t,r)},Lt.isError=Le,Lt.isFinite=mo,Lt.isFunction=$e,Lt.isNaN=function(n){return ze(n)&&n!=+n},Lt.isNative=Pe,Lt.isNull=function(n){return null===n},Lt.isNumber=ze,Lt.isObject=qe,Lt.isPlainObject=_o,Lt.isRegExp=Be,Lt.isString=De,Lt.isUndefined=function(n){return typeof n=="undefined"
+},Lt.kebabCase=Ao,Lt.last=function(n){var t=n?n.length:0;return t?n[t-1]:I},Lt.lastIndexOf=function(n,t,r){var e=n?n.length:0;if(!e)return-1;var u=e;if(typeof r=="number")u=(0>r?Ku(e+r,0):Vu(r||0,e-1))+1;else if(r)return u=ae(n,t)-1,n=n[u],(t===t?t===n:n!==n)?u:-1;if(t!==t)return m(n,u,true);for(;u--;)if(n[u]===t)return u;return-1},Lt.max=_e,Lt.min=function(n,t,r){r&&Dr(n,t,r)&&(t=null);var e=null==t,u=e&&yo(n),o=!u&&De(n);if(e&&!o)return Kt(u?n:Xr(n));var i=Hu,a=i;return t=e&&o?c:Lr(t,r,3),rr(n,function(n,r,e){r=t(n,r,e),(rr?0:+r||0,n.length),n.lastIndexOf(t,r)==r},Lt.template=function(n,t,r){var e=Lt.templateSettings;r&&Dr(n,t,r)&&(t=r=null),n=vu(null==n?"":n),t=bo({},r||t,e,Gt),r=bo({},t.imports,e.imports,Gt);
+var u,o,i=wo(r),a=Ve(r),f=0;r=t.interpolate||it;var l="__p+='";if(r=gu((t.escape||it).source+"|"+r.source+"|"+(r===Q?nt:it).source+"|"+(t.evaluate||it).source+"|$","g"),n.replace(r,function(t,r,e,i,a,c){return e||(e=i),l+=n.slice(f,c).replace(lt,d),r&&(u=true,l+="'+__e("+r+")+'"),a&&(o=true,l+="';"+a+";\n__p+='"),e&&(l+="'+((__t=("+e+"))==null?'':__t)+'"),f=c+t.length,t}),l+="';",(t=t.variable)||(l="with(obj){"+l+"}"),l=(o?l.replace(V,""):l).replace(Y,"$1").replace(Z,"$1;"),l="function("+(t||"obj")+"){"+(t?"":"obj||(obj={});")+"var __t,__p=''"+(u?",__e=_.escape":"")+(o?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+l+"return __p}",t=He(function(){return cu(i,"return "+l).apply(I,a)
+}),t.source=l,Le(t))throw t;return t},Lt.trim=Je,Lt.trimLeft=function(n,t,r){return(n=null==n?"":vu(n))?r||null==t?n.slice(x(n)):(t=vu(t),n.slice(s(n,t))):n},Lt.trimRight=function(n,t,r){return(n=null==n?"":vu(n))?r||null==t?n.slice(0,j(n)+1):(t=vu(t),n.slice(0,p(n,t)+1)):n},Lt.trunc=function(n,t,r){t=r?null:t;var e=W;if(r=L,qe(t)){var u="separator"in t?t.separator:u,e="length"in t?+t.length||0:e;r="omission"in t?vu(t.omission):r}else null!=t&&(e=+t||0);if(n=null==n?"":vu(n),e>=n.length)return n;
+if(e-=r.length,1>e)return r;if(t=n.slice(0,e),null==u)return t+r;if(Be(u)){if(n.slice(e).search(u)){var o,i=n.slice(0,e);for(u.global||(u=gu(u.source,(tt.exec(u)||"")+"g")),u.lastIndex=0;n=u.exec(i);)o=n.index;t=t.slice(0,null==o?e:o)}}else n.indexOf(u,e)!=e&&(u=t.lastIndexOf(u),-1t?0:+t||0,n.length),n)},Lt.prototype.sample=function(n,t){return n=t?null:n,this.__chain__||null!=n?this.thru(function(t){return Lt.sample(t,n)}):Lt.sample(this.value())},Lt.VERSION=O,n("bind bindKey curry curryRight partial partialRight".split(" "),function(n){Lt[n].placeholder=Lt}),n(["filter","map","takeWhile"],function(n,t){qt.prototype[n]=function(n,r){n=Lr(n,r,3);
+var e=this.clone(),u=e.filtered,o=e.iteratees||(e.iteratees=[]);return e.filtered=u||t==P||t==B&&0>e.dir,o.push({iteratee:n,type:t}),e}}),n(["drop","take"],function(n,t){var r=n+"Count",e=n+"While";qt.prototype[n]=function(e){e=null==e?1:Ku(+e||0,0);var u=this.clone();if(u.filtered){var o=u[r];u[r]=t?Vu(o,e):o+e}else(u.views||(u.views=[])).push({size:e,type:n+(0>u.dir?"Right":"")});return u},qt.prototype[n+"Right"]=function(t){return this.reverse()[n](t).reverse()},qt.prototype[n+"RightWhile"]=function(n,t){return this.reverse()[e](n,t).reverse()
+}}),n(["first","last"],function(n,t){var r="take"+(t?"Right":"");qt.prototype[n]=function(){return this[r](1).value()[0]}}),n(["initial","rest"],function(n,t){var r="drop"+(t?"":"Right");qt.prototype[n]=function(){return this[r](1)}}),qt.prototype.dropWhile=function(n,t){n=Lr(n,t,3);var r,e,u=0>this.dir;return this.filter(function(t,o,i){return r=r&&(u?oe),e=o,r||(r=!n(t,o,i))})},qt.prototype.reject=function(n,t){return n=Lr(n,t,3),this.filter(function(t,r,e){return!n(t,r,e)})},qt.prototype.slice=function(n,t){n=null==n?0:+n||0;
+var r=0>n?this.takeRight(-n):this.drop(n);return typeof t!="undefined"&&(t=+t||0,r=0>t?r.dropRight(-t):r.take(t-n)),r},sr(qt.prototype,function(n,t){var r=/^(?:first|last)$/.test(t);Lt.prototype[t]=function(){var e=arguments,u=this.__chain__,o=this.__wrapped__,i=o instanceof qt;return r&&!u?i?n.call(o):Lt[t](this.value()):i||yo(o)?(o=n.apply(i?o:new qt(this),e),new $t(o,u)):this.thru(function(n){return n=[n],Tu.apply(n,e),Lt[t].apply(Lt,n)})}}),n("concat join pop push shift sort splice unshift".split(" "),function(n){var t=du[n],r=/^(?:push|sort|unshift)$/.test(n)?"tap":"thru",e=/^(?:join|pop|shift)$/.test(n),u=io.spliceObjects||!/^(?:pop|shift|splice)$/.test(n)?t:function(){var n=t.apply(this,arguments);
+return 0===this.length&&delete this[0],n};Lt.prototype[n]=function(){var n=arguments;return e&&!this.__chain__?u.apply(this.value(),n):this[r](function(t){return u.apply(t,n)})}}),qt.prototype.clone=function(){var n=this.iteratees,t=this.views,r=new qt(this.wrapped);return r.dir=this.dir,r.dropCount=this.dropCount,r.filtered=this.filtered,r.iteratees=n?l(n):null,r.takeCount=this.takeCount,r.views=t?l(t):null,r},qt.prototype.reverse=function(){var n=this.filtered,t=n?new qt(this):this.clone();return t.dir=-1*this.dir,t.filtered=n,t
+},qt.prototype.value=function(){var n,t=this.wrapped.value(),r=this.dir,e=0>r,u=t.length;n=u;for(var o=this.views,i=0,a=-1,f=o?o.length:0;++a"'`]/g,X=/<%-([\s\S]+?)%>/g,H=/<%([\s\S]+?)%>/g,Q=/<%=([\s\S]+?)%>/g,nt=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,tt=/\w*$/,rt=/^\s*function[ \n\r\t]+\w/,et=/^0[xX]/,ut=/^\[object .+?Constructor\]$/,ot=/[\xc0-\xd6\xd8-\xde\xdf-\xf6\xf8-\xff]/g,it=/($^)/,at=/[.*+?^${}()|[\]\/\\]/g,ft=/\bthis\b/,lt=/['\n\r\u2028\u2029\\]/g,ct=RegExp("[A-Z\\xc0-\\xd6\\xd8-\\xde]{2,}(?=[A-Z\\xc0-\\xd6\\xd8-\\xde][a-z\\xdf-\\xf6\\xf8-\\xff]+)|[A-Z\\xc0-\\xd6\\xd8-\\xde]?[a-z\\xdf-\\xf6\\xf8-\\xff]+|[A-Z\\xc0-\\xd6\\xd8-\\xde]+|[0-9]+","g"),st=" \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000",pt="Array ArrayBuffer Date Error Float32Array Float64Array Function Int8Array Int16Array Int32Array Math Number Object RegExp Set String _ clearTimeout document isFinite parseInt setTimeout TypeError Uint8Array Uint8ClampedArray Uint16Array Uint32Array WeakMap window WinRTError".split(" "),ht="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" "),gt="[object Arguments]",vt="[object Array]",yt="[object Boolean]",dt="[object Date]",mt="[object Error]",_t="[object Function]",bt="[object Number]",wt="[object Object]",xt="[object RegExp]",jt="[object String]",At="[object ArrayBuffer]",Et="[object Float32Array]",It="[object Float64Array]",Ot="[object Int8Array]",Ct="[object Int16Array]",kt="[object Int32Array]",Rt="[object Uint8Array]",St="[object Uint8ClampedArray]",Ft="[object Uint16Array]",Tt="[object Uint32Array]",Nt={};
+Nt[gt]=Nt[vt]=Nt[Et]=Nt[It]=Nt[Ot]=Nt[Ct]=Nt[kt]=Nt[Rt]=Nt[St]=Nt[Ft]=Nt[Tt]=true,Nt[At]=Nt[yt]=Nt[dt]=Nt[mt]=Nt[_t]=Nt["[object Map]"]=Nt[bt]=Nt[wt]=Nt[xt]=Nt["[object Set]"]=Nt[jt]=Nt["[object WeakMap]"]=false;var Ut={};Ut[gt]=Ut[vt]=Ut[At]=Ut[yt]=Ut[dt]=Ut[Et]=Ut[It]=Ut[Ot]=Ut[Ct]=Ut[kt]=Ut[bt]=Ut[wt]=Ut[xt]=Ut[jt]=Ut[Rt]=Ut[St]=Ut[Ft]=Ut[Tt]=true,Ut[mt]=Ut[_t]=Ut["[object Map]"]=Ut["[object Set]"]=Ut["[object WeakMap]"]=false;var Wt={leading:false,maxWait:0,trailing:false},Lt={"\xc0":"A","\xc1":"A","\xc2":"A","\xc3":"A","\xc4":"A","\xc5":"A","\xe0":"a","\xe1":"a","\xe2":"a","\xe3":"a","\xe4":"a","\xe5":"a","\xc7":"C","\xe7":"c","\xd0":"D","\xf0":"d","\xc8":"E","\xc9":"E","\xca":"E","\xcb":"E","\xe8":"e","\xe9":"e","\xea":"e","\xeb":"e","\xcc":"I","\xcd":"I","\xce":"I","\xcf":"I","\xec":"i","\xed":"i","\xee":"i","\xef":"i","\xd1":"N","\xf1":"n","\xd2":"O","\xd3":"O","\xd4":"O","\xd5":"O","\xd6":"O","\xd8":"O","\xf2":"o","\xf3":"o","\xf4":"o","\xf5":"o","\xf6":"o","\xf8":"o","\xd9":"U","\xda":"U","\xdb":"U","\xdc":"U","\xf9":"u","\xfa":"u","\xfb":"u","\xfc":"u","\xdd":"Y","\xfd":"y","\xff":"y","\xc6":"Ae","\xe6":"ae","\xde":"Th","\xfe":"th","\xdf":"ss"},$t={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"},qt={"&":"&","<":"<",">":">",""":'"',"'":"'","`":"`"},Pt={"function":true,object:true},zt={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Bt=Pt[typeof window]&&window!==(this&&this.window)?window:this,Dt=Pt[typeof exports]&&exports&&!exports.nodeType&&exports,Mt=Pt[typeof module]&&module&&!module.nodeType&&module,Kt=Dt&&Mt&&typeof global=="object"&&global;
+!Kt||Kt.global!==Kt&&Kt.window!==Kt&&Kt.self!==Kt||(Bt=Kt);var Vt=Mt&&Mt.exports===Dt&&Dt,Yt=function(){try{String({toString:0}+"")}catch(n){return function(){return false}}return function(n){return typeof n.toString!="function"&&typeof(n+"")=="string"}}(),Zt=E();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(Bt._=Zt, define(function(){return Zt})):Dt&&Mt?Vt?(Mt.exports=Zt)._=Zt:Dt._=Zt:Bt._=Zt}).call(this);
\ No newline at end of file
diff --git a/dist/lodash.js b/dist/lodash.js
index 5897975ba..3fba184eb 100644
--- a/dist/lodash.js
+++ b/dist/lodash.js
@@ -22,7 +22,8 @@
CURRY_RIGHT_FLAG = 8,
CURRY_BOUND_FLAG = 16,
PARTIAL_FLAG = 32,
- PARTIAL_RIGHT_FLAG = 64;
+ PARTIAL_RIGHT_FLAG = 64,
+ REARG_FLAG = 128;
/** Used as default options for `_.trunc` */
var DEFAULT_TRUNC_LENGTH = 30,
@@ -80,7 +81,7 @@
var reHostCtor = /^\[object .+?Constructor\]$/;
/** Used to match latin-1 supplement letters (excluding mathematical operators) */
- var reLatin1 = /[\xC0-\xD6\xD8-\xDE\xDF-\xF6\xF8-\xFF]/g;
+ var reLatin1 = /[\xc0-\xd6\xd8-\xde\xdf-\xf6\xf8-\xff]/g;
/** Used to ensure capturing order of template delimiters */
var reNoMatch = /($^)/;
@@ -100,8 +101,8 @@
/** Used to match words to create compound words */
var reWords = (function() {
- var upper = '[A-Z\\xC0-\\xD6\\xD8-\\xDE]',
- lower = '[a-z\\xDF-\\xF6\\xF8-\\xFF]+';
+ var upper = '[A-Z\\xc0-\\xd6\\xd8-\\xde]',
+ lower = '[a-z\\xdf-\\xf6\\xf8-\\xff]+';
return RegExp(upper + '{2,}(?=' + upper + lower + ')|' + upper + '?' + lower + '|' + upper + '+|[0-9]+', 'g');
}());
@@ -109,13 +110,13 @@
/** Used to detect and test whitespace */
var whitespace = (
// whitespace
- ' \t\x0B\f\xA0\ufeff' +
+ ' \t\x0b\f\xa0\ufeff' +
// line terminators
'\n\r\u2028\u2029' +
// unicode category "Zs" space separators
- '\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000'
+ '\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000'
);
/** Used to assign default `context` object properties */
@@ -196,23 +197,23 @@
/** Used to map latin-1 supplementary letters to basic latin letters */
var deburredLetters = {
- '\xC0': 'A', '\xC1': 'A', '\xC2': 'A', '\xC3': 'A', '\xC4': 'A', '\xC5': 'A',
- '\xE0': 'a', '\xE1': 'a', '\xE2': 'a', '\xE3': 'a', '\xE4': 'a', '\xE5': 'a',
- '\xC7': 'C', '\xE7': 'c',
- '\xD0': 'D', '\xF0': 'd',
- '\xC8': 'E', '\xC9': 'E', '\xCA': 'E', '\xCB': 'E',
- '\xE8': 'e', '\xE9': 'e', '\xEA': 'e', '\xEB': 'e',
- '\xCC': 'I', '\xCD': 'I', '\xCE': 'I', '\xCF': 'I',
- '\xEC': 'i', '\xED': 'i', '\xEE': 'i', '\xEF': 'i',
- '\xD1': 'N', '\xF1': 'n',
- '\xD2': 'O', '\xD3': 'O', '\xD4': 'O', '\xD5': 'O', '\xD6': 'O', '\xD8': 'O',
- '\xF2': 'o', '\xF3': 'o', '\xF4': 'o', '\xF5': 'o', '\xF6': 'o', '\xF8': 'o',
- '\xD9': 'U', '\xDA': 'U', '\xDB': 'U', '\xDC': 'U',
- '\xF9': 'u', '\xFA': 'u', '\xFB': 'u', '\xFC': 'u',
- '\xDD': 'Y', '\xFD': 'y', '\xFF': 'y',
- '\xC6': 'Ae', '\xE6': 'ae',
- '\xDE': 'Th', '\xFE': 'th',
- '\xDF': 'ss'
+ '\xc0': 'A', '\xc1': 'A', '\xc2': 'A', '\xc3': 'A', '\xc4': 'A', '\xc5': 'A',
+ '\xe0': 'a', '\xe1': 'a', '\xe2': 'a', '\xe3': 'a', '\xe4': 'a', '\xe5': 'a',
+ '\xc7': 'C', '\xe7': 'c',
+ '\xd0': 'D', '\xf0': 'd',
+ '\xc8': 'E', '\xc9': 'E', '\xca': 'E', '\xcb': 'E',
+ '\xe8': 'e', '\xe9': 'e', '\xea': 'e', '\xeb': 'e',
+ '\xcC': 'I', '\xcd': 'I', '\xce': 'I', '\xcf': 'I',
+ '\xeC': 'i', '\xed': 'i', '\xee': 'i', '\xef': 'i',
+ '\xd1': 'N', '\xf1': 'n',
+ '\xd2': 'O', '\xd3': 'O', '\xd4': 'O', '\xd5': 'O', '\xd6': 'O', '\xd8': 'O',
+ '\xf2': 'o', '\xf3': 'o', '\xf4': 'o', '\xf5': 'o', '\xf6': 'o', '\xf8': 'o',
+ '\xd9': 'U', '\xda': 'U', '\xdb': 'U', '\xdc': 'U',
+ '\xf9': 'u', '\xfa': 'u', '\xfb': 'u', '\xfc': 'u',
+ '\xdd': 'Y', '\xfd': 'y', '\xff': 'y',
+ '\xc6': 'Ae', '\xe6': 'ae',
+ '\xde': 'Th', '\xfe': 'th',
+ '\xdf': 'ss'
};
/**
@@ -467,26 +468,6 @@
return false;
}
- /**
- * The base implementation of `_.at` without support for strings and individual
- * key arguments.
- *
- * @private
- * @param {Array|Object} collection The collection to iterate over.
- * @param {number[]|string[]} [props] The property names or indexes of elements to pick.
- * @returns {Array} Returns the new array of picked elements.
- */
- function baseAt(collection, props) {
- var index = -1,
- length = props.length,
- result = Array(length);
-
- while(++index < length) {
- result[index] = collection[props[index]];
- }
- return result;
- }
-
/**
* The base implementation of `compareAscending` which compares values and
* sorts them in ascending order without guaranteeing a stable sort.
@@ -555,19 +536,6 @@
return result;
}
- /**
- * An implementation of `_.contains` for cache objects that mimics the return
- * signature of `_.indexOf` by returning `0` if the value is found, else `-1`.
- *
- * @private
- * @param {Object} cache The cache object to inspect.
- * @param {*} value The value to search for.
- * @returns {number} Returns `0` if `value` is found, else `-1`.
- */
- function cacheIndexOf(cache, value) {
- return cache.has(value) ? 0 : -1;
- }
-
/**
* Used by `_.max` and `_.min` as the default callback for string values.
*
@@ -651,7 +619,7 @@
// for `object` and `other`. See https://github.com/jashkenas/underscore/pull/1247
//
// This also ensures a stable sort in V8 and other engines.
- // See https://code.google.com/p/v8/issues/detail?id=90
+ // See https://code.google.com/p/v8/issues/detail?id=90.
return object.index - other.index;
}
@@ -712,6 +680,19 @@
return -1;
}
+ /**
+ * Checks if `value` is valid array-like index.
+ *
+ * @private
+ * @param {*} value The value to check.
+ * @param {number} [length] The upper bound of a valid index.
+ * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
+ */
+ function isIndex(value, length) {
+ value = +value;
+ return value > -1 && value % 1 == 0 && (length == null || value < length);
+ }
+
/**
* Used by `trimmedLeftIndex` and `trimmedRightIndex` to determine if a
* character code is whitespace.
@@ -975,11 +956,12 @@
* `initial`, `intersection`, `invert`, `invoke`, `keys`, `keysIn`, `map`,
* `mapValues`, `matches`, `memoize`, `merge`, `mixin`, `negate`, `noop`,
* `omit`, `once`, `pairs`, `partial`, `partialRight`, `partition`, `pick`,
- * `pluck`, `property`, `pull`, `pullAt`, `push`, `range`, `reject`, `remove`,
- * `rest`, `reverse`, `shuffle`, `slice`, `sort`, `sortBy`, `splice`, `take`,
- * `takeRight`, `takeRightWhile`, `takeWhile`, `tap`, `throttle`, `thru`,
- * `times`, `toArray`, `transform`, `union`, `uniq`, `unshift`, `unzip`,
- * `values`, `valuesIn`, `where`, `without`, `wrap`, `xor`, `zip`, and `zipObject`
+ * `pluck`, `property`, `propertyOf`, `pull`, `pullAt`, `push`, `range`,
+ * `rearg`, `reject`, `remove`, `rest`, `reverse`, `shuffle`, `slice`, `sort`,
+ * `sortBy`, `splice`, `take`, `takeRight`, `takeRightWhile`, `takeWhile`,
+ * `tap`, `throttle`, `thru`, `times`, `toArray`, `transform`, `union`, `uniq`,
+ * `unshift`, `unzip`, `values`, `valuesIn`, `where`, `without`, `wrap`, `xor`,
+ * `zip`, and `zipObject`
*
* The non-chainable wrapper functions are:
* `attempt`, `camelCase`, `capitalize`, `clone`, `cloneDeep`, `contains`,
@@ -988,12 +970,12 @@
* `has`, `identity`, `indexOf`, `isArguments`, `isArray`, `isBoolean`, isDate`,
* `isElement`, `isEmpty`, `isEqual`, `isError`, `isFinite`, `isFunction`,
* `isNative`, `isNaN`, `isNull`, `isNumber`, `isObject`, `isPlainObject`,
- * `isRegExp`, `isString`, `isUndefined`, `join`, `kebabCase`, `last`, `lastIndexOf`,
- * `max`, `min`, `noConflict`, `now`, `pad`, `padLeft`, `padRight`, `parseInt`,
- * `pop`, `random`, `reduce`, `reduceRight`, `repeat`, `result`, `runInContext`,
- * `shift`, `size`, `snakeCase`, `some`, `sortedIndex`, `sortedLastIndex`,
- * `startsWith`, `template`, `trim`, `trimLeft`, `trimRight`, `trunc`, `unescape`,
- * `uniqueId`, `value`, and `words`
+ * `isRegExp`, `isString`, `isUndefined`, `join`, `kebabCase`, `last`,
+ * `lastIndexOf`, `max`, `min`, `noConflict`, `now`, `pad`, `padLeft`, `padRight`,
+ * `parseInt`, `pop`, `random`, `reduce`, `reduceRight`, `repeat`, `result`,
+ * `runInContext`, `shift`, `size`, `snakeCase`, `some`, `sortedIndex`,
+ * `sortedLastIndex`, `startsWith`, `template`, `trim`, `trimLeft`, `trimRight`,
+ * `trunc`, `unescape`, `uniqueId`, `value`, and `words`
*
* The wrapper function `sample` will return a wrapped value when `n` is provided,
* otherwise it will return an unwrapped value.
@@ -1021,17 +1003,31 @@
* // => true
*/
function lodash(value) {
- if (value && typeof value == 'object') {
+ if (value && typeof value == 'object' && !isArray(value)) {
if (value instanceof LodashWrapper) {
return value;
}
- if (!isArray(value) && hasOwnProperty.call(value, '__wrapped__')) {
+ if (hasOwnProperty.call(value, '__wrapped__')) {
return new LodashWrapper(value.__wrapped__, value.__chain__, baseSlice(value.__queue__));
}
}
return new LodashWrapper(value);
}
+ /**
+ * The base constructor for creating `lodash` wrapper objects.
+ *
+ * @private
+ * @param {*} value The value to wrap.
+ * @param {boolean} [chainAll=false] Enable chaining for all wrapper methods.
+ * @param {Array} [queue=[]] Actions to peform to resolve the unwrapped value.
+ */
+ function LodashWrapper(value, chainAll, queue) {
+ this.__chain__ = !!chainAll;
+ this.__queue__ = queue || [];
+ this.__wrapped__ = value;
+ }
+
/**
* An object environment feature flags.
*
@@ -1155,6 +1151,230 @@
/*------------------------------------------------------------------------*/
+ /**
+ * Creates a lazy wrapper object which wraps `value` to enable lazy evaluation.
+ *
+ * @private
+ * @param {*} value The value to wrap.
+ */
+ function LazyWrapper(value) {
+ this.dir = 1;
+ this.dropCount = 0;
+ this.filtered = false;
+ this.iteratees = null;
+ this.takeCount = POSITIVE_INFINITY;
+ this.views = null;
+ this.wrapped = value;
+ }
+
+ /**
+ * Creates a clone of the lazy wrapper object.
+ *
+ * @private
+ * @name clone
+ * @memberOf LazyWrapper
+ * @returns {Object} Returns the cloned `LazyWrapper` object.
+ */
+ function lazyClone() {
+ var iteratees = this.iteratees,
+ views = this.views,
+ result = new LazyWrapper(this.wrapped);
+
+ result.dir = this.dir;
+ result.dropCount = this.dropCount;
+ result.filtered = this.filtered;
+ result.iteratees = iteratees ? baseSlice(iteratees) : null;
+ result.takeCount = this.takeCount;
+ result.views = views ? baseSlice(views) : null;
+ return result;
+ }
+
+ /**
+ * Reverses the direction of lazy iteration.
+ *
+ * @private
+ * @name reverse
+ * @memberOf LazyWrapper
+ * @returns {Object} Returns the new reversed `LazyWrapper` object.
+ */
+ function lazyReverse() {
+ var filtered = this.filtered,
+ result = filtered ? new LazyWrapper(this) : this.clone();
+
+ result.dir = this.dir * -1;
+ result.filtered = filtered;
+ return result;
+ }
+
+ /**
+ * Extracts the unwrapped value from its lazy wrapper.
+ *
+ * @private
+ * @name value
+ * @memberOf LazyWrapper
+ * @returns {*} Returns the unwrapped value.
+ */
+ function lazyValue() {
+ var array = this.wrapped.value(),
+ dir = this.dir,
+ isRight = dir < 0,
+ length = array.length,
+ view = getView(0, length, this.views),
+ start = view.start,
+ end = view.end,
+ dropCount = this.dropCount,
+ takeCount = nativeMin(end - start, this.takeCount - dropCount),
+ index = isRight ? end : start - 1,
+ iteratees = this.iteratees,
+ iterLength = iteratees ? iteratees.length : 0,
+ resIndex = 0,
+ result = [];
+
+ outer:
+ while (length-- && resIndex < takeCount) {
+ index += dir;
+
+ var iterIndex = -1,
+ value = array[index];
+
+ while (++iterIndex < iterLength) {
+ var data = iteratees[iterIndex],
+ iteratee = data.iteratee,
+ computed = iteratee(value, index, array),
+ type = data.type;
+
+ if (type == LAZY_MAP_FLAG) {
+ value = computed;
+ } else if (!computed) {
+ if (type == LAZY_FILTER_FLAG) {
+ continue outer;
+ } else {
+ break outer;
+ }
+ }
+ }
+ if (dropCount) {
+ dropCount--;
+ } else {
+ result[resIndex++] = value;
+ }
+ }
+ return isRight ? result.reverse() : result;
+ }
+
+ /*------------------------------------------------------------------------*/
+
+ /**
+ * Creates a cache object to store key/value pairs.
+ *
+ * @private
+ * @static
+ * @name Cache
+ * @memberOf _.memoize
+ */
+ function MapCache() {
+ this.__data__ = {};
+ }
+
+ /**
+ * Gets the cached value for `key`.
+ *
+ * @private
+ * @name get
+ * @memberOf _.memoize.Cache
+ * @param {string} key The key of the value to retrieve.
+ * @returns {*} Returns the cached value.
+ */
+ function mapGet(key) {
+ return this.__data__[key];
+ }
+
+ /**
+ * Checks if a cached value for `key` exists.
+ *
+ * @private
+ * @name has
+ * @memberOf _.memoize.Cache
+ * @param {string} key The name of the entry to check.
+ * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
+ */
+ function mapHas(key) {
+ return key != '__proto__' && hasOwnProperty.call(this.__data__, key);
+ }
+
+ /**
+ * Adds `value` to `key` of the cache.
+ *
+ * @private
+ * @name set
+ * @memberOf _.memoize.Cache
+ * @param {string} key The key of the value to cache.
+ * @param {*} value The value to cache.
+ * @returns {Object} Returns the cache object.
+ */
+ function mapSet(key, value) {
+ if (key != '__proto__') {
+ this.__data__[key] = value;
+ }
+ return this;
+ }
+
+ /*------------------------------------------------------------------------*/
+
+ /**
+ *
+ * Creates a cache object to store unique values.
+ *
+ * @private
+ * @param {Array} [values] The values to cache.
+ */
+ function SetCache(values) {
+ var length = values ? values.length : 0;
+
+ this.data = { 'number': {}, 'set': new Set };
+ while (length--) {
+ this.push(values[length]);
+ }
+ }
+
+ /**
+ * Checks if `value` is in `cache` mimicking the return signature of
+ * `_.indexOf` by returning `0` if the value is found, else `-1`.
+ *
+ * @private
+ * @param {Object} cache The cache to search.
+ * @param {*} value The value to search for.
+ * @returns {number} Returns `0` if `value` is found, else `-1`.
+ */
+ function cacheIndexOf(cache, value) {
+ var type = typeof value,
+ data = cache.data,
+ result = type == 'number' ? data[type][value] : data.set.has(value);
+
+ return result ? 0 : -1;
+ }
+
+ /**
+ * Adds `value` to the cache.
+ *
+ * @private
+ * @name push
+ * @memberOf SetCache
+ * @param {*} value The value to cache.
+ */
+ function cachePush(value) {
+ var data = this.data,
+ type = typeof value;
+
+ if (type == 'number') {
+ data[type][value] = true;
+ } else {
+ data.set.add(value);
+ }
+ }
+
+ /*------------------------------------------------------------------------*/
+
/**
* A specialized version of `_.max` for arrays without support for iteratees.
*
@@ -1228,18 +1448,6 @@
: objectValue;
}
- /**
- * Used by `_.matches` to clone `source` values, letting uncloneable values
- * passthu instead of returning empty objects.
- *
- * @private
- * @param {*} value The value to clone.
- * @returns {*} Returns the cloned value.
- */
- function clonePassthru(value) {
- return isCloneable(value) ? undefined : value;
- }
-
/**
* The base implementation of `_.assign` without support for argument juggling,
* multiple sources, and `this` binding.
@@ -1264,6 +1472,34 @@
return object;
}
+ /**
+ * The base implementation of `_.at` without support for strings and individual
+ * key arguments.
+ *
+ * @private
+ * @param {Array|Object} collection The collection to iterate over.
+ * @param {number[]|string[]} [props] The property names or indexes of elements to pick.
+ * @returns {Array} Returns the new array of picked elements.
+ */
+ function baseAt(collection, props) {
+ var index = -1,
+ length = collection ? collection.length : 0,
+ isArr = isLength(length),
+ propsLength = props.length,
+ result = Array(propsLength);
+
+ while(++index < propsLength) {
+ var key = props[index];
+ if (isArr) {
+ key = parseFloat(key);
+ result[index] = isIndex(key, length) ? collection[key] : undefined;
+ } else {
+ result[index] = collection[key];
+ }
+ }
+ return result;
+ }
+
/**
* The base implementation of `_.bindAll` without support for individual
* method name arguments.
@@ -1279,7 +1515,7 @@
while (++index < length) {
var key = methodNames[index];
- object[key] = createWrapper(object[key], BIND_FLAG, null, object);
+ object[key] = createWrapper(object[key], BIND_FLAG, object);
}
return object;
}
@@ -1435,23 +1671,6 @@
}());
}
- /**
- * The base implementation of `_.curry` and `_.curryRight` which handles
- * resolving the default arity of `func`.
- *
- * @private
- * @param {Function} func The function to curry.
- * @param {number} bitmask The bitmask of flags to compose.
- * @param {number} [arity=func.length] The arity of `func`.
- * @returns {Function} Returns the new curried function.
- */
- function baseCurry(func, bitmask, arity) {
- if (typeof arity != 'number') {
- arity = arity == null ? (func ? func.length : 0) : nativeMax(+arity || 0, 0);
- }
- return createWrapper(func, bitmask, arity);
- }
-
/**
* The base implementation of `_.difference` which accepts a single array
* of values to exclude.
@@ -1468,15 +1687,15 @@
}
var index = -1,
indexOf = getIndexOf(),
- prereq = indexOf == baseIndexOf,
- isLarge = prereq && createCache && values && values.length >= 200,
- isCommon = prereq && !isLarge,
+ isCommon = indexOf == baseIndexOf,
+ cache = isCommon && values.length >= 200 && createCache(values),
result = [],
valuesLength = values.length;
- if (isLarge) {
+ if (cache) {
indexOf = cacheIndexOf;
- values = createCache(values);
+ isCommon = false;
+ values = cache;
}
outer:
while (++index < length) {
@@ -2019,8 +2238,8 @@
var isSrcArr = isArrayLike(source);
(isSrcArr ? arrayEach : baseForOwn)(source, function(srcValue, key, source) {
- var isArr = srcValue && isArrayLike(srcValue),
- isObj = srcValue && isPlainObject(srcValue),
+ var isArr = isArrayLike(srcValue),
+ isObj = isPlainObject(srcValue),
value = object[key];
if (!(isArr || isObj)) {
@@ -2066,31 +2285,6 @@
return object;
}
- /**
- * The base implementation of `_.partial` and `_.partialRight` which accepts
- * an array of arguments to partially apply and handles resolving the arity
- * of `func`.
- *
- * @private
- * @param {Function} func The function to partially apply arguments to.
- * @param {number} bitmask The bitmask of flags to compose.
- * @param {Array} args The arguments to be partially applied.
- * @param {Array} holders The `args` placeholder indexes.
- * @param {*} [thisArg] The `this` binding of `func`.
- * @returns {Function} Returns the new partially applied function.
- */
- function basePartial(func, bitmask, args, holders, thisArg) {
- if (func) {
- var data = getData(func),
- arity = data ? data[2] : func.length;
-
- arity = nativeMax(arity - args.length, 0);
- }
- return (bitmask & PARTIAL_FLAG)
- ? createWrapper(func, bitmask, arity, thisArg, args, holders)
- : createWrapper(func, bitmask, arity, thisArg, null, null, args, holders);
- }
-
/**
* The base implementation of `_.pullAt` without support for individual
* index arguments.
@@ -2107,7 +2301,7 @@
indexes.sort(baseCompareAscending);
while (length--) {
var index = parseFloat(indexes[length]);
- if (index != previous && index > -1 && index % 1 == 0) {
+ if (index != previous && isIndex(index)) {
var previous = index;
splice.call(array, index, 1);
}
@@ -2240,15 +2434,16 @@
var index = -1,
indexOf = getIndexOf(),
length = array.length,
- prereq = indexOf == baseIndexOf,
- isLarge = prereq && createCache && length >= 200,
- isCommon = prereq && !isLarge,
+ isCommon = indexOf == baseIndexOf,
+ isLarge = isCommon && length >= 200,
+ seen = isLarge && createCache(),
result = [];
- if (isLarge) {
- var seen = createCache();
+ if (seen) {
indexOf = cacheIndexOf;
+ isCommon = false;
} else {
+ isLarge = false;
seen = iteratee ? [] : result;
}
outer:
@@ -2330,29 +2525,41 @@
};
}
+ /**
+ * Used by `_.matches` to clone `source` values, letting uncloneable values
+ * passthu instead of returning empty objects.
+ *
+ * @private
+ * @param {*} value The value to clone.
+ * @returns {*} Returns the cloned value.
+ */
+ function clonePassthru(value) {
+ return isCloneable(value) ? undefined : value;
+ }
+
/**
* Creates an array that is the composition of partially applied arguments,
* placeholders, and provided arguments into a single array of arguments.
*
* @private
- * @param {Array} partialArgs The arguments to prepend to those provided.
- * @param {Array} partialHolders The `partialArgs` placeholder indexes.
* @param {Array|Object} args The provided arguments.
+ * @param {Array} partials The arguments to prepend to those provided.
+ * @param {Array} holders The `partials` placeholder indexes.
* @returns {Array} Returns the new array of composed arguments.
*/
- function composeArgs(partialArgs, partialHolders, args) {
- var holdersLength = partialHolders.length,
+ function composeArgs(args, partials, holders) {
+ var holdersLength = holders.length,
argsIndex = -1,
argsLength = nativeMax(args.length - holdersLength, 0),
leftIndex = -1,
- leftLength = partialArgs.length,
+ leftLength = partials.length,
result = Array(argsLength + leftLength);
while (++leftIndex < leftLength) {
- result[leftIndex] = partialArgs[leftIndex];
+ result[leftIndex] = partials[leftIndex];
}
while (++argsIndex < holdersLength) {
- result[partialHolders[argsIndex]] = args[argsIndex];
+ result[holders[argsIndex]] = args[argsIndex];
}
while (argsLength--) {
result[leftIndex++] = args[argsIndex++];
@@ -2365,18 +2572,18 @@
* is tailored for `_.partialRight`.
*
* @private
- * @param {Array} partialRightArgs The arguments to append to those provided.
- * @param {Array} partialRightHolders The `partialRightArgs` placeholder indexes.
* @param {Array|Object} args The provided arguments.
+ * @param {Array} partials The arguments to append to those provided.
+ * @param {Array} holders The `partials` placeholder indexes.
* @returns {Array} Returns the new array of composed arguments.
*/
- function composeArgsRight(partialRightArgs, partialRightHolders, args) {
+ function composeArgsRight(args, partials, holders) {
var holdersIndex = -1,
- holdersLength = partialRightHolders.length,
+ holdersLength = holders.length,
argsIndex = -1,
argsLength = nativeMax(args.length - holdersLength, 0),
rightIndex = -1,
- rightLength = partialRightArgs.length,
+ rightLength = partials.length,
result = Array(argsLength + rightLength);
while (++argsIndex < argsLength) {
@@ -2384,10 +2591,10 @@
}
var pad = argsIndex;
while (++rightIndex < rightLength) {
- result[pad + rightIndex] = partialRightArgs[rightIndex];
+ result[pad + rightIndex] = partials[rightIndex];
}
while (++holdersIndex < holdersLength) {
- result[pad + partialRightHolders[holdersIndex]] = args[argsIndex++];
+ result[pad + holders[holdersIndex]] = args[argsIndex++];
}
return result;
}
@@ -2478,21 +2685,14 @@
}
/**
- * Creates a cache object to optimize linear searches of large arrays.
+ * Creates a `Set` cache object to optimize linear searches of large arrays.
*
* @private
- * @param {Array} [array=[]] The array to search.
- * @returns {Object} Returns the new cache object.
+ * @param {Array} [values] The values to cache.
+ * @returns {null|Object} Returns the new cache object if `Set` is supported, else `null`.
*/
- var createCache = Set && function(array) {
- var cache = new Set,
- length = array ? array.length : 0;
-
- cache.push = cache.add;
- while (length--) {
- cache.push(array[length]);
- }
- return cache;
+ var createCache = !Set ? constant(null) : function(values) {
+ return new SetCache(values);
};
/**
@@ -2543,15 +2743,16 @@
* @private
* @param {Function|string} func The function or method name to reference.
* @param {number} bitmask The bitmask of flags. See `createWrapper` for more details.
- * @param {number} arity The arity of `func`.
* @param {*} [thisArg] The `this` binding of `func`.
- * @param {Array} [partialArgs] The arguments to prepend to those provided to the new function.
- * @param {Array} [partialHolders] The `partialArgs` placeholder indexes.
- * @param {Array} [partialRightArgs] The arguments to append to those provided to the new function.
- * @param {Array} [partialRightHolders] The `partialRightArgs` placeholder indexes.
+ * @param {Array} [partials] The arguments to prepend to those provided to the new function.
+ * @param {Array} [holders] The `partials` placeholder indexes.
+ * @param {Array} [partialsRight] The arguments to append to those provided to the new function.
+ * @param {Array} [holdersRight] The `partialsRight` placeholder indexes.
+ * @param {Array} [argPos] The argument positions of the new function.
+ * @param {number} arity The arity of `func`.
* @returns {Function} Returns the new wrapped function.
*/
- function createHybridWrapper(func, bitmask, arity, thisArg, partialArgs, partialHolders, partialRightArgs, partialRightHolders) {
+ function createHybridWrapper(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, arity) {
var isBind = bitmask & BIND_FLAG,
isBindKey = bitmask & BIND_KEY_FLAG,
isCurry = bitmask & CURRY_FLAG,
@@ -2569,23 +2770,27 @@
while (index--) {
args[index] = arguments[index];
}
- if (partialArgs) {
- args = composeArgs(partialArgs, partialHolders, args);
+ if (argPos) {
+ args = arrayReduceRight(argPos, reorder, args);
}
- if (partialRightArgs) {
- args = composeArgsRight(partialRightArgs, partialRightHolders, args);
+ if (partials) {
+ args = composeArgs(args, partials, holders);
+ }
+ if (partialsRight) {
+ args = composeArgsRight(args, partialsRight, holdersRight);
}
if (isCurry || isCurryRight) {
var placeholder = wrapper.placeholder,
- holders = replaceHolders(args, placeholder);
+ argsHolders = replaceHolders(args, placeholder);
- length -= holders.length;
+ length -= argsHolders.length;
if (length < arity) {
- var newArity = nativeMax(arity - length, 0),
- newPartialArgs = isCurry ? args : null,
- newPartialHolders = isCurry ? holders : null,
- newPartialRightArgs = isCurry ? null : args,
- newPartialRightHolders = isCurry ? null : holders;
+ var newArgPos = argPos ? baseSlice(argPos) : null,
+ newArity = nativeMax(arity - length, 0),
+ newsHolders = isCurry ? argsHolders : null,
+ newHoldersRight = isCurry ? null : argsHolders,
+ newPartials = isCurry ? args : null,
+ newPartialsRight = isCurry ? null : args;
bitmask |= (isCurry ? PARTIAL_FLAG : PARTIAL_RIGHT_FLAG);
bitmask &= ~(isCurry ? PARTIAL_RIGHT_FLAG : PARTIAL_FLAG);
@@ -2593,9 +2798,9 @@
if (!isCurryBound) {
bitmask &= ~(BIND_FLAG | BIND_KEY_FLAG);
}
- var result = createHybridWrapper(func, bitmask, newArity, thisArg, newPartialArgs, newPartialHolders, newPartialRightArgs, newPartialRightHolders);
+ var result = createHybridWrapper(func, bitmask, thisArg, newPartials, newsHolders, newPartialsRight, newHoldersRight, newArgPos, newArity);
result.placeholder = placeholder;
- return setData(result, [func, bitmask, newArity, thisArg, newPartialArgs, newPartialHolders, newPartialRightArgs, newPartialRightHolders]);
+ return result;
}
}
var thisBinding = isBind ? thisArg : this;
@@ -2638,25 +2843,25 @@
* @private
* @param {Function} func The function to partially apply arguments to.
* @param {number} bitmask The bitmask of flags. See `createWrapper` for more details.
- * @param {Array} partialArgs The arguments to prepend to those provided to the new function.
+ * @param {Array} partials The arguments to prepend to those provided to the new function.
* @param {*} [thisArg] The `this` binding of `func`.
* @returns {Function} Returns the new bound function.
*/
- function createPartialWrapper(func, bitmask, partialArgs, thisArg) {
+ function createPartialWrapper(func, bitmask, partials, thisArg) {
var isBind = bitmask & BIND_FLAG,
Ctor = createCtorWrapper(func);
function wrapper() {
// avoid `arguments` object use disqualifying optimizations by
- // converting it to an array before passing it to `composeArgs`
+ // converting it to an array before providing it to `composeArgs`
var argsIndex = -1,
argsLength = arguments.length,
leftIndex = -1,
- leftLength = partialArgs.length,
+ leftLength = partials.length,
args = Array(argsLength + leftLength);
while (++leftIndex < leftLength) {
- args[leftIndex] = partialArgs[leftIndex];
+ args[leftIndex] = partials[leftIndex];
}
while (argsLength--) {
args[leftIndex++] = arguments[++argsIndex];
@@ -2674,37 +2879,44 @@
* @param {Function|string} func The function or method name to reference.
* @param {number} bitmask The bitmask of flags.
* The bitmask may be composed of the following flags:
- * 1 - `_.bind`
- * 2 - `_.bindKey`
- * 4 - `_.curry`
- * 8 - `_.curryRight`
- * 16 - `_.curry` or `_.curryRight` of a bound function
- * 32 - `_.partial`
- * 64 - `_.partialRight`
- * @param {number} arity The arity of `func`.
+ * 1 - `_.bind`
+ * 2 - `_.bindKey`
+ * 4 - `_.curry`
+ * 8 - `_.curryRight`
+ * 16 - `_.curry` or `_.curryRight` of a bound function
+ * 32 - `_.partial`
+ * 64 - `_.partialRight`
+ * 128 - `_.rearg`
* @param {*} [thisArg] The `this` binding of `func`.
- * @param {Array} [partialArgs] The arguments to prepend to those provided to the new function.
- * @param {Array} [partialHolders] The `partialArgs` placeholder indexes.
- * @param {Array} [partialRightArgs] The arguments to append to those provided to the new function.
- * @param {Array} [partialRightHolders] The `partialRightArgs` placeholder indexes.
+ * @param {Array} [partials] The arguments to be partially applied.
+ * @param {Array} [holders] The `partialArgs` placeholder indexes.
+ * @param {Array} [argPos] The argument positions of the new function.
+ * @param {number} [arity] The arity of `func`.
* @returns {Function} Returns the new wrapped function.
*/
- function createWrapper(func, bitmask, arity, thisArg, partialArgs, partialHolders, partialRightArgs, partialRightHolders) {
+ function createWrapper(func, bitmask, thisArg, partials, holders, argPos, arity) {
var isBindKey = bitmask & BIND_KEY_FLAG;
if (!isBindKey && !isFunction(func)) {
throw new TypeError(FUNC_ERROR_TEXT);
}
- var isPartial = bitmask & PARTIAL_FLAG;
- if (isPartial && !partialArgs.length) {
- bitmask &= ~PARTIAL_FLAG;
- isPartial = false;
- partialArgs = partialHolders = null;
+ var length = partials ? partials.length : 0;
+ if (!length) {
+ bitmask &= ~(PARTIAL_FLAG | PARTIAL_RIGHT_FLAG);
+ partials = holders = null;
}
- var isPartialRight = bitmask & PARTIAL_RIGHT_FLAG;
- if (isPartialRight && !partialRightArgs.length) {
- bitmask &= ~PARTIAL_RIGHT_FLAG;
- isPartialRight = false;
- partialRightArgs = partialRightHolders = null;
+ if (partials && !holders) {
+ holders = [];
+ }
+ var oldPartials = partials,
+ oldHolders = holders,
+ isPartial = bitmask & PARTIAL_FLAG,
+ isPartialRight = bitmask & PARTIAL_RIGHT_FLAG;
+
+ if (!isPartial) {
+ var partialsRight = partials,
+ holdersRight = holders;
+
+ partials = holders = null;
}
var data = (data = !isBindKey && getData(func)) && data !== true && data;
if (data) {
@@ -2716,45 +2928,59 @@
func = data[0];
bitmask |= funcBitmask;
- // use metadata `arity` if not provided
- if (arity == null) {
- arity = data[2];
- }
// use metadata `thisArg` if available
if (funcIsBind) {
- thisArg = data[3];
+ thisArg = data[2];
}
// set if currying a bound function
if (!isBind && funcIsBind) {
bitmask |= CURRY_BOUND_FLAG;
}
- // append partial left arguments
- var funcArgs = data[4];
- if (funcArgs) {
- var funcHolders = data[5];
- partialArgs = isPartial ? composeArgs(funcArgs, funcHolders, partialArgs) : baseSlice(funcArgs);
- partialHolders = isPartial ? replaceHolders(partialArgs, PLACEHOLDER) : baseSlice(funcHolders);
+ // compose partial arguments
+ var value = data[3];
+ if (value) {
+ var funcHolders = data[4];
+ partials = isPartial ? composeArgs(partials, value, funcHolders) : baseSlice(value);
+ holders = isPartial ? replaceHolders(partials, PLACEHOLDER) : baseSlice(funcHolders);
}
- // prepend partial right arguments
- funcArgs = data[6];
- if (funcArgs) {
- funcHolders = data[7];
- partialRightArgs = isPartialRight ? composeArgsRight(funcArgs, funcHolders, partialRightArgs) : baseSlice(funcArgs);
- partialRightHolders = isPartialRight ? replaceHolders(partialRightArgs, PLACEHOLDER) : baseSlice(funcHolders);
+ // compose partial right arguments
+ value = data[5];
+ if (value) {
+ funcHolders = data[6];
+ partialsRight = isPartialRight ? composeArgsRight(partialsRight, value, funcHolders) : baseSlice(value);
+ holdersRight = isPartialRight ? replaceHolders(partialsRight, PLACEHOLDER) : baseSlice(funcHolders);
+ }
+ // append argument positions
+ value = data[7];
+ if (value) {
+ value = baseSlice(value);
+ if (argPos) {
+ push.apply(value, argPos);
+ }
+ argPos = value;
+ }
+ // use metadata `arity` if not provided
+ if (arity == null) {
+ arity = data[8];
}
}
if (arity == null) {
arity = isBindKey ? 0 : func.length;
+ } else {
+ arity = nativeMax(+arity || 0, 0);
+ }
+ if (oldPartials) {
+ arity = nativeMax(arity - (oldPartials.length - oldHolders.length), 0);
}
if (bitmask == BIND_FLAG) {
var result = createBindWrapper(func, thisArg);
- } else if ((bitmask == PARTIAL_FLAG || bitmask == (BIND_FLAG | PARTIAL_FLAG)) && !partialHolders.length) {
- result = createPartialWrapper(func, bitmask, partialArgs, thisArg);
+ } else if ((bitmask == PARTIAL_FLAG || bitmask == (BIND_FLAG | PARTIAL_FLAG)) && !holders.length) {
+ result = createPartialWrapper(func, bitmask, partials, thisArg);
} else {
- result = createHybridWrapper(func, bitmask, arity, thisArg, partialArgs, partialHolders, partialRightArgs, partialRightHolders);
+ result = createHybridWrapper(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, arity);
}
var setter = data ? baseSetData : setData;
- return setter(result, [func, bitmask, arity, thisArg, partialArgs, partialHolders, partialRightArgs, partialRightHolders]);
+ return setter(result, [func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, arity]);
}
/**
@@ -2940,12 +3166,12 @@
if (!isObject(object)) {
return false;
}
- var type = typeof index,
- prereq = type == 'string';
-
+ var type = typeof index;
if (type == 'number') {
- var length = object.length;
- prereq = (isLength(length) && index > -1 && index < length && index % 1 == 0);
+ var length = object.length,
+ prereq = isLength(length) && isIndex(index, length);
+ } else {
+ prereq = type == 'string';
}
return prereq && object[index] === value;
}
@@ -3018,6 +3244,28 @@
return result;
}
+ /**
+ * Reorder `array` according to the specified indexes where the element at
+ * the first index is assigned as the first element, the element at
+ * the second index is assigned as the second element, and so on.
+ *
+ * @private
+ * @param {Array} array The array to reorder.
+ * @param {Array} indexes The arranged array indexes.
+ * @returns {Array} Returns `array`.
+ */
+ function reorder(array, indexes) {
+ var arrLength = array.length,
+ length = nativeMin(indexes.length, arrLength),
+ oldArray = baseSlice(array);
+
+ while (length--) {
+ var index = indexes[length];
+ array[length] = isIndex(index, arrLength) ? oldArray[index] : undefined;
+ }
+ return array;
+ }
+
/**
* Sets metadata for `func`.
*
@@ -3093,21 +3341,19 @@
*/
function shimKeys(object) {
var props = keysIn(object),
- length = props.length,
- objLength = length && object.length,
+ propsLength = props.length,
+ length = propsLength && object.length,
support = lodash.support;
- var allowIndexes = typeof objLength == 'number' && objLength > 0 &&
+ var allowIndexes = typeof length == 'number' && length > 0 &&
(isArray(object) || (support.nonEnumArgs && isArguments(object)));
- var keyIndex,
- index = -1,
+ var index = -1,
result = [];
- while (++index < length) {
+ while (++index < propsLength) {
var key = props[index];
- if ((allowIndexes && (keyIndex = +key, keyIndex > -1 && keyIndex < objLength && keyIndex % 1 == 0)) ||
- hasOwnProperty.call(object, key)) {
+ if ((allowIndexes && isIndex(key, length)) || hasOwnProperty.call(object, key)) {
result.push(key);
}
}
@@ -3165,12 +3411,13 @@
* // => [['a', 'b', 'c'], ['d']]
*/
function chunk(array, size, guard) {
+ size = (guard || size == null) ? 1 : nativeMax(+size || 1, 1);
+
var index = 0,
length = array ? array.length : 0,
resIndex = -1,
- result = [];
+ result = Array(ceil(length / size));
- size = (guard || size == null) ? 1 : nativeMax(+size || 1, 1);
while (index < length) {
result[++resIndex] = slice(array, index, (index += size));
}
@@ -3236,7 +3483,7 @@
break;
}
}
- return baseDifference(arguments[index], baseFlatten(arguments, false, true, ++index));
+ return baseDifference(value, baseFlatten(arguments, false, true, ++index));
}
/**
@@ -3328,17 +3575,17 @@
* // => [1]
*
* var users = [
- * { 'user': 'barney', 'employer': 'slate' },
- * { 'user': 'fred', 'employer': 'slate', 'blocked': true },
- * { 'user': 'pebbles', 'employer': 'na', 'blocked': true }
+ * { 'user': 'barney', 'status': 'busy', 'active': false },
+ * { 'user': 'fred', 'status': 'busy', 'active': true },
+ * { 'user': 'pebbles', 'status': 'away', 'active': true }
* ];
*
* // using "_.pluck" callback shorthand
- * _.pluck(_.dropRightWhile(users, 'blocked'), 'user');
+ * _.pluck(_.dropRightWhile(users, 'active'), 'user');
* // => ['barney']
*
* // using "_.where" callback shorthand
- * _.pluck(_.dropRightWhile(users, { 'employer': 'na' }), 'user');
+ * _.pluck(_.dropRightWhile(users, { 'status': 'away' }), 'user');
* // => ['barney', 'fred']
*/
function dropRightWhile(array, predicate, thisArg) {
@@ -3376,17 +3623,17 @@
* // => [3]
*
* var users = [
- * { 'user': 'barney', 'employer': 'slate', 'blocked': true },
- * { 'user': 'fred', 'employer': 'slate' },
- * { 'user': 'pebbles', 'employer': 'na', 'blocked': true }
+ * { 'user': 'barney', 'status': 'busy', 'active': true },
+ * { 'user': 'fred', 'status': 'busy', 'active': false },
+ * { 'user': 'pebbles', 'status': 'away', 'active': true }
* ];
*
* // using "_.pluck" callback shorthand
- * _.pluck(_.dropWhile(users, 'blocked'), 'user');
+ * _.pluck(_.dropWhile(users, 'active'), 'user');
* // => ['fred', 'pebbles']
*
* // using "_.where" callback shorthand
- * _.pluck(_.dropWhile(users, { 'employer': 'slate' }), 'user');
+ * _.pluck(_.dropWhile(users, { 'status': 'busy' }), 'user');
* // => ['pebbles']
*/
function dropWhile(array, predicate, thisArg) {
@@ -3421,22 +3668,20 @@
* @example
*
* var users = [
- * { 'user': 'barney', 'age': 36 },
- * { 'user': 'fred', 'age': 40, 'blocked': true },
- * { 'user': 'pebbles', 'age': 1 }
+ * { 'user': 'barney', 'age': 36, 'active': false },
+ * { 'user': 'fred', 'age': 40, 'active': true },
+ * { 'user': 'pebbles', 'age': 1, 'active': false }
* ];
*
- * _.findIndex(users, function(chr) {
- * return chr.age < 20;
- * });
- * // => 2
- *
- * // using "_.where" callback shorthand
- * _.findIndex(users, { 'age': 36 });
+ * _.findIndex(users, function(chr) { return chr.age < 40; });
* // => 0
*
+ * // using "_.where" callback shorthand
+ * _.findIndex(users, { 'age': 1 });
+ * // => 2
+ *
* // using "_.pluck" callback shorthand
- * _.findIndex(users, 'blocked');
+ * _.findIndex(users, 'active');
* // => 1
*/
function findIndex(array, predicate, thisArg) {
@@ -3475,23 +3720,21 @@
* @example
*
* var users = [
- * { 'user': 'barney', 'age': 36, 'blocked': true },
- * { 'user': 'fred', 'age': 40 },
- * { 'user': 'pebbles', 'age': 1, 'blocked': true }
+ * { 'user': 'barney', 'age': 36, 'active': true },
+ * { 'user': 'fred', 'age': 40, 'active': false },
+ * { 'user': 'pebbles', 'age': 1, 'active': false }
* ];
*
- * _.findLastIndex(users, function(chr) {
- * return chr.age > 30;
- * });
- * // => 1
+ * _.findLastIndex(users, function(chr) { return chr.age < 40; });
+ * // => 2
*
* // using "_.where" callback shorthand
- * _.findLastIndex(users, { 'age': 36 });
- * // => 0
+ * _.findLastIndex(users, { 'age': 40});
+ * // => 1
*
* // using "_.pluck" callback shorthand
- * _.findLastIndex(users, 'blocked');
- * // => 2
+ * _.findLastIndex(users, 'active');
+ * // => 0
*/
function findLastIndex(array, predicate, thisArg) {
var length = array ? array.length : 0;
@@ -3635,8 +3878,8 @@
}
/**
- * Creates an array of unique values present in all provided arrays using
- * `SameValueZero` for equality comparisons.
+ * Creates an array of unique values in all provided arrays using `SameValueZero`
+ * for equality comparisons.
*
* **Note:** `SameValueZero` comparisons are like strict equality comparisons,
* e.g. `===`, except that `NaN` matches `NaN`. See the
@@ -3659,14 +3902,13 @@
argsLength = arguments.length,
caches = [],
indexOf = getIndexOf(),
- prereq = createCache && indexOf == baseIndexOf;
+ isCommon = indexOf == baseIndexOf;
while (++argsIndex < argsLength) {
var value = arguments[argsIndex];
if (isArray(value) || isArguments(value)) {
args.push(value);
- caches.push(prereq && value.length >= 120 &&
- createCache(argsIndex && value));
+ caches.push(isCommon && value.length >= 120 && createCache(argsIndex && value));
}
}
argsLength = args.length;
@@ -4113,17 +4355,17 @@
* // => [2, 3]
*
* var users = [
- * { 'user': 'barney', 'employer': 'slate' },
- * { 'user': 'fred', 'employer': 'slate', 'blocked': true },
- * { 'user': 'pebbles', 'employer': 'na', 'blocked': true }
+ * { 'user': 'barney', 'status': 'busy', 'active': false },
+ * { 'user': 'fred', 'status': 'busy', 'active': true },
+ * { 'user': 'pebbles', 'status': 'away', 'active': true }
* ];
*
* // using "_.pluck" callback shorthand
- * _.pluck(_.takeRightWhile(users, 'blocked'), 'user');
+ * _.pluck(_.takeRightWhile(users, 'active'), 'user');
* // => ['fred', 'pebbles']
*
* // using "_.where" callback shorthand
- * _.pluck(_.takeRightWhile(users, { 'employer': 'na' }), 'user');
+ * _.pluck(_.takeRightWhile(users, { 'status': 'away' }), 'user');
* // => ['pebbles']
*/
function takeRightWhile(array, predicate, thisArg) {
@@ -4161,17 +4403,17 @@
* // => [1, 2]
*
* var users = [
- * { 'user': 'barney', 'employer': 'slate', 'blocked': true },
- * { 'user': 'fred', 'employer': 'slate' },
- * { 'user': 'pebbles', 'employer': 'na', 'blocked': true }
+ * { 'user': 'barney', 'status': 'busy', 'active': true },
+ * { 'user': 'fred', 'status': 'busy', 'active': false },
+ * { 'user': 'pebbles', 'status': 'away', 'active': true }
* ];
*
* // using "_.pluck" callback shorthand
- * _.pluck(_.takeWhile(users, 'blocked'), 'user');
+ * _.pluck(_.takeWhile(users, 'active'), 'user');
* // => ['barney']
*
* // using "_.where" callback shorthand
- * _.pluck(_.takeWhile(users, { 'employer': 'slate' }), 'user');
+ * _.pluck(_.takeWhile(users, { 'status': 'busy' }), 'user');
* // => ['barney', 'fred']
*/
function takeWhile(array, predicate, thisArg) {
@@ -4430,7 +4672,7 @@
* @memberOf _
* @category Chain
* @param {*} value The value to wrap.
- * @returns {Object} Returns the new `LodashWrapper` object.
+ * @returns {Object} Returns the new `lodash` object.
* @example
*
* var users = [
@@ -4500,30 +4742,13 @@
return interceptor.call(thisArg, value);
}
- /*------------------------------------------------------------------------*/
-
- /**
- * A fast path for creating `lodash` wrapper objects.
- *
- * @private
- * @param {*} value The value to wrap.
- * @param {boolean} [chainAll=false] Enable chaining for all methods.
- * @param {Array} [queue=[]] Actions to peform to resolve the unwrapped value.
- * @returns {Object} Returns a `LodashWrapper` instance.
- */
- function LodashWrapper(value, chainAll, queue) {
- this.__chain__ = !!chainAll;
- this.__queue__ = queue || [];
- this.__wrapped__ = value;
- }
-
/**
* Enables explicit method chaining on the wrapper object.
*
* @name chain
* @memberOf _
* @category Chain
- * @returns {*} Returns the `LodashWrapper` object.
+ * @returns {*} Returns the `lodash` object.
* @example
*
* var users = [
@@ -4555,7 +4780,7 @@
* @name chain
* @memberOf _
* @category Chain
- * @returns {Object} Returns the new reversed `LodashWrapper` object.
+ * @returns {Object} Returns the new reversed `lodash` object.
* @example
*
* var array = [1, 2, 3];
@@ -4623,120 +4848,6 @@
/*------------------------------------------------------------------------*/
- /**
- * Wraps `value` as a `LazyWrapper` object.
- *
- * @private
- * @param {*} value The value to wrap.
- * @returns {Object} Returns a `LazyWrapper` instance.
- */
- function LazyWrapper(value) {
- this.dir = 1;
- this.dropCount = 0;
- this.filtered = false;
- this.iteratees = null;
- this.takeCount = POSITIVE_INFINITY;
- this.views = null;
- this.wrapped = value;
- }
-
- /**
- * Creates a clone of the `LazyWrapper` object.
- *
- * @private
- * @name clone
- * @memberOf LazyWrapper
- * @returns {Object} Returns the cloned `LazyWrapper` object.
- */
- function lazyClone() {
- var iteratees = this.iteratees,
- views = this.views,
- result = new LazyWrapper(this.wrapped);
-
- result.dir = this.dir;
- result.dropCount = this.dropCount;
- result.filtered = this.filtered;
- result.iteratees = iteratees ? baseSlice(iteratees) : null;
- result.takeCount = this.takeCount;
- result.views = views ? baseSlice(views) : null;
- return result;
- }
-
- /**
- * Reverses the direction of lazy iteration.
- *
- * @private
- * @name reverse
- * @memberOf LazyWrapper
- * @returns {Object} Returns the new reversed `LazyWrapper` object.
- */
- function lazyReverse() {
- var filtered = this.filtered,
- result = filtered ? new LazyWrapper(this) : this.clone();
-
- result.dir = this.dir * -1;
- result.filtered = filtered;
- return result;
- }
-
- /**
- * Extracts the unwrapped value from its wrapper.
- *
- * @private
- * @name value
- * @memberOf LazyWrapper
- * @returns {*} Returns the unwrapped value.
- */
- function lazyValue() {
- var array = this.wrapped.value(),
- dir = this.dir,
- isRight = dir < 0,
- length = array.length,
- view = getView(0, length, this.views),
- start = view.start,
- end = view.end,
- dropCount = this.dropCount,
- takeCount = nativeMin(end - start, this.takeCount - dropCount),
- index = isRight ? end : start - 1,
- iteratees = this.iteratees,
- iterLength = iteratees ? iteratees.length : 0,
- resIndex = 0,
- result = [];
-
- outer:
- while (length-- && resIndex < takeCount) {
- index += dir;
-
- var iterIndex = -1,
- value = array[index];
-
- while (++iterIndex < iterLength) {
- var data = iteratees[iterIndex],
- iteratee = data.iteratee,
- computed = iteratee(value, index, array),
- type = data.type;
-
- if (type == LAZY_MAP_FLAG) {
- value = computed;
- } else if (!computed) {
- if (type == LAZY_FILTER_FLAG) {
- continue outer;
- } else {
- break outer;
- }
- }
- }
- if (dropCount) {
- dropCount--;
- } else {
- result[resIndex++] = value;
- }
- }
- return isRight ? result.reverse() : result;
- }
-
- /*------------------------------------------------------------------------*/
-
/**
* Creates an array of elements corresponding to the specified keys, or indexes,
* of the collection. Keys may be specified as individual arguments or as arrays
@@ -4765,9 +4876,9 @@
}
/**
- * Checks if `value` is present in `collection` using `SameValueZero` for
- * equality comparisons. If `fromIndex` is negative, it is used as the offset
- * from the end of the collection.
+ * Checks if `value` is in `collection` using `SameValueZero` for equality
+ * comparisons. If `fromIndex` is negative, it is used as the offset from
+ * the end of the collection.
*
* **Note:** `SameValueZero` comparisons are like strict equality comparisons,
* e.g. `===`, except that `NaN` matches `NaN`. See the
@@ -4779,7 +4890,7 @@
* @alias include
* @category Collection
* @param {Array|Object|string} collection The collection to search.
- * @param {*} target The value to check for.
+ * @param {*} target The value to search for.
* @param {number} [fromIndex=0] The index to search from.
* @returns {boolean} Returns `true` if a matching element is found, else `false`.
* @example
@@ -4931,17 +5042,17 @@
* // => [2, 4]
*
* var users = [
- * { 'user': 'barney', 'age': 36 },
- * { 'user': 'fred', 'age': 40, 'blocked': true }
+ * { 'user': 'barney', 'age': 36, 'active': false },
+ * { 'user': 'fred', 'age': 40, 'active': true }
* ];
*
* // using "_.pluck" callback shorthand
- * _.filter(users, 'blocked');
- * // => [{ 'user': 'fred', 'age': 40, 'blocked': true }]
+ * _.pluck(_.filter(users, 'active'), 'user');
+ * // => ['fred']
*
* // using "_.where" callback shorthand
- * _.filter(users, { 'age': 36 });
- * // => [{ 'user': 'barney', 'age': 36 }]
+ * _.pluck(_.filter(users, { 'age': 36 }), 'user');
+ * // => ['barney']
*/
function filter(collection, predicate, thisArg) {
var func = isArray(collection) ? arrayFilter : baseFilter;
@@ -4975,23 +5086,21 @@
* @example
*
* var users = [
- * { 'user': 'barney', 'age': 36 },
- * { 'user': 'fred', 'age': 40, 'blocked': true },
- * { 'user': 'pebbles', 'age': 1 }
+ * { 'user': 'barney', 'age': 36, 'active': false },
+ * { 'user': 'fred', 'age': 40, 'active': true },
+ * { 'user': 'pebbles', 'age': 1, 'active': false }
* ];
*
- * _.find(users, function(chr) {
- * return chr.age < 40;
- * });
- * // => { 'user': 'barney', 'age': 36 }
+ * _.result(_.find(users, function(chr) { return chr.age < 40; }), 'user');
+ * // => 'barney'
*
* // using "_.where" callback shorthand
- * _.find(users, { 'age': 1 });
- * // => { 'user': 'pebbles', 'age': 1 }
+ * _.result(_.find(users, { 'age': 1 }), 'user');
+ * // => 'pebbles'
*
* // using "_.pluck" callback shorthand
- * _.find(users, 'blocked');
- * // => { 'user': 'fred', 'age': 40, 'blocked': true }
+ * _.result(_.find(users, 'active'), 'user');
+ * // => 'fred'
*/
function find(collection, predicate, thisArg) {
if (isArray(collection)) {
@@ -5039,15 +5148,15 @@
* @example
*
* var users = [
- * { 'user': 'barney', 'age': 36, 'employer': 'slate' },
- * { 'user': 'fred', 'age': 40, 'employer': 'slate' }
+ * { 'user': 'barney', 'age': 36, 'status': 'busy' },
+ * { 'user': 'fred', 'age': 40, 'status': 'busy' }
* ];
*
- * _.findWhere(users, { 'employer': 'slate' });
- * // => { 'user': 'barney', 'age': 36, 'employer': 'slate' }
+ * _.findWhere(users, { 'status': 'busy' });
+ * // => { 'user': 'barney', 'age': 36, 'status': 'busy' }
*
* _.findWhere(users, { 'age': 40 });
- * // => { 'user': 'fred', 'age': 40, 'employer': 'slate' }
+ * // => { 'user': 'fred', 'age': 40, 'status': 'busy' }
*/
function findWhere(collection, source) {
return find(collection, matches(source));
@@ -5439,9 +5548,9 @@
* // => [[1, 3], [2]]
*
* var users = [
- * { 'user': 'barney', 'age': 36 },
- * { 'user': 'fred', 'age': 40, 'blocked': true },
- * { 'user': 'pebbles', 'age': 1 }
+ * { 'user': 'barney', 'age': 36, 'active': false },
+ * { 'user': 'fred', 'age': 40, 'active': true },
+ * { 'user': 'pebbles', 'age': 1, 'active': false }
* ];
*
* // using "_.where" callback shorthand
@@ -5449,7 +5558,7 @@
* // => [['pebbles'], ['barney', 'fred']]
*
* // using "_.pluck" callback shorthand
- * _.map(_.partition(users, 'blocked'), function(array) { return _.pluck(array, 'user'); });
+ * _.map(_.partition(users, 'active'), function(array) { return _.pluck(array, 'user'); });
* // => [['fred'], ['barney', 'pebbles']]
*/
var partition = createAggregator(function(result, value, key) {
@@ -5566,17 +5675,17 @@
* // => [1, 3]
*
* var users = [
- * { 'user': 'barney', 'age': 36 },
- * { 'user': 'fred', 'age': 40, 'blocked': true }
+ * { 'user': 'barney', 'age': 36, 'active': false },
+ * { 'user': 'fred', 'age': 40, 'active': true }
* ];
*
* // using "_.pluck" callback shorthand
- * _.reject(users, 'blocked');
- * // => [{ 'user': 'barney', 'age': 36 }]
+ * _.pluck(_.reject(users, 'active'), 'user');
+ * // => ['barney']
*
* // using "_.where" callback shorthand
- * _.reject(users, { 'age': 36 });
- * // => [{ 'user': 'fred', 'age': 40, 'blocked': true }]
+ * _.pluck(_.reject(users, { 'age': 36 }), 'user');
+ * // => ['fred']
*/
function reject(collection, predicate, thisArg) {
var func = isArray(collection) ? arrayFilter : baseFilter;
@@ -5703,12 +5812,12 @@
* // => true
*
* var users = [
- * { 'user': 'barney', 'age': 36 },
- * { 'user': 'fred', 'age': 40, 'blocked': true }
+ * { 'user': 'barney', 'age': 36, 'active': false },
+ * { 'user': 'fred', 'age': 40, 'active': true }
* ];
*
* // using "_.pluck" callback shorthand
- * _.some(users, 'blocked');
+ * _.some(users, 'active');
* // => true
*
* // using "_.where" callback shorthand
@@ -5844,8 +5953,8 @@
* @example
*
* var users = [
- * { 'user': 'barney', 'age': 36, 'employer': 'slate', 'pets': ['hoppy'] },
- * { 'user': 'fred', 'age': 40, 'employer': 'slate', 'pets': ['baby puss', 'dino'] }
+ * { 'user': 'barney', 'age': 36, 'status': 'busy', 'pets': ['hoppy'] },
+ * { 'user': 'fred', 'age': 40, 'status': 'busy', 'pets': ['baby puss', 'dino'] }
* ];
*
* _.pluck(_.where(users, { 'age': 36 }), 'user');
@@ -5854,7 +5963,7 @@
* _.pluck(_.where(users, { 'pets': ['dino'] }), 'user');
* // => ['fred']
*
- * _.pluck(_.where(users, { 'employer': 'slate' }), 'user');
+ * _.pluck(_.where(users, { 'status': 'busy' }), 'user');
* // => ['barney', 'fred']
*/
function where(collection, source) {
@@ -5967,13 +6076,14 @@
* // => 'hi fred'
*/
function bind(func, thisArg) {
- if (arguments.length < 3) {
- return createWrapper(func, BIND_FLAG, null, thisArg);
- }
- var args = slice(arguments, 2),
- holders = replaceHolders(args, bind.placeholder);
+ var bitmask = BIND_FLAG;
+ if (arguments.length > 2) {
+ var partials = slice(arguments, 2),
+ holders = replaceHolders(partials, bind.placeholder);
- return basePartial(func, BIND_FLAG | PARTIAL_FLAG, args, holders, thisArg);
+ bitmask |= PARTIAL_FLAG;
+ }
+ return createWrapper(func, bitmask, thisArg, partials, holders);
}
/**
@@ -6048,17 +6158,17 @@
function bindKey(object, key) {
var bitmask = BIND_FLAG | BIND_KEY_FLAG;
if (arguments.length > 2) {
- var args = slice(arguments, 2),
- holders = replaceHolders(args, bindKey.placeholder);
+ var partials = slice(arguments, 2),
+ holders = replaceHolders(partials, bindKey.placeholder);
+
+ bitmask |= PARTIAL_FLAG;
}
- return args
- ? createWrapper(key, bitmask, null, object, args, holders)
- : createWrapper(key, bitmask, null, object);
+ return createWrapper(key, bitmask, object, partials, holders);
}
/**
* Creates a function that accepts one or more arguments of `func` that when
- * called either invokes `func` returning its result if all `func` arguments
+ * called either invokes `func` returning its result, if all `func` arguments
* have been provided, or returns a function that accepts one or more of the
* remaining `func` arguments, and so on. The arity of `func` can be specified
* if `func.length` is not sufficient.
@@ -6075,7 +6185,7 @@
* @example
*
* var curried = _.curry(function(a, b, c) {
- * console.log([a, b, c]);
+ * return [a, b, c];
* });
*
* curried(1)(2)(3);
@@ -6088,7 +6198,7 @@
* // => [1, 2, 3]
*/
function curry(func, arity, guard) {
- var result = baseCurry(func, CURRY_FLAG, guard ? null : arity);
+ var result = createWrapper(func, CURRY_FLAG, null, null, null, null, guard ? null : arity);
result.placeholder = curry.placeholder;
return result;
}
@@ -6109,7 +6219,7 @@
* @example
*
* var curried = _.curryRight(function(a, b, c) {
- * console.log([a, b, c]);
+ * return [a, b, c];
* });
*
* curried(3)(2)(1);
@@ -6122,7 +6232,7 @@
* // => [1, 2, 3]
*/
function curryRight(func, arity, guard) {
- var result = baseCurry(func, CURRY_RIGHT_FLAG, guard ? null : arity);
+ var result = createWrapper(func, CURRY_RIGHT_FLAG, null, null, null, null, guard ? null : arity);
result.placeholder = curryRight.placeholder;
return result;
}
@@ -6322,8 +6432,8 @@
if (!isFunction(func)) {
throw new TypeError(FUNC_ERROR_TEXT);
}
- var args = slice(arguments, 1);
- return setTimeout(function() { func.apply(undefined, args); }, 1);
+ var args = arguments;
+ return setTimeout(function() { func.apply(undefined, slice(args, 1)); }, 1);
}
/**
@@ -6346,8 +6456,8 @@
if (!isFunction(func)) {
throw new TypeError(FUNC_ERROR_TEXT);
}
- var args = slice(arguments, 2);
- return setTimeout(function() { func.apply(undefined, args); }, wait);
+ var args = arguments;
+ return setTimeout(function() { func.apply(undefined, slice(args, 2)); }, wait);
}
/**
@@ -6547,7 +6657,7 @@
* initialize();
* // `initialize` invokes `createApplication` once
*/
- var once = basePartial(before,PARTIAL_FLAG, [2], []);
+ var once = createWrapper(before, PARTIAL_FLAG, null, [2]);
/**
* Creates a function that invokes `func` with `partial` arguments prepended
@@ -6571,10 +6681,10 @@
* // => 'hello fred'
*/
function partial(func) {
- var args = slice(arguments, 1),
- holders = replaceHolders(args, partial.placeholder);
+ var partials = slice(arguments, 1),
+ holders = replaceHolders(partials, partial.placeholder);
- return basePartial(func, PARTIAL_FLAG, args, holders);
+ return createWrapper(func, PARTIAL_FLAG, null, partials, holders);
}
/**
@@ -6609,10 +6719,43 @@
* // => { 'a': { 'b': { 'c': 1, 'd': 2 } } }
*/
function partialRight(func) {
- var args = slice(arguments, 1),
- holders = replaceHolders(args, partialRight.placeholder);
+ var partials = slice(arguments, 1),
+ holders = replaceHolders(partials, partialRight.placeholder);
- return basePartial(func, PARTIAL_RIGHT_FLAG, args, holders);
+ return createWrapper(func, PARTIAL_RIGHT_FLAG, null, partials, holders);
+ }
+
+ /**
+ * Creates a function that invokes `func` with arguments arranged according
+ * to the specified indexes where the argument value at the first index is
+ * provided as the first argument, the argument value at the second index is
+ * provided as the second argument, and so on.
+ *
+ * @static
+ * @memberOf _
+ * @category Function
+ * @param {Function} func The function to rearrange arguments for.
+ * @param {...(number|number[])} [indexes] The arranged argument indexes,
+ * specified as individual indexes or arrays of indexes.
+ * @returns {Function} Returns the new function.
+ * @example
+ *
+ * var rearged = _.rearg(function(a, b, c) {
+ * return [a, b, c];
+ * }, 2, 0, 1);
+ *
+ * rearged('b', 'c', 'a')
+ * // => ['a', 'b', 'c']
+ *
+ * var map = _.rearg(_.map, [1, 0]);
+ * map(function(n) { return n * 3; }, [1, 2, 3]);
+ * // => [3, 6, 9]
+ */
+ function rearg(func) {
+ var indexes = baseFlatten(arguments, false, false, 1);
+ return indexes.length
+ ? createWrapper(func, REARG_FLAG, null, null, null, [indexes])
+ : createWrapper(func);
}
/**
@@ -6694,64 +6837,8 @@
* // => 'fred, barney, & pebbles
'
*/
function wrap(value, wrapper) {
- return basePartial(wrapper, PARTIAL_FLAG, [value], []);
- }
-
- /*------------------------------------------------------------------------*/
-
- /**
- * Creates the cache used by `_.memoize`.
- *
- * @private
- * @static
- * @name Cache
- * @memberOf _.memoize
- */
- function MemCache() {
- this.__wrapped__ = {};
- }
-
- /**
- * Gets the value associated with `key`.
- *
- * @private
- * @name get
- * @memberOf _.memoize.Cache
- * @param {string} key The key of the value to retrieve.
- * @returns {*} Returns the cached value.
- */
- function memGet(key) {
- return this.__wrapped__[key];
- }
-
- /**
- * Checks if an entry for `key` exists.
- *
- * @private
- * @name get
- * @memberOf _.memoize.Cache
- * @param {string} key The name of the entry to check.
- * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
- */
- function memHas(key) {
- return key != '__proto__' && hasOwnProperty.call(this.__wrapped__, key);
- }
-
- /**
- * Sets the value associated with `key`.
- *
- * @private
- * @name get
- * @memberOf _.memoize.Cache
- * @param {string} key The key of the value to set.
- * @param {*} value The value to set.
- * @returns {Object} Returns the cache object.
- */
- function memSet(key, value) {
- if (key != '__proto__') {
- this.__wrapped__[key] = value;
- }
- return this;
+ wrapper = wrapper == null ? identity : wrapper;
+ return createWrapper(wrapper, PARTIAL_FLAG, null, [value]);
}
/*------------------------------------------------------------------------*/
@@ -7128,10 +7215,20 @@
* // => false
*/
function isFunction(value) {
- // avoid a Chakra bug in IE 11
- // https://github.com/jashkenas/underscore/issues/1621
+ // Use `|| false` to avoid a Chakra bug in compatibility modes of IE 11.
+ // See https://github.com/jashkenas/underscore/issues/1621.
return typeof value == 'function' || false;
}
+ // fallback for environments that return incorrect `typeof` operator results
+ if (isFunction(/x/) || !Uint8Array || !isFunction(Uint8Array)) {
+ isFunction = function(value) {
+ // the use of `Object#toString` avoids issues with the `typeof` operator
+ // in older versions of Chrome and Safari which return 'function' for
+ // regexes and modern Safari which returns 'object' for typed array
+ // constructors
+ return toString.call(value) == funcClass;
+ };
+ }
/**
* Checks if `value` is the language type of `Object`.
@@ -7156,8 +7253,8 @@
* // => false
*/
function isObject(value) {
- // avoid a V8 bug in Chrome 19-20
- // https://code.google.com/p/v8/issues/detail?id=2291
+ // Avoid a V8 bug in Chrome 19-20.
+ // See https://code.google.com/p/v8/issues/detail?id=2291.
var type = typeof value;
return type == 'function' || (value && type == 'object') || false;
}
@@ -7211,10 +7308,13 @@
* // => false
*/
function isNative(value) {
- if (isFunction(value)) {
+ if (value == null) {
+ return false;
+ }
+ if (toString.call(value) == funcClass) {
return reNative.test(fnToString.call(value));
}
- return (value && typeof value == 'object' && reHostCtor.test(value)) || false;
+ return (typeof value == 'object' && reHostCtor.test(value)) || false;
}
/**
@@ -7388,15 +7488,15 @@
* @returns {Object} Returns the destination object.
* @example
*
- * _.assign({ 'user': 'fred' }, { 'age': 40 }, { 'employer': 'slate' });
- * // => { 'user': 'fred', 'age': 40, 'employer': 'slate' }
+ * _.assign({ 'user': 'fred' }, { 'age': 40 }, { 'status': 'busy' });
+ * // => { 'user': 'fred', 'age': 40, 'status': 'busy' }
*
* var defaults = _.partialRight(_.assign, function(value, other) {
* return typeof value == 'undefined' ? other : value;
* });
*
- * defaults({ 'user': 'barney' }, { 'age': 36 }, { 'user': 'fred', 'employer': 'slate' });
- * // => { 'user': 'barney', 'age': 36, 'employer': 'slate' }
+ * defaults({ 'user': 'barney' }, { 'age': 36 }, { 'user': 'fred', 'status': 'busy' });
+ * // => { 'user': 'barney', 'age': 36, 'status': 'busy' }
*/
var assign = createAssigner(baseAssign);
@@ -7454,8 +7554,8 @@
* @returns {Object} Returns the destination object.
* @example
*
- * _.defaults({ 'user': 'barney' }, { 'age': 36 }, { 'user': 'fred', 'employer': 'slate' });
- * // => { 'user': 'barney', 'age': 36, 'employer': 'slate' }
+ * _.defaults({ 'user': 'barney' }, { 'age': 36 }, { 'user': 'fred', 'status': 'busy' });
+ * // => { 'user': 'barney', 'age': 36, 'status': 'busy' }
*/
function defaults(object) {
if (object == null) {
@@ -7489,14 +7589,12 @@
* @example
*
* var users = {
- * 'barney': { 'age': 36 },
- * 'fred': { 'age': 40, 'blocked': true },
- * 'pebbles': { 'age': 1 }
+ * 'barney': { 'age': 36, 'active': true },
+ * 'fred': { 'age': 40, 'active': false },
+ * 'pebbles': { 'age': 1, 'active': true }
* };
*
- * _.findKey(users, function(chr) {
- * return chr.age < 40;
- * });
+ * _.findKey(users, function(chr) { return chr.age < 40; });
* // => 'barney' (iteration order is not guaranteed)
*
* // using "_.where" callback shorthand
@@ -7504,8 +7602,8 @@
* // => 'pebbles'
*
* // using "_.pluck" callback shorthand
- * _.findKey(users, 'blocked');
- * // => 'fred'
+ * _.findKey(users, 'active');
+ * // => 'barney'
*/
function findKey(object, predicate, thisArg) {
predicate = getCallback(predicate, thisArg, 3);
@@ -7535,22 +7633,20 @@
* @example
*
* var users = {
- * 'barney': { 'age': 36, 'blocked': true },
- * 'fred': { 'age': 40 },
- * 'pebbles': { 'age': 1, 'blocked': true }
+ * 'barney': { 'age': 36, 'active': true },
+ * 'fred': { 'age': 40, 'active': false },
+ * 'pebbles': { 'age': 1, 'active': true }
* };
*
- * _.findLastKey(users, function(chr) {
- * return chr.age < 40;
- * });
- * // => returns `pebbles`, assuming `_.findKey` returns `barney`
+ * _.findLastKey(users, function(chr) { return chr.age < 40; });
+ * // => returns `pebbles` assuming `_.findKey` returns `barney`
*
* // using "_.where" callback shorthand
* _.findLastKey(users, { 'age': 40 });
* // => 'fred'
*
* // using "_.pluck" callback shorthand
- * _.findLastKey(users, 'blocked');
+ * _.findLastKey(users, 'active');
* // => 'pebbles'
*/
function findLastKey(object, predicate, thisArg) {
@@ -7824,11 +7920,9 @@
length = (typeof length == 'number' && length > 0 &&
(isArray(object) || (support.nonEnumArgs && isArguments(object))) && length) || 0;
- var keyIndex,
- Ctor = object.constructor,
+ var Ctor = object.constructor,
index = -1,
isProto = typeof Ctor == 'function' && Ctor.prototype == object,
- maxIndex = length - 1,
result = Array(length),
skipIndexes = length > 0;
@@ -7836,7 +7930,7 @@
result[index] = String(index);
}
for (var key in object) {
- if (!(skipIndexes && (keyIndex = +key, keyIndex > -1 && keyIndex <= maxIndex && keyIndex % 1 == 0)) &&
+ if (!(skipIndexes && isIndex(key, length)) &&
!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {
result.push(key);
}
@@ -7872,7 +7966,7 @@
* // => { 'a': 3, 'b': 6, 'c': 9 }
*
* var users = {
- * 'fred': { 'user': 'fred', 'age': 40 },
+ * 'fred': { 'user': 'fred', 'age': 40 },
* 'pebbles': { 'user': 'pebbles', 'age': 1 }
* };
*
@@ -9243,8 +9337,8 @@
* `undefined` or `0`, a `radix` of `10` is used unless `value` is a hexadecimal,
* in which case a `radix` of `16` is used.
*
- * **Note:** This method avoids differences in native ES3 and ES5 `parseInt`
- * implementations. See the [ES5 spec](http://es5.github.io/#E) for more details.
+ * **Note:** This method aligns with the ES5 implementation of `parseInt`.
+ * See the [ES5 spec](http://es5.github.io/#E) for more details.
*
* @static
* @memberOf _
@@ -9266,7 +9360,7 @@
parseInt = function(value, radix, guard) {
// Firefox < 21 and Opera < 15 follow ES3 for `parseInt` and
// Chrome fails to trim leading whitespace characters.
- // See https://code.google.com/p/v8/issues/detail?id=3109
+ // See https://code.google.com/p/v8/issues/detail?id=3109.
value = trim(value);
radix = guard ? 0 : +radix;
return nativeParseInt(value, radix || (reHexPrefix.test(value) ? 16 : 10));
@@ -9274,8 +9368,8 @@
}
/**
- * Creates a "_.pluck" style function which returns the `key` value of a
- * given object.
+ * Creates a "_.pluck" style function which returns the property value
+ * of `key` on a given object.
*
* @static
* @memberOf _
@@ -9292,17 +9386,43 @@
* var getName = _.property('user');
*
* _.map(users, getName);
- * // => ['barney', 'fred']
+ * // => ['fred', barney']
*
- * _.sortBy(users, getName);
- * // => [{ 'user': 'barney', 'age': 36 }, { 'user': 'fred', 'age': 40 }]
+ * _.pluck(_.sortBy(users, getName), 'user');
+ * // => ['barney', 'fred']
*/
function property(key) {
+ key = String(key);
return function(object) {
return object == null ? undefined : object[key];
};
}
+ /**
+ * The inverse of `_.property`; this method creates a function which returns
+ * the property value of a given key on `object`.
+ *
+ * @static
+ * @memberOf _
+ * @category Utility
+ * @param {Object} object The object to inspect.
+ * @returns {Function} Returns the new function.
+ * @example
+ *
+ * var fred = { 'user': 'fred', 'age': 40, 'active': true };
+ * _.map(['age', 'active'], _.propertyOf(fred));
+ * // => [40, true]
+ *
+ * var object = { 'a': 3, 'b': 1, 'c': 2 };
+ * _.sortBy(['a', 'b', 'c'], _.propertyOf(object));
+ * // => ['b', 'c', 'a']
+ */
+ function propertyOf(object) {
+ return function(key) {
+ return object == null ? undefined : object[key];
+ };
+ }
+
/**
* Produces a random number between `min` and `max` (inclusive). If only one
* argument is provided a number between `0` and the given number is returned.
@@ -9453,8 +9573,8 @@
* _.result(object, 'age');
* // => 40
*
- * _.result(object, 'employer', 'slate');
- * // => 'slate'
+ * _.result(object, 'status', 'busy');
+ * // => 'busy'
*/
function result(object, key, defaultValue) {
var value = object == null ? undefined : object[key];
@@ -9482,7 +9602,7 @@
* // => [3, 6, 4]
*
* _.times(3, function(n) { mage.castSpell(n); });
- * // => invokes `mage.castSpell(n)` three times, passing `n` of `0`, `1`, and `2` respectively
+ * // => invokes `mage.castSpell(n)` three times with `n` of `0`, `1`, and `2` respectively
*
* _.times(3, function(n) { this.cast(n); }, mage);
* // => also invokes `mage.castSpell(n)` three times
@@ -9530,13 +9650,16 @@
// ensure `new LodashWrapper` is an instance of `lodash`
LodashWrapper.prototype = lodash.prototype;
- // add functions to the memoize cache
- MemCache.prototype.get = memGet;
- MemCache.prototype.has = memHas;
- MemCache.prototype.set = memSet;
+ // add functions to the `Map` cache
+ MapCache.prototype.get = mapGet;
+ MapCache.prototype.has = mapHas;
+ MapCache.prototype.set = mapSet;
+
+ // add functions to the `Set` cache
+ SetCache.prototype.push = cachePush;
// assign cache to `_.memoize`
- memoize.Cache = MemCache;
+ memoize.Cache = MapCache;
// add functions that return wrapped values when chaining
lodash.after = after;
@@ -9600,9 +9723,11 @@
lodash.pick = pick;
lodash.pluck = pluck;
lodash.property = property;
+ lodash.propertyOf = propertyOf;
lodash.pull = pull;
lodash.pullAt = pullAt;
lodash.range = range;
+ lodash.rearg = rearg;
lodash.reject = reject;
lodash.remove = remove;
lodash.rest = rest;
@@ -9872,7 +9997,7 @@
return result;
};
- // add `LazyWrapper` methods to `LodashWrapper`
+ // add `LazyWrapper` methods to `lodash.prototype`
baseForOwn(LazyWrapper.prototype, function(func, methodName) {
var retUnwrapped = /^(?:first|last)$/.test(methodName);
@@ -9899,7 +10024,7 @@
};
});
- // add `Array.prototype` functions to `LodashWrapper`
+ // add `Array.prototype` functions to `lodash.prototype`
arrayEach(['concat', 'join', 'pop', 'push', 'shift', 'sort', 'splice', 'unshift'], function(methodName) {
var func = arrayProto[methodName],
chainName = /^(?:push|sort|unshift)$/.test(methodName) ? 'tap' : 'thru',
diff --git a/dist/lodash.min.js b/dist/lodash.min.js
index cdbd45e3a..3a9d00b83 100644
--- a/dist/lodash.min.js
+++ b/dist/lodash.min.js
@@ -4,77 +4,78 @@
* Build: `lodash modern -o ./dist/lodash.js`
*/
;(function(){function n(n,t){for(var r=-1,e=n.length;++rt||!r||typeof n=="undefined"&&e)return 1;if(n=n&&9<=n&&13>=n||32==n||160==n||5760==n||6158==n||8192<=n&&(8202>=n||8232==n||8233==n||8239==n||8287==n||12288==n||65279==n)}function x(n,t){for(var r=-1,e=n.length,u=-1,o=[];++re&&(e=u)}return e}function Ut(n){for(var t=-1,r=n.length,e=Mu;++tu(t,i)&&f.push(i);return f}function Gt(n,t){var r=n?n.length:0;if(!Wr(r))return ur(n,t);for(var e=-1,u=Mr(n);++ec))return false}else{var g=p&&gu.call(n,"__wrapped__"),h=h&&gu.call(t,"__wrapped__");if(g||h)return fr(g?n.value():n,h?t.value():t,r,e,u,o);if(!s)return false;
-if(!f&&!p){switch(l){case vt:case yt:return+n==+t;case mt:return n!=+n?t!=+t:0==n?1/n==1/t:n==+t;case bt:case wt:return n==au(t)}return false}if(g=c?iu:n.constructor,l=i?iu:t.constructor,f){if(g.prototype.name!=l.prototype.name)return false}else if(p=!c&&gu.call(n,"constructor"),h=!i&&gu.call(t,"constructor"),p!=h||!p&&g!=l&&"constructor"in n&&"constructor"in t&&!(typeof g=="function"&&g instanceof g&&typeof l=="function"&&l instanceof l))return false;if(g=f?["message","name"]:lo(n),l=f?g:lo(t),c&&g.push("length"),i&&l.push("length"),c=g.length,p=l.length,c!=p&&!e)return false
-}for(u||(u=[]),o||(o=[]),l=u.length;l--;)if(u[l]==n)return o[l]==t;if(u.push(n),o.push(t),i=true,a)for(;i&&++le(a,p)&&((t||i)&&a.push(p),f.push(c))}return f}function dr(n,t){for(var r=-1,e=t(n),u=e.length,o=nu(u);++rt||null==r)return r;if(3t?0:t)}function Kr(n,t,r){var e=n?n.length:0;return t=e-((r||null==t?1:t)||0),Jr(n,0,0>t?0:t)}function Vr(n,t,r){var e=-1,u=n?n.length:0;
-for(t=Fr(t,r,3);++er?Wu(e+r,0):r||0;else if(r)return r=Xr(n,t),n=n[r],(t===t?t===n:n!==n)?r:-1;return l(n,t,r)}function Gr(n){return Pr(n,1)}function Jr(n,t,r){var e=-1,u=n?n.length:0,o=typeof r;if(r&&"number"!=o&&Nr(n,t,r)&&(t=0,r=u),t=null==t?0:+t||0,0>t&&(t=-t>u?0:u+t),r="undefined"==o||r>u?u:+r||0,0>r&&(r+=u),r&&r==u&&!t)return c(n);for(u=t>r?0:r-t,r=nu(u);++er?Wu(e+r,0):r||0:0,typeof n=="string"||!oo(n)&&Ue(n)?ri||r===Bu&&r===f)&&(i=r,f=n)}),f}function he(n,t){return se(n,Qe(t))}function ge(n,t,r,e){return(oo(n)?u:hr)(n,Fr(t,e,4),r,3>arguments.length,Gt)}function ve(n,t,r,e){return(oo(n)?o:hr)(n,Fr(t,e,4),r,3>arguments.length,Jt)}function ye(n){n=Br(n);for(var t=-1,r=n.length,e=nu(r);++targuments.length)return Rr(n,R,null,t);var r=Jr(arguments,2),e=x(r,_e.placeholder);return sr(n,R|T,r,e,t)}function be(n,t){var r=R|F;if(2=r||r>t?(f&&wu(f),r=p,f=s=p=k,r&&(h=go(),a=n.apply(c,i),s||f||(i=c=null))):s=ku(e,r)}function u(){s&&wu(s),f=s=p=k,(v||g!==t)&&(h=go(),a=n.apply(c,i),s||f||(i=c=null))}function o(){if(i=arguments,l=go(),c=this,p=v&&(s||!y),false===g)var r=y&&!s;else{f||y||(h=l);var o=g-(l-h),d=0>=o||o>g;d?(f&&(f=wu(f)),h=l,a=n.apply(c,i)):f||(f=ku(u,o))
-}return d&&s?s=wu(s):s||t===g||(s=ku(e,t)),r&&(d=true,a=n.apply(c,i)),!d||s||f||(i=c=null),a}var i,f,a,l,c,s,p,h=0,g=false,v=true;if(!De(n))throw new lu(M);if(t=0>t?0:t,true===r)var y=true,v=false;else Se(r)&&(y=r.leading,g="maxWait"in r&&Wu(+r.maxWait||0,t),v="trailing"in r?r.trailing:v);return o.cancel=function(){s&&wu(s),f&&wu(f),f=s=p=k},o}function Ae(){var n=arguments,r=n.length-1;if(0>r)return function(){};if(!t(n,De))throw new lu(M);return function(){for(var t=r,e=n[t].apply(this,arguments);t--;)e=n[t].call(this,e);
-return e}}function Ee(n,t){function r(){var e=r.cache,u=t?t.apply(this,arguments):arguments[0];if(e.has(u))return e.get(u);var o=n.apply(this,arguments);return e.set(u,o),o}if(!De(n)||t&&!De(t))throw new lu(M);return r.cache=new Ee.Cache,r}function Ie(n){var t=Jr(arguments,1),r=x(t,Ie.placeholder);return sr(n,T,t,r)}function ke(n){var t=Jr(arguments,1),r=x(t,ke.placeholder);return sr(n,N,t,r)}function Oe(){this.__wrapped__={}}function Re(n){return Wr(n&&typeof n=="object"?n.length:k)&&yu.call(n)==ht||false
-}function Fe(n){return n&&typeof n=="object"&&1===n.nodeType&&-1t||null==n||!Tu(t))return r;n=au(n);do t%2&&(r+=n),t=xu(t/2),n+=n;while(t);return r}function Pe(n,t,r){return(n=null==n?"":au(n))?r||null==t?n.slice(j(n),A(n)+1):(t=au(t),n.slice(h(n,t),g(n,t)+1)):n}function Ke(n,t,r){return(n=null!=n&&au(n))&&n.match((r?null:t)||ct)||[]}function Ve(n){try{return n()}catch(t){return Ce(t)?t:ru(t)}}function Ye(n,t,r){return Pt(n,r?k:t)
-}function Ze(n){return n}function Ge(n){var t=lo(n),r=t.length;if(1==r){var e=t[0],u=n[e];if(Ur(u))return function(n){return null!=n&&u===n[e]&&gu.call(n,e)}}for(var o=r,i=nu(r),f=nu(r);o--;){var u=n[t[o]],a=Ur(u);i[o]=a?u:Kt(u,true,zt),f[o]=a}return function(n){if(o=r,null==n)return!o;for(;o--;)if(f[o]?i[o]!==n[t[o]]:!gu.call(n,t[o]))return false;for(o=r;o--;)if(f[o]?!gu.call(n,t[o]):!fr(i[o],n[t[o]],null,true))return false;return true}}function Je(n,t,r){var e=true,u=Se(t),o=null==r,i=o&&u&&lo(t),f=i&&ir(t,i);(i&&i.length&&!f.length||o&&!u)&&(o&&(r=t),f=false,t=n,n=this),f||(f=ir(t,lo(t))),false===r?e=false:Se(r)&&"chain"in r&&(e=r.chain),r=-1,u=De(n);
-for(o=f.length;++r=$)return r}else n=0;return Ju(r,e)}}(),no=wr(function(n,t,r){gu.call(n,r)?++n[r]:n[r]=1}),to=wr(function(n,t,r){gu.call(n,r)?n[r].push(t):n[r]=[t]}),ro=wr(function(n,t,r){n[r]=t}),eo=wr(function(n,t,r){n[r?0:1].push(t)},function(){return[[],[]]}),uo=sr(me,T,[2],[]),oo=Su||function(n){return n&&typeof n=="object"&&typeof n.length=="number"&&yu.call(n)==gt||false
-};Gu.dom||(Fe=function(n){return n&&typeof n=="object"&&1===n.nodeType&&!fo(n)||false});var io=qu||function(n){return typeof n=="number"&&Tu(n)},fo=ju?function(n){if(!n||yu.call(n)!=_t)return false;var t=n.valueOf,r=Te(t)&&(r=ju(t))&&ju(r);return r?n==r||ju(n)==r:Lr(n)}:Lr,ao=xr(Bt),lo=Nu?function(n){if(n)var t=n.constructor,r=n.length;return typeof t=="function"&&t.prototype===n||typeof r=="number"&&0--n?t.apply(this,arguments):void 0}},Nt.assign=ao,Nt.at=function(n){return(!n||Wr(n.length))&&(n=Br(n)),f(n,nr(arguments,false,false,1))},Nt.before=me,Nt.bind=_e,Nt.bindAll=function(n){for(var t=n,r=1(p?s(p,i):u(c,i))){for(t=r;--t;){var h=e[t];
-if(0>(h?s(h,i):u(n[t],i)))continue n}p&&p.push(i),c.push(i)}return c},Nt.invert=function(n,t,r){t=r?null:t,r=-1;for(var e=lo(n),u=e.length,o={};++rt?0:t)},Nt.takeRight=function(n,t,r){var e=n?n.length:0;return t=e-((r||null==t?1:t)||0),Jr(n,0>t?0:t)},Nt.takeRightWhile=function(n,t,r){var e=n?n.length:0;for(t=Fr(t,r,3);e--&&t(n[e],e,n););return Jr(n,e+1)},Nt.takeWhile=function(n,t,r){var e=-1,u=n?n.length:0;for(t=Fr(t,r,3);++er?0:+r||0,e))-t.length,0<=r&&n.indexOf(t,r)==r},Nt.escape=function(n){return(n=null==n?"":au(n))&&(J.lastIndex=0,J.test(n))?n.replace(J,m):n},Nt.escapeRegExp=Be,Nt.every=ie,Nt.find=ae,Nt.findIndex=Vr,Nt.findKey=function(n,t,r){return t=Fr(t,r,3),Qt(n,t,ur,true)},Nt.findLast=function(n,t,r){return t=Fr(t,r,3),Qt(n,t,Jt)
-},Nt.findLastIndex=function(n,t,r){var e=n?n.length:0;for(t=Fr(t,r,3);e--;)if(t(n[e],e,n))return e;return-1},Nt.findLastKey=function(n,t,r){return t=Fr(t,r,3),Qt(n,t,or,true)},Nt.findWhere=function(n,t){return ae(n,Ge(t))},Nt.first=Yr,Nt.has=function(n,t){return n?gu.call(n,t):false},Nt.identity=Ze,Nt.indexOf=Zr,Nt.isArguments=Re,Nt.isArray=oo,Nt.isBoolean=function(n){return true===n||false===n||n&&typeof n=="object"&&yu.call(n)==vt||false},Nt.isDate=function(n){return n&&typeof n=="object"&&yu.call(n)==yt||false
-},Nt.isElement=Fe,Nt.isEmpty=function(n){if(null==n)return true;var t=n.length;return Wr(t)&&(oo(n)||Ue(n)||Re(n)||typeof n=="object"&&De(n.splice))?!t:!lo(n).length},Nt.isEqual=function(n,t,r,e){return r=typeof r=="function"&&Pt(r,e,3),!r&&Ur(n)&&Ur(t)?n===t:fr(n,t,r)},Nt.isError=Ce,Nt.isFinite=io,Nt.isFunction=De,Nt.isNaN=function(n){return Ne(n)&&n!=+n},Nt.isNative=Te,Nt.isNull=function(n){return null===n},Nt.isNumber=Ne,Nt.isObject=Se,Nt.isPlainObject=fo,Nt.isRegExp=We,Nt.isString=Ue,Nt.isUndefined=function(n){return typeof n=="undefined"
-},Nt.kebabCase=po,Nt.last=function(n){var t=n?n.length:0;return t?n[t-1]:k},Nt.lastIndexOf=function(n,t,r){var e=n?n.length:0;if(!e)return-1;var u=e;if(typeof r=="number")u=(0>r?Wu(e+r,0):Uu(r||0,e-1))+1;else if(r)return u=Hr(n,t)-1,n=n[u],(t===t?t===n:n!==n)?u:-1;if(t!==t)return b(n,u,true);for(;u--;)if(n[u]===t)return u;return-1},Nt.max=pe,Nt.min=function(n,t,r){r&&Nr(n,t,r)&&(t=null);var e=null==t,u=e&&oo(n),o=!u&&Ue(n);if(e&&!o)return Ut(u?n:Br(n));var i=Mu,f=i;return t=e&&o?p:Fr(t,r,3),Gt(n,function(n,r,e){r=t(n,r,e),(rr?0:+r||0,n.length),n.lastIndexOf(t,r)==r},Nt.template=function(n,t,r){var e=Nt.templateSettings;r&&Nr(n,t,r)&&(t=r=null),n=au(null==n?"":n),t=ao({},r||t,e,qt),r=ao({},t.imports,e.imports,qt);
-var u,o,i=lo(r),f=Le(r),a=0;r=t.interpolate||it;var l="__p+='";if(r=fu((t.escape||it).source+"|"+r.source+"|"+(r===Q?nt:it).source+"|"+(t.evaluate||it).source+"|$","g"),n.replace(r,function(t,r,e,i,f,c){return e||(e=i),l+=n.slice(a,c).replace(lt,_),r&&(u=true,l+="'+__e("+r+")+'"),f&&(o=true,l+="';"+f+";\n__p+='"),e&&(l+="'+((__t=("+e+"))==null?'':__t)+'"),a=c+t.length,t}),l+="';",(t=t.variable)||(l="with(obj){"+l+"}"),l=(o?l.replace(V,""):l).replace(Y,"$1").replace(Z,"$1;"),l="function("+(t||"obj")+"){"+(t?"":"obj||(obj={});")+"var __t,__p=''"+(u?",__e=_.escape":"")+(o?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+l+"return __p}",t=Ve(function(){return eu(i,"return "+l).apply(k,f)
-}),t.source=l,Ce(t))throw t;return t},Nt.trim=Pe,Nt.trimLeft=function(n,t,r){return(n=null==n?"":au(n))?r||null==t?n.slice(j(n)):(t=au(t),n.slice(h(n,t))):n},Nt.trimRight=function(n,t,r){return(n=null==n?"":au(n))?r||null==t?n.slice(0,A(n)+1):(t=au(t),n.slice(0,g(n,t)+1)):n},Nt.trunc=function(n,t,r){t=r?null:t;var e=W;if(r=U,Se(t)){var u="separator"in t?t.separator:u,e="length"in t?+t.length||0:e;r="omission"in t?au(t.omission):r}else null!=t&&(e=+t||0);if(n=null==n?"":au(n),e>=n.length)return n;
-if(e-=r.length,1>e)return r;if(t=n.slice(0,e),null==u)return t+r;if(We(u)){if(n.slice(e).search(u)){var o,i=n.slice(0,e);for(u.global||(u=fu(u.source,(tt.exec(u)||"")+"g")),u.lastIndex=0;n=u.exec(i);)o=n.index;t=t.slice(0,null==o?e:o)}}else n.indexOf(u,e)!=e&&(u=t.lastIndexOf(u),-1t?0:+t||0,n.length),n)},Nt.prototype.sample=function(n,t){return n=t?null:n,this.__chain__||null!=n?this.thru(function(t){return Nt.sample(t,n)}):Nt.sample(this.value())},Nt.VERSION=O,n("bind bindKey curry curryRight partial partialRight".split(" "),function(n){Nt[n].placeholder=Nt}),n(["filter","map","takeWhile"],function(n,t){ue.prototype[n]=function(n,r){n=Fr(n,r,3);
-var e=this.clone(),u=e.filtered,o=e.iteratees||(e.iteratees=[]);return e.filtered=u||t==L||t==B&&0>e.dir,o.push({iteratee:n,type:t}),e}}),n(["drop","take"],function(n,t){var r=n+"Count",e=n+"While";ue.prototype[n]=function(e){e=null==e?1:Wu(+e||0,0);var u=this.clone();if(u.filtered){var o=u[r];u[r]=t?Uu(o,e):o+e}else(u.views||(u.views=[])).push({size:e,type:n+(0>u.dir?"Right":"")});return u},ue.prototype[n+"Right"]=function(t){return this.reverse()[n](t).reverse()},ue.prototype[n+"RightWhile"]=function(n,t){return this.reverse()[e](n,t).reverse()
-}}),n(["first","last"],function(n,t){var r="take"+(t?"Right":"");ue.prototype[n]=function(){return this[r](1).value()[0]}}),n(["initial","rest"],function(n,t){var r="drop"+(t?"":"Right");ue.prototype[n]=function(){return this[r](1)}}),ue.prototype.dropWhile=function(n,t){n=Fr(n,t,3);var r,e,u=0>this.dir;return this.filter(function(t,o,i){return r=r&&(u?oe),e=o,r||(r=!n(t,o,i))})},ue.prototype.reject=function(n,t){return n=Fr(n,t,3),this.filter(function(t,r,e){return!n(t,r,e)})},ue.prototype.slice=function(n,t){n=null==n?0:+n||0;
-var r=0>n?this.takeRight(-n):this.drop(n);return typeof t!="undefined"&&(t=+t||0,r=0>t?r.dropRight(-t):r.take(t-n)),r},ur(ue.prototype,function(n,t){var r=/^(?:first|last)$/.test(t);Nt.prototype[t]=function(){var e=arguments,u=this.__chain__,o=this.__wrapped__,i=o instanceof ue;return r&&!u?i?n.call(o):Nt[t](this.value()):i||oo(o)?(o=n.apply(i?o:new ue(this),e),new ee(o,u)):this.thru(function(n){return n=[n],Au.apply(n,e),Nt[t].apply(Nt,n)})}}),n("concat join pop push shift sort splice unshift".split(" "),function(n){var t=cu[n],r=/^(?:push|sort|unshift)$/.test(n)?"tap":"thru",e=/^(?:join|pop|shift)$/.test(n);
-Nt.prototype[n]=function(){var n=arguments;return e&&!this.__chain__?t.apply(this.value(),n):this[r](function(r){return t.apply(r,n)})}}),ue.prototype.clone=function(){var n=this.iteratees,t=this.views,r=new ue(this.wrapped);return r.dir=this.dir,r.dropCount=this.dropCount,r.filtered=this.filtered,r.iteratees=n?c(n):null,r.takeCount=this.takeCount,r.views=t?c(t):null,r},ue.prototype.reverse=function(){var n=this.filtered,t=n?new ue(this):this.clone();return t.dir=-1*this.dir,t.filtered=n,t},ue.prototype.value=function(){var n,t=this.wrapped.value(),r=this.dir,e=0>r,u=t.length;
-n=u;for(var o=this.views,i=0,f=-1,a=o?o.length:0;++f"'`]/g,X=/<%-([\s\S]+?)%>/g,H=/<%([\s\S]+?)%>/g,Q=/<%=([\s\S]+?)%>/g,nt=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,tt=/\w*$/,rt=/^\s*function[ \n\r\t]+\w/,et=/^0[xX]/,ut=/^\[object .+?Constructor\]$/,ot=/[\xC0-\xD6\xD8-\xDE\xDF-\xF6\xF8-\xFF]/g,it=/($^)/,ft=/[.*+?^${}()|[\]\/\\]/g,at=/\bthis\b/,lt=/['\n\r\u2028\u2029\\]/g,ct=RegExp("[A-Z\\xC0-\\xD6\\xD8-\\xDE]{2,}(?=[A-Z\\xC0-\\xD6\\xD8-\\xDE][a-z\\xDF-\\xF6\\xF8-\\xFF]+)|[A-Z\\xC0-\\xD6\\xD8-\\xDE]?[a-z\\xDF-\\xF6\\xF8-\\xFF]+|[A-Z\\xC0-\\xD6\\xD8-\\xDE]+|[0-9]+","g"),st=" \t\x0B\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000",pt="Array ArrayBuffer Date Error Float32Array Float64Array Function Int8Array Int16Array Int32Array Math Number Object RegExp Set String _ clearTimeout document isFinite parseInt setTimeout TypeError Uint8Array Uint8ClampedArray Uint16Array Uint32Array WeakMap window WinRTError".split(" "),ht="[object Arguments]",gt="[object Array]",vt="[object Boolean]",yt="[object Date]",dt="[object Error]",mt="[object Number]",_t="[object Object]",bt="[object RegExp]",wt="[object String]",xt="[object ArrayBuffer]",jt="[object Float32Array]",At="[object Float64Array]",Et="[object Int8Array]",It="[object Int16Array]",kt="[object Int32Array]",Ot="[object Uint8Array]",Rt="[object Uint8ClampedArray]",Ft="[object Uint16Array]",Ct="[object Uint32Array]",Dt={};
-Dt[ht]=Dt[gt]=Dt[jt]=Dt[At]=Dt[Et]=Dt[It]=Dt[kt]=Dt[Ot]=Dt[Rt]=Dt[Ft]=Dt[Ct]=true,Dt[xt]=Dt[vt]=Dt[yt]=Dt[dt]=Dt["[object Function]"]=Dt["[object Map]"]=Dt[mt]=Dt[_t]=Dt[bt]=Dt["[object Set]"]=Dt[wt]=Dt["[object WeakMap]"]=false;var St={};St[ht]=St[gt]=St[xt]=St[vt]=St[yt]=St[jt]=St[At]=St[Et]=St[It]=St[kt]=St[mt]=St[_t]=St[bt]=St[wt]=St[Ot]=St[Rt]=St[Ft]=St[Ct]=true,St[dt]=St["[object Function]"]=St["[object Map]"]=St["[object Set]"]=St["[object WeakMap]"]=false;var Tt={leading:false,maxWait:0,trailing:false},Nt={"\xc0":"A","\xc1":"A","\xc2":"A","\xc3":"A","\xc4":"A","\xc5":"A","\xe0":"a","\xe1":"a","\xe2":"a","\xe3":"a","\xe4":"a","\xe5":"a","\xc7":"C","\xe7":"c","\xd0":"D","\xf0":"d","\xc8":"E","\xc9":"E","\xca":"E","\xcb":"E","\xe8":"e","\xe9":"e","\xea":"e","\xeb":"e","\xcc":"I","\xcd":"I","\xce":"I","\xcf":"I","\xec":"i","\xed":"i","\xee":"i","\xef":"i","\xd1":"N","\xf1":"n","\xd2":"O","\xd3":"O","\xd4":"O","\xd5":"O","\xd6":"O","\xd8":"O","\xf2":"o","\xf3":"o","\xf4":"o","\xf5":"o","\xf6":"o","\xf8":"o","\xd9":"U","\xda":"U","\xdb":"U","\xdc":"U","\xf9":"u","\xfa":"u","\xfb":"u","\xfc":"u","\xdd":"Y","\xfd":"y","\xff":"y","\xc6":"Ae","\xe6":"ae","\xde":"Th","\xfe":"th","\xdf":"ss"},Wt={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"},Ut={"&":"&","<":"<",">":">",""":'"',"'":"'","`":"`"},$t={"function":true,object:true},qt={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Lt=$t[typeof window]&&window!==(this&&this.window)?window:this,zt=$t[typeof exports]&&exports&&!exports.nodeType&&exports,$t=$t[typeof module]&&module&&!module.nodeType&&module,Bt=zt&&$t&&typeof global=="object"&&global;
-!Bt||Bt.global!==Bt&&Bt.window!==Bt&&Bt.self!==Bt||(Lt=Bt);var Bt=$t&&$t.exports===zt&&zt,Mt=I();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(Lt._=Mt, define(function(){return Mt})):zt&&$t?Bt?($t.exports=Mt)._=Mt:zt._=Mt:Lt._=Mt}).call(this);
\ No newline at end of file
+return r}function i(n,t){for(var r=-1,e=n.length;++rt||!r||typeof n=="undefined"&&e)return 1;if(n=n&&9<=n&&13>=n||32==n||160==n||5760==n||6158==n||8192<=n&&(8202>=n||8232==n||8233==n||8239==n||8287==n||12288==n||65279==n)
+}function w(n,t){for(var r=-1,e=n.length,u=-1,o=[];++re&&(e=u)}return e}function Pt(n){for(var t=-1,r=n.length,e=Yu;++tu(t,i)&&f.push(i);return f}function nr(n,t){var r=n?n.length:0;if(!Br(r))return lr(n,t);for(var e=-1,u=Gr(n);++ec))return false}else{var g=p&&mu.call(n,"__wrapped__"),h=h&&mu.call(t,"__wrapped__");if(g||h)return pr(g?n.value():n,h?t.value():t,r,e,u,o);if(!s)return false;if(!f&&!p){switch(l){case vt:case yt:return+n==+t;case _t:return n!=+n?t!=+t:0==n?1/n==1/t:n==+t;case wt:case xt:return n==pu(t)}return false}if(g=c?cu:n.constructor,l=i?cu:t.constructor,f){if(g.prototype.name!=l.prototype.name)return false}else if(p=!c&&mu.call(n,"constructor"),h=!i&&mu.call(t,"constructor"),p!=h||!p&&g!=l&&"constructor"in n&&"constructor"in t&&!(typeof g=="function"&&g instanceof g&&typeof l=="function"&&l instanceof l))return false;
+if(g=f?["message","name"]:ho(n),l=f?g:ho(t),c&&g.push("length"),i&&l.push("length"),c=g.length,p=l.length,c!=p&&!e)return false}for(u||(u=[]),o||(o=[]),l=u.length;l--;)if(u[l]==n)return o[l]==t;if(u.push(n),o.push(t),i=true,a)for(;i&&++le(f,s)&&((t||i)&&f.push(s),l.push(c))}return l}function wr(n,t){for(var r=-1,e=t(n),u=e.length,o=uu(u);++rt||null==r)return r;
+if(3t?0:t)}function Xr(n,t,r){var e=n?n.length:0;return t=e-((r||null==t?1:t)||0),re(n,0,0>t?0:t)}function Hr(n,t,r){var e=-1,u=n?n.length:0;for(t=Fr(t,r,3);++er?zu(e+r,0):r||0;else if(r)return r=ee(n,t),n=n[r],(t===t?t===n:n!==n)?r:-1;return a(n,t,r)}function te(n){return Jr(n,1)}function re(n,t,r){var e=-1,u=n?n.length:0,o=typeof r;if(r&&"number"!=o&&zr(n,t,r)&&(t=0,r=u),t=null==t?0:+t||0,0>t&&(t=-t>u?0:u+t),r="undefined"==o||r>u?u:+r||0,0>r&&(r+=u),r&&r==u&&!t)return l(n);for(u=t>r?0:r-t,r=uu(u);++er?zu(e+r,0):r||0:0,typeof n=="string"||!lo(n)&&ze(n)?ri||r===Vu&&r===f)&&(i=r,f=n)
+}),f}function de(n,t){return ve(n,eu(t))}function me(n,t,r,e){return(lo(n)?u:dr)(n,Fr(t,e,4),r,3>arguments.length,nr)}function _e(n,t,r,e){return(lo(n)?o:dr)(n,Fr(t,e,4),r,3>arguments.length,tr)}function be(n){n=Zr(n);for(var t=-1,r=n.length,e=uu(r);++t=r||r>t?(f&&Iu(f),r=p,f=s=p=E,r&&(h=_o(),a=n.apply(c,i),s||f||(i=c=null))):s=Su(e,r)
+}function u(){s&&Iu(s),f=s=p=E,(v||g!==t)&&(h=_o(),a=n.apply(c,i),s||f||(i=c=null))}function o(){if(i=arguments,l=_o(),c=this,p=v&&(s||!y),false===g)var r=y&&!s;else{f||y||(h=l);var o=g-(l-h),d=0>=o||o>g;d?(f&&(f=Iu(f)),h=l,a=n.apply(c,i)):f||(f=Su(u,o))}return d&&s?s=Iu(s):s||t===g||(s=Su(e,t)),r&&(d=true,a=n.apply(c,i)),!d||s||f||(i=c=null),a}var i,f,a,l,c,s,p,h=0,g=false,v=true;if(!Fe(n))throw new hu(M);if(t=0>t?0:t,true===r)var y=true,v=false;else Ue(r)&&(y=r.leading,g="maxWait"in r&&zu(+r.maxWait||0,t),v="trailing"in r?r.trailing:v);
+return o.cancel=function(){s&&Iu(s),f&&Iu(f),f=s=p=E},o}function Oe(){var n=arguments,r=n.length-1;if(0>r)return function(){};if(!t(n,Fe))throw new hu(M);return function(){for(var t=r,e=n[t].apply(this,arguments);t--;)e=n[t].call(this,e);return e}}function Re(n,t){function r(){var e=r.cache,u=t?t.apply(this,arguments):arguments[0];if(e.has(u))return e.get(u);var o=n.apply(this,arguments);return e.set(u,o),o}if(!Fe(n)||t&&!Fe(t))throw new hu(M);return r.cache=new Re.Cache,r}function Ce(n){var t=re(arguments,1),r=w(t,Ce.placeholder);
+return Wr(n,N,null,t,r)}function Se(n){var t=re(arguments,1),r=w(t,Se.placeholder);return Wr(n,W,null,t,r)}function Te(n){return Br(n&&typeof n=="object"?n.length:E)&&bu.call(n)==ht||false}function Ne(n){return n&&typeof n=="object"&&1===n.nodeType&&-1t||null==n||!qu(t))return r;n=pu(n);do t%2&&(r+=n),t=Eu(t/2),n+=n;while(t);return r}function Ye(n,t,r){return(n=null==n?"":pu(n))?r||null==t?n.slice(x(n),j(n)+1):(t=pu(t),n.slice(s(n,t),p(n,t)+1)):n}function Ze(n,t,r){return(n=null!=n&&pu(n))&&n.match((r?null:t)||ct)||[]
+}function Ge(n){try{return n()}catch(t){return We(t)?t:iu(t)}}function Je(n,t,r){return Jt(n,r?E:t)}function Xe(n){return function(){return n}}function He(n){return n}function Qe(n){var t=ho(n),r=t.length;if(1==r){var e=t[0],u=n[e];if(Dr(u))return function(n){return null!=n&&u===n[e]&&mu.call(n,e)}}for(var o=r,i=uu(r),f=uu(r);o--;){var u=n[t[o]],a=Dr(u);i[o]=a?u:Xt(u,true,jr),f[o]=a}return function(n){if(o=r,null==n)return!o;for(;o--;)if(f[o]?i[o]!==n[t[o]]:!mu.call(n,t[o]))return false;for(o=r;o--;)if(f[o]?!mu.call(n,t[o]):!pr(i[o],n[t[o]],null,true))return false;
+return true}}function nu(n,t,r){var e=true,u=Ue(t),o=null==r,i=o&&u&&ho(t),f=i&&sr(t,i);(i&&i.length&&!f.length||o&&!u)&&(o&&(r=t),f=false,t=n,n=this),f||(f=sr(t,ho(t))),false===r?e=false:Ue(r)&&"chain"in r&&(e=r.chain),r=-1,u=Fe(n);for(o=f.length;++r=q)return r}else n=0;return no(r,e)}}(),uo=Er(function(n,t,r){mu.call(n,r)?++n[r]:n[r]=1}),oo=Er(function(n,t,r){mu.call(n,r)?n[r].push(t):n[r]=[t]}),io=Er(function(n,t,r){n[r]=t}),fo=Er(function(n,t,r){n[r?0:1].push(t)},function(){return[[],[]]}),ao=Wr(xe,N,null,[2]),lo=$u||function(n){return n&&typeof n=="object"&&typeof n.length=="number"&&bu.call(n)==gt||false
+};Qu.dom||(Ne=function(n){return n&&typeof n=="object"&&1===n.nodeType&&!so(n)||false});var co=Mu||function(n){return typeof n=="number"&&qu(n)};!Fe(/x/)&&Nu&&Fe(Nu)||(Fe=function(n){return bu.call(n)==mt});var so=ku?function(n){if(!n||bu.call(n)!=bt)return false;var t=n.valueOf,r=$e(t)&&(r=ku(t))&&ku(r);return r?n==r||ku(n)==r:Vr(n)}:Vr,po=kr(Zt),ho=Lu?function(n){if(n)var t=n.constructor,r=n.length;return typeof t=="function"&&t.prototype===n||typeof r=="number"&&0--n?t.apply(this,arguments):void 0}},Ut.assign=po,Ut.at=function(n){return(!n||Br(n.length))&&(n=Zr(n)),Gt(n,or(arguments,false,false,1))},Ut.before=xe,Ut.bind=je,Ut.bindAll=function(n){for(var t=n,r=1(s?Dt(s,i):u(c,i))){for(t=r;--t;){var p=e[t];if(0>(p?Dt(p,i):u(n[t],i)))continue n}s&&s.push(i),c.push(i)
+}return c},Ut.invert=function(n,t,r){t=r?null:t,r=-1;for(var e=ho(n),u=e.length,o={};++rt?0:t)},Ut.takeRight=function(n,t,r){var e=n?n.length:0;return t=e-((r||null==t?1:t)||0),re(n,0>t?0:t)},Ut.takeRightWhile=function(n,t,r){var e=n?n.length:0;for(t=Fr(t,r,3);e--&&t(n[e],e,n););return re(n,e+1)},Ut.takeWhile=function(n,t,r){var e=-1,u=n?n.length:0;for(t=Fr(t,r,3);++er?0:+r||0,e))-t.length,0<=r&&n.indexOf(t,r)==r},Ut.escape=function(n){return(n=null==n?"":pu(n))&&(J.lastIndex=0,J.test(n))?n.replace(J,y):n},Ut.escapeRegExp=Ke,Ut.every=ce,Ut.find=pe,Ut.findIndex=Hr,Ut.findKey=function(n,t,r){return t=Fr(t,r,3),ur(n,t,lr,true)},Ut.findLast=function(n,t,r){return t=Fr(t,r,3),ur(n,t,tr)
+},Ut.findLastIndex=function(n,t,r){var e=n?n.length:0;for(t=Fr(t,r,3);e--;)if(t(n[e],e,n))return e;return-1},Ut.findLastKey=function(n,t,r){return t=Fr(t,r,3),ur(n,t,cr,true)},Ut.findWhere=function(n,t){return pe(n,Qe(t))},Ut.first=Qr,Ut.has=function(n,t){return n?mu.call(n,t):false},Ut.identity=He,Ut.indexOf=ne,Ut.isArguments=Te,Ut.isArray=lo,Ut.isBoolean=function(n){return true===n||false===n||n&&typeof n=="object"&&bu.call(n)==vt||false},Ut.isDate=function(n){return n&&typeof n=="object"&&bu.call(n)==yt||false
+},Ut.isElement=Ne,Ut.isEmpty=function(n){if(null==n)return true;var t=n.length;return Br(t)&&(lo(n)||ze(n)||Te(n)||typeof n=="object"&&Fe(n.splice))?!t:!ho(n).length},Ut.isEqual=function(n,t,r,e){return r=typeof r=="function"&&Jt(r,e,3),!r&&Dr(n)&&Dr(t)?n===t:pr(n,t,r)},Ut.isError=We,Ut.isFinite=co,Ut.isFunction=Fe,Ut.isNaN=function(n){return qe(n)&&n!=+n},Ut.isNative=$e,Ut.isNull=function(n){return null===n},Ut.isNumber=qe,Ut.isObject=Ue,Ut.isPlainObject=so,Ut.isRegExp=Le,Ut.isString=ze,Ut.isUndefined=function(n){return typeof n=="undefined"
+},Ut.kebabCase=yo,Ut.last=function(n){var t=n?n.length:0;return t?n[t-1]:E},Ut.lastIndexOf=function(n,t,r){var e=n?n.length:0;if(!e)return-1;var u=e;if(typeof r=="number")u=(0>r?zu(e+r,0):Bu(r||0,e-1))+1;else if(r)return u=ue(n,t)-1,n=n[u],(t===t?t===n:n!==n)?u:-1;if(t!==t)return m(n,u,true);for(;u--;)if(n[u]===t)return u;return-1},Ut.max=ye,Ut.min=function(n,t,r){r&&zr(n,t,r)&&(t=null);var e=null==t,u=e&&lo(n),o=!u&&ze(n);if(e&&!o)return Pt(u?n:Zr(n));var i=Yu,f=i;return t=e&&o?c:Fr(t,r,3),nr(n,function(n,r,e){r=t(n,r,e),(rr?0:+r||0,n.length),n.lastIndexOf(t,r)==r},Ut.template=function(n,t,r){var e=Ut.templateSettings;r&&zr(n,t,r)&&(t=r=null),n=pu(null==n?"":n),t=po({},r||t,e,Yt),r=po({},t.imports,e.imports,Yt);
+var u,o,i=ho(r),f=Me(r),a=0;r=t.interpolate||it;var l="__p+='";if(r=su((t.escape||it).source+"|"+r.source+"|"+(r===Q?nt:it).source+"|"+(t.evaluate||it).source+"|$","g"),n.replace(r,function(t,r,e,i,f,c){return e||(e=i),l+=n.slice(a,c).replace(lt,d),r&&(u=true,l+="'+__e("+r+")+'"),f&&(o=true,l+="';"+f+";\n__p+='"),e&&(l+="'+((__t=("+e+"))==null?'':__t)+'"),a=c+t.length,t}),l+="';",(t=t.variable)||(l="with(obj){"+l+"}"),l=(o?l.replace(V,""):l).replace(Y,"$1").replace(Z,"$1;"),l="function("+(t||"obj")+"){"+(t?"":"obj||(obj={});")+"var __t,__p=''"+(u?",__e=_.escape":"")+(o?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+l+"return __p}",t=Ge(function(){return fu(i,"return "+l).apply(E,f)
+}),t.source=l,We(t))throw t;return t},Ut.trim=Ye,Ut.trimLeft=function(n,t,r){return(n=null==n?"":pu(n))?r||null==t?n.slice(x(n)):(t=pu(t),n.slice(s(n,t))):n},Ut.trimRight=function(n,t,r){return(n=null==n?"":pu(n))?r||null==t?n.slice(0,j(n)+1):(t=pu(t),n.slice(0,p(n,t)+1)):n},Ut.trunc=function(n,t,r){t=r?null:t;var e=U;if(r=$,Ue(t)){var u="separator"in t?t.separator:u,e="length"in t?+t.length||0:e;r="omission"in t?pu(t.omission):r}else null!=t&&(e=+t||0);if(n=null==n?"":pu(n),e>=n.length)return n;
+if(e-=r.length,1>e)return r;if(t=n.slice(0,e),null==u)return t+r;if(Le(u)){if(n.slice(e).search(u)){var o,i=n.slice(0,e);for(u.global||(u=su(u.source,(tt.exec(u)||"")+"g")),u.lastIndex=0;n=u.exec(i);)o=n.index;t=t.slice(0,null==o?e:o)}}else n.indexOf(u,e)!=e&&(u=t.lastIndexOf(u),-1t?0:+t||0,n.length),n)},Ut.prototype.sample=function(n,t){return n=t?null:n,this.__chain__||null!=n?this.thru(function(t){return Ut.sample(t,n)}):Ut.sample(this.value())},Ut.VERSION=k,n("bind bindKey curry curryRight partial partialRight".split(" "),function(n){Ut[n].placeholder=Ut}),n(["filter","map","takeWhile"],function(n,t){qt.prototype[n]=function(n,r){n=Fr(n,r,3);
+var e=this.clone(),u=e.filtered,o=e.iteratees||(e.iteratees=[]);return e.filtered=u||t==z||t==D&&0>e.dir,o.push({iteratee:n,type:t}),e}}),n(["drop","take"],function(n,t){var r=n+"Count",e=n+"While";qt.prototype[n]=function(e){e=null==e?1:zu(+e||0,0);var u=this.clone();if(u.filtered){var o=u[r];u[r]=t?Bu(o,e):o+e}else(u.views||(u.views=[])).push({size:e,type:n+(0>u.dir?"Right":"")});return u},qt.prototype[n+"Right"]=function(t){return this.reverse()[n](t).reverse()},qt.prototype[n+"RightWhile"]=function(n,t){return this.reverse()[e](n,t).reverse()
+}}),n(["first","last"],function(n,t){var r="take"+(t?"Right":"");qt.prototype[n]=function(){return this[r](1).value()[0]}}),n(["initial","rest"],function(n,t){var r="drop"+(t?"":"Right");qt.prototype[n]=function(){return this[r](1)}}),qt.prototype.dropWhile=function(n,t){n=Fr(n,t,3);var r,e,u=0>this.dir;return this.filter(function(t,o,i){return r=r&&(u?oe),e=o,r||(r=!n(t,o,i))})},qt.prototype.reject=function(n,t){return n=Fr(n,t,3),this.filter(function(t,r,e){return!n(t,r,e)})},qt.prototype.slice=function(n,t){n=null==n?0:+n||0;
+var r=0>n?this.takeRight(-n):this.drop(n);return typeof t!="undefined"&&(t=+t||0,r=0>t?r.dropRight(-t):r.take(t-n)),r},lr(qt.prototype,function(n,t){var r=/^(?:first|last)$/.test(t);Ut.prototype[t]=function(){var e=arguments,u=this.__chain__,o=this.__wrapped__,i=o instanceof qt;return r&&!u?i?n.call(o):Ut[t](this.value()):i||lo(o)?(o=n.apply(i?o:new qt(this),e),new $t(o,u)):this.thru(function(n){return n=[n],Ou.apply(n,e),Ut[t].apply(Ut,n)})}}),n("concat join pop push shift sort splice unshift".split(" "),function(n){var t=gu[n],r=/^(?:push|sort|unshift)$/.test(n)?"tap":"thru",e=/^(?:join|pop|shift)$/.test(n);
+Ut.prototype[n]=function(){var n=arguments;return e&&!this.__chain__?t.apply(this.value(),n):this[r](function(r){return t.apply(r,n)})}}),qt.prototype.clone=function(){var n=this.iteratees,t=this.views,r=new qt(this.wrapped);return r.dir=this.dir,r.dropCount=this.dropCount,r.filtered=this.filtered,r.iteratees=n?l(n):null,r.takeCount=this.takeCount,r.views=t?l(t):null,r},qt.prototype.reverse=function(){var n=this.filtered,t=n?new qt(this):this.clone();return t.dir=-1*this.dir,t.filtered=n,t},qt.prototype.value=function(){var n,t=this.wrapped.value(),r=this.dir,e=0>r,u=t.length;
+n=u;for(var o=this.views,i=0,f=-1,a=o?o.length:0;++f"'`]/g,X=/<%-([\s\S]+?)%>/g,H=/<%([\s\S]+?)%>/g,Q=/<%=([\s\S]+?)%>/g,nt=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,tt=/\w*$/,rt=/^\s*function[ \n\r\t]+\w/,et=/^0[xX]/,ut=/^\[object .+?Constructor\]$/,ot=/[\xc0-\xd6\xd8-\xde\xdf-\xf6\xf8-\xff]/g,it=/($^)/,ft=/[.*+?^${}()|[\]\/\\]/g,at=/\bthis\b/,lt=/['\n\r\u2028\u2029\\]/g,ct=RegExp("[A-Z\\xc0-\\xd6\\xd8-\\xde]{2,}(?=[A-Z\\xc0-\\xd6\\xd8-\\xde][a-z\\xdf-\\xf6\\xf8-\\xff]+)|[A-Z\\xc0-\\xd6\\xd8-\\xde]?[a-z\\xdf-\\xf6\\xf8-\\xff]+|[A-Z\\xc0-\\xd6\\xd8-\\xde]+|[0-9]+","g"),st=" \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000",pt="Array ArrayBuffer Date Error Float32Array Float64Array Function Int8Array Int16Array Int32Array Math Number Object RegExp Set String _ clearTimeout document isFinite parseInt setTimeout TypeError Uint8Array Uint8ClampedArray Uint16Array Uint32Array WeakMap window WinRTError".split(" "),ht="[object Arguments]",gt="[object Array]",vt="[object Boolean]",yt="[object Date]",dt="[object Error]",mt="[object Function]",_t="[object Number]",bt="[object Object]",wt="[object RegExp]",xt="[object String]",jt="[object ArrayBuffer]",At="[object Float32Array]",It="[object Float64Array]",Et="[object Int8Array]",kt="[object Int16Array]",Ot="[object Int32Array]",Rt="[object Uint8Array]",Ct="[object Uint8ClampedArray]",St="[object Uint16Array]",Tt="[object Uint32Array]",Nt={};
+Nt[ht]=Nt[gt]=Nt[At]=Nt[It]=Nt[Et]=Nt[kt]=Nt[Ot]=Nt[Rt]=Nt[Ct]=Nt[St]=Nt[Tt]=true,Nt[jt]=Nt[vt]=Nt[yt]=Nt[dt]=Nt[mt]=Nt["[object Map]"]=Nt[_t]=Nt[bt]=Nt[wt]=Nt["[object Set]"]=Nt[xt]=Nt["[object WeakMap]"]=false;var Wt={};Wt[ht]=Wt[gt]=Wt[jt]=Wt[vt]=Wt[yt]=Wt[At]=Wt[It]=Wt[Et]=Wt[kt]=Wt[Ot]=Wt[_t]=Wt[bt]=Wt[wt]=Wt[xt]=Wt[Rt]=Wt[Ct]=Wt[St]=Wt[Tt]=true,Wt[dt]=Wt[mt]=Wt["[object Map]"]=Wt["[object Set]"]=Wt["[object WeakMap]"]=false;var Ft={leading:false,maxWait:0,trailing:false},Ut={"\xc0":"A","\xc1":"A","\xc2":"A","\xc3":"A","\xc4":"A","\xc5":"A","\xe0":"a","\xe1":"a","\xe2":"a","\xe3":"a","\xe4":"a","\xe5":"a","\xc7":"C","\xe7":"c","\xd0":"D","\xf0":"d","\xc8":"E","\xc9":"E","\xca":"E","\xcb":"E","\xe8":"e","\xe9":"e","\xea":"e","\xeb":"e","\xcc":"I","\xcd":"I","\xce":"I","\xcf":"I","\xec":"i","\xed":"i","\xee":"i","\xef":"i","\xd1":"N","\xf1":"n","\xd2":"O","\xd3":"O","\xd4":"O","\xd5":"O","\xd6":"O","\xd8":"O","\xf2":"o","\xf3":"o","\xf4":"o","\xf5":"o","\xf6":"o","\xf8":"o","\xd9":"U","\xda":"U","\xdb":"U","\xdc":"U","\xf9":"u","\xfa":"u","\xfb":"u","\xfc":"u","\xdd":"Y","\xfd":"y","\xff":"y","\xc6":"Ae","\xe6":"ae","\xde":"Th","\xfe":"th","\xdf":"ss"},$t={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"},qt={"&":"&","<":"<",">":">",""":'"',"'":"'","`":"`"},Lt={"function":true,object:true},zt={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Bt=Lt[typeof window]&&window!==(this&&this.window)?window:this,Dt=Lt[typeof exports]&&exports&&!exports.nodeType&&exports,Mt=Lt[typeof module]&&module&&!module.nodeType&&module,Pt=Dt&&Mt&&typeof global=="object"&&global;
+!Pt||Pt.global!==Pt&&Pt.window!==Pt&&Pt.self!==Pt||(Bt=Pt);var Kt=Mt&&Mt.exports===Dt&&Dt,Vt=I();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(Bt._=Vt, define(function(){return Vt})):Dt&&Mt?Kt?(Mt.exports=Vt)._=Vt:Dt._=Vt:Bt._=Vt}).call(this);
\ No newline at end of file