Comparing version 3.9.3 to 3.10.0
import baseSlice from '../internal/baseSlice'; | ||
import isIterateeCall from '../internal/isIterateeCall'; | ||
/** Native method references. */ | ||
var ceil = Math.ceil; | ||
/* Native method references for those with the same name as other `lodash` methods. */ | ||
var nativeMax = Math.max; | ||
var nativeCeil = Math.ceil, | ||
nativeFloor = Math.floor, | ||
nativeMax = Math.max; | ||
@@ -34,3 +33,3 @@ /** | ||
} else { | ||
size = nativeMax(+size || 1, 1); | ||
size = nativeMax(nativeFloor(size) || 1, 1); | ||
} | ||
@@ -40,3 +39,3 @@ var index = 0, | ||
resIndex = -1, | ||
result = Array(ceil(length / size)); | ||
result = Array(nativeCeil(length / size)); | ||
@@ -43,0 +42,0 @@ while (index < length) { |
import baseDifference from '../internal/baseDifference'; | ||
import baseFlatten from '../internal/baseFlatten'; | ||
import isArrayLike from '../internal/isArrayLike'; | ||
import isObjectLike from '../internal/isObjectLike'; | ||
import restParam from '../function/restParam'; | ||
@@ -8,3 +9,3 @@ | ||
* Creates an array of unique `array` values not included in the other | ||
* provided arrays using [`SameValueZero`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) | ||
* provided arrays using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) | ||
* for equality comparisons. | ||
@@ -24,3 +25,3 @@ * | ||
var difference = restParam(function(array, values) { | ||
return isArrayLike(array) | ||
return (isObjectLike(array) && isArrayLike(array)) | ||
? baseDifference(array, baseFlatten(values, false, true)) | ||
@@ -27,0 +28,0 @@ : []; |
@@ -9,3 +9,3 @@ import baseIndexOf from '../internal/baseIndexOf'; | ||
* Gets the index at which the first occurrence of `value` is found in `array` | ||
* using [`SameValueZero`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) | ||
* using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) | ||
* for equality comparisons. If `fromIndex` is negative, it is used as the offset | ||
@@ -44,6 +44,5 @@ * from the end of `array`. If `array` is sorted providing `true` for `fromIndex` | ||
} else if (fromIndex) { | ||
var index = binaryIndex(array, value), | ||
other = array[index]; | ||
if (value === value ? (value === other) : (other !== other)) { | ||
var index = binaryIndex(array, value); | ||
if (index < length && | ||
(value === value ? (value === array[index]) : (array[index] !== array[index]))) { | ||
return index; | ||
@@ -50,0 +49,0 @@ } |
@@ -9,3 +9,3 @@ import baseIndexOf from '../internal/baseIndexOf'; | ||
* Creates an array of unique values that are included in all of the provided | ||
* arrays using [`SameValueZero`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) | ||
* arrays using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) | ||
* for equality comparisons. | ||
@@ -12,0 +12,0 @@ * |
@@ -11,3 +11,3 @@ import baseIndexOf from '../internal/baseIndexOf'; | ||
* Removes all provided values from `array` using | ||
* [`SameValueZero`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) | ||
* [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) | ||
* for equality comparisons. | ||
@@ -14,0 +14,0 @@ * |
@@ -7,3 +7,3 @@ import baseFlatten from '../internal/baseFlatten'; | ||
* Creates an array of unique values, in order, from all of the provided arrays | ||
* using [`SameValueZero`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) | ||
* using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) | ||
* for equality comparisons. | ||
@@ -10,0 +10,0 @@ * |
@@ -8,3 +8,3 @@ import baseCallback from '../internal/baseCallback'; | ||
* Creates a duplicate-free version of an array, using | ||
* [`SameValueZero`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) | ||
* [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) | ||
* for equality comparisons, in which only the first occurence of each element | ||
@@ -63,3 +63,3 @@ * is kept. Providing `true` for `isSorted` performs a faster search algorithm | ||
thisArg = iteratee; | ||
iteratee = isIterateeCall(array, isSorted, thisArg) ? null : isSorted; | ||
iteratee = isIterateeCall(array, isSorted, thisArg) ? undefined : isSorted; | ||
isSorted = false; | ||
@@ -66,0 +66,0 @@ } |
@@ -7,3 +7,3 @@ import baseDifference from '../internal/baseDifference'; | ||
* Creates an array excluding all provided values using | ||
* [`SameValueZero`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) | ||
* [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) | ||
* for equality comparisons. | ||
@@ -10,0 +10,0 @@ * |
@@ -0,1 +1,2 @@ | ||
import arrayPush from '../internal/arrayPush'; | ||
import baseDifference from '../internal/baseDifference'; | ||
@@ -27,3 +28,3 @@ import baseUniq from '../internal/baseUniq'; | ||
var result = result | ||
? baseDifference(result, array).concat(baseDifference(array, result)) | ||
? arrayPush(baseDifference(result, array), baseDifference(array, result)) | ||
: array; | ||
@@ -30,0 +31,0 @@ } |
import chain from './chain/chain'; | ||
import commit from './chain/commit'; | ||
import concat from './chain/concat'; | ||
import lodash from './chain/lodash'; | ||
@@ -18,2 +19,3 @@ import plant from './chain/plant'; | ||
'commit': commit, | ||
'concat': concat, | ||
'lodash': lodash, | ||
@@ -20,0 +22,0 @@ 'plant': plant, |
@@ -17,11 +17,12 @@ import LazyWrapper from '../internal/LazyWrapper'; | ||
* Methods that operate on and return arrays, collections, and functions can | ||
* be chained together. Methods that return a boolean or single value will | ||
* automatically end the chain returning the unwrapped value. Explicit chaining | ||
* may be enabled using `_.chain`. The execution of chained methods is lazy, | ||
* that is, execution is deferred until `_#value` is implicitly or explicitly | ||
* called. | ||
* be chained together. Methods that retrieve a single value or may return a | ||
* primitive value will automatically end the chain returning the unwrapped | ||
* value. Explicit chaining may be enabled using `_.chain`. The execution of | ||
* chained methods is lazy, that is, execution is deferred until `_#value` | ||
* is implicitly or explicitly called. | ||
* | ||
* Lazy evaluation allows several methods to support shortcut fusion. Shortcut | ||
* fusion is an optimization that merges iteratees to avoid creating intermediate | ||
* arrays and reduce the number of iteratee executions. | ||
* fusion is an optimization strategy which merge iteratee calls; this can help | ||
* to avoid the creation of intermediate data structures and greatly reduce the | ||
* number of iteratee executions. | ||
* | ||
@@ -49,32 +50,33 @@ * Chaining is supported in custom builds as long as the `_#value` method is | ||
* `callback`, `chain`, `chunk`, `commit`, `compact`, `concat`, `constant`, | ||
* `countBy`, `create`, `curry`, `debounce`, `defaults`, `defer`, `delay`, | ||
* `difference`, `drop`, `dropRight`, `dropRightWhile`, `dropWhile`, `fill`, | ||
* `filter`, `flatten`, `flattenDeep`, `flow`, `flowRight`, `forEach`, | ||
* `forEachRight`, `forIn`, `forInRight`, `forOwn`, `forOwnRight`, `functions`, | ||
* `groupBy`, `indexBy`, `initial`, `intersection`, `invert`, `invoke`, `keys`, | ||
* `keysIn`, `map`, `mapKeys`, `mapValues`, `matches`, `matchesProperty`, | ||
* `memoize`, `merge`, `method`, `methodOf`, `mixin`, `negate`, `omit`, `once`, | ||
* `pairs`, `partial`, `partialRight`, `partition`, `pick`, `plant`, `pluck`, | ||
* `property`, `propertyOf`, `pull`, `pullAt`, `push`, `range`, `rearg`, | ||
* `reject`, `remove`, `rest`, `restParam`, `reverse`, `set`, `shuffle`, | ||
* `slice`, `sort`, `sortBy`, `sortByAll`, `sortByOrder`, `splice`, `spread`, | ||
* `take`, `takeRight`, `takeRightWhile`, `takeWhile`, `tap`, `throttle`, | ||
* `thru`, `times`, `toArray`, `toPlainObject`, `transform`, `union`, `uniq`, | ||
* `unshift`, `unzip`, `unzipWith`, `values`, `valuesIn`, `where`, `without`, | ||
* `wrap`, `xor`, `zip`, `zipObject`, `zipWith` | ||
* `countBy`, `create`, `curry`, `debounce`, `defaults`, `defaultsDeep`, | ||
* `defer`, `delay`, `difference`, `drop`, `dropRight`, `dropRightWhile`, | ||
* `dropWhile`, `fill`, `filter`, `flatten`, `flattenDeep`, `flow`, `flowRight`, | ||
* `forEach`, `forEachRight`, `forIn`, `forInRight`, `forOwn`, `forOwnRight`, | ||
* `functions`, `groupBy`, `indexBy`, `initial`, `intersection`, `invert`, | ||
* `invoke`, `keys`, `keysIn`, `map`, `mapKeys`, `mapValues`, `matches`, | ||
* `matchesProperty`, `memoize`, `merge`, `method`, `methodOf`, `mixin`, | ||
* `modArgs`, `negate`, `omit`, `once`, `pairs`, `partial`, `partialRight`, | ||
* `partition`, `pick`, `plant`, `pluck`, `property`, `propertyOf`, `pull`, | ||
* `pullAt`, `push`, `range`, `rearg`, `reject`, `remove`, `rest`, `restParam`, | ||
* `reverse`, `set`, `shuffle`, `slice`, `sort`, `sortBy`, `sortByAll`, | ||
* `sortByOrder`, `splice`, `spread`, `take`, `takeRight`, `takeRightWhile`, | ||
* `takeWhile`, `tap`, `throttle`, `thru`, `times`, `toArray`, `toPlainObject`, | ||
* `transform`, `union`, `uniq`, `unshift`, `unzip`, `unzipWith`, `values`, | ||
* `valuesIn`, `where`, `without`, `wrap`, `xor`, `zip`, `zipObject`, `zipWith` | ||
* | ||
* The wrapper methods that are **not** chainable by default are: | ||
* `add`, `attempt`, `camelCase`, `capitalize`, `clone`, `cloneDeep`, `deburr`, | ||
* `endsWith`, `escape`, `escapeRegExp`, `every`, `find`, `findIndex`, `findKey`, | ||
* `findLast`, `findLastIndex`, `findLastKey`, `findWhere`, `first`, `get`, | ||
* `gt`, `gte`, `has`, `identity`, `includes`, `indexOf`, `inRange`, `isArguments`, | ||
* `isArray`, `isBoolean`, `isDate`, `isElement`, `isEmpty`, `isEqual`, `isError`, | ||
* `isFinite` `isFunction`, `isMatch`, `isNative`, `isNaN`, `isNull`, `isNumber`, | ||
* `isObject`, `isPlainObject`, `isRegExp`, `isString`, `isUndefined`, | ||
* `isTypedArray`, `join`, `kebabCase`, `last`, `lastIndexOf`, `lt`, `lte`, | ||
* `max`, `min`, `noConflict`, `noop`, `now`, `pad`, `padLeft`, `padRight`, | ||
* `parseInt`, `pop`, `random`, `reduce`, `reduceRight`, `repeat`, `result`, | ||
* `runInContext`, `shift`, `size`, `snakeCase`, `some`, `sortedIndex`, | ||
* `sortedLastIndex`, `startCase`, `startsWith`, `sum`, `template`, `trim`, | ||
* `trimLeft`, `trimRight`, `trunc`, `unescape`, `uniqueId`, `value`, and `words` | ||
* `add`, `attempt`, `camelCase`, `capitalize`, `ceil`, `clone`, `cloneDeep`, | ||
* `deburr`, `endsWith`, `escape`, `escapeRegExp`, `every`, `find`, `findIndex`, | ||
* `findKey`, `findLast`, `findLastIndex`, `findLastKey`, `findWhere`, `first`, | ||
* `floor`, `get`, `gt`, `gte`, `has`, `identity`, `includes`, `indexOf`, | ||
* `inRange`, `isArguments`, `isArray`, `isBoolean`, `isDate`, `isElement`, | ||
* `isEmpty`, `isEqual`, `isError`, `isFinite` `isFunction`, `isMatch`, | ||
* `isNative`, `isNaN`, `isNull`, `isNumber`, `isObject`, `isPlainObject`, | ||
* `isRegExp`, `isString`, `isUndefined`, `isTypedArray`, `join`, `kebabCase`, | ||
* `last`, `lastIndexOf`, `lt`, `lte`, `max`, `min`, `noConflict`, `noop`, | ||
* `now`, `pad`, `padLeft`, `padRight`, `parseInt`, `pop`, `random`, `reduce`, | ||
* `reduceRight`, `repeat`, `result`, `round`, `runInContext`, `shift`, `size`, | ||
* `snakeCase`, `some`, `sortedIndex`, `sortedLastIndex`, `startCase`, | ||
* `startsWith`, `sum`, `template`, `trim`, `trimLeft`, `trimRight`, `trunc`, | ||
* `unescape`, `uniqueId`, `value`, and `words` | ||
* | ||
@@ -81,0 +83,0 @@ * The wrapper method `sample` will return a wrapped value when `n` is provided, |
@@ -13,3 +13,3 @@ import LodashWrapper from '../internal/LodashWrapper'; | ||
* var array = [1, 2]; | ||
* var wrapper = _(array).push(3); | ||
* var wrapped = _(array).push(3); | ||
* | ||
@@ -19,7 +19,7 @@ * console.log(array); | ||
* | ||
* wrapper = wrapper.commit(); | ||
* wrapped = wrapped.commit(); | ||
* console.log(array); | ||
* // => [1, 2, 3] | ||
* | ||
* wrapper.last(); | ||
* wrapped.last(); | ||
* // => 3 | ||
@@ -26,0 +26,0 @@ * |
@@ -14,3 +14,3 @@ import baseLodash from '../internal/baseLodash'; | ||
* var array = [1, 2]; | ||
* var wrapper = _(array).map(function(value) { | ||
* var wrapped = _(array).map(function(value) { | ||
* return Math.pow(value, 2); | ||
@@ -20,8 +20,8 @@ * }); | ||
* var other = [3, 4]; | ||
* var otherWrapper = wrapper.plant(other); | ||
* var otherWrapped = wrapped.plant(other); | ||
* | ||
* otherWrapper.value(); | ||
* otherWrapped.value(); | ||
* // => [9, 16] | ||
* | ||
* wrapper.value(); | ||
* wrapped.value(); | ||
* // => [1, 4] | ||
@@ -28,0 +28,0 @@ */ |
@@ -27,13 +27,18 @@ import LazyWrapper from '../internal/LazyWrapper'; | ||
var value = this.__wrapped__; | ||
var interceptor = function(value) { | ||
return (wrapped && wrapped.__dir__ < 0) ? value : value.reverse(); | ||
}; | ||
if (value instanceof LazyWrapper) { | ||
var wrapped = value; | ||
if (this.__actions__.length) { | ||
value = new LazyWrapper(this); | ||
wrapped = new LazyWrapper(this); | ||
} | ||
return new LodashWrapper(value.reverse(), this.__chain__); | ||
wrapped = wrapped.reverse(); | ||
wrapped.__actions__.push({ 'func': thru, 'args': [interceptor], 'thisArg': undefined }); | ||
return new LodashWrapper(wrapped, this.__chain__); | ||
} | ||
return this.thru(function(value) { | ||
return value.reverse(); | ||
}); | ||
return this.thru(interceptor); | ||
} | ||
export default wrapperReverse; |
@@ -58,3 +58,3 @@ import arrayEvery from '../internal/arrayEvery'; | ||
if (thisArg && isIterateeCall(collection, predicate, thisArg)) { | ||
predicate = null; | ||
predicate = undefined; | ||
} | ||
@@ -61,0 +61,0 @@ if (typeof predicate != 'function' || thisArg !== undefined) { |
@@ -14,3 +14,3 @@ import baseIndexOf from '../internal/baseIndexOf'; | ||
* Checks if `value` is in `collection` using | ||
* [`SameValueZero`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) | ||
* [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) | ||
* for equality comparisons. If `fromIndex` is negative, it is used as the offset | ||
@@ -48,5 +48,2 @@ * from the end of `collection`. | ||
} | ||
if (!length) { | ||
return false; | ||
} | ||
if (typeof fromIndex != 'number' || (guard && isIterateeCall(target, fromIndex, guard))) { | ||
@@ -58,6 +55,6 @@ fromIndex = 0; | ||
return (typeof collection == 'string' || !isArray(collection) && isString(collection)) | ||
? (fromIndex < length && collection.indexOf(target, fromIndex) > -1) | ||
: (baseIndexOf(collection, target, fromIndex) > -1); | ||
? (fromIndex <= length && collection.indexOf(target, fromIndex) > -1) | ||
: (!!length && baseIndexOf(collection, target, fromIndex) > -1); | ||
} | ||
export default includes; |
@@ -36,3 +36,3 @@ import baseEach from '../internal/baseEach'; | ||
baseEach(collection, function(value) { | ||
var func = isFunc ? path : ((isProp && value != null) ? value[path] : null); | ||
var func = isFunc ? path : ((isProp && value != null) ? value[path] : undefined); | ||
result[++index] = func ? func.apply(value, args) : invokePath(value, path, args); | ||
@@ -39,0 +39,0 @@ }); |
@@ -17,3 +17,4 @@ import arrayReduce from '../internal/arrayReduce'; | ||
* The guarded methods are: | ||
* `assign`, `defaults`, `includes`, `merge`, `sortByAll`, and `sortByOrder` | ||
* `assign`, `defaults`, `defaultsDeep`, `includes`, `merge`, `sortByAll`, | ||
* and `sortByOrder` | ||
* | ||
@@ -20,0 +21,0 @@ * @static |
@@ -59,3 +59,3 @@ import arraySome from '../internal/arraySome'; | ||
if (thisArg && isIterateeCall(collection, predicate, thisArg)) { | ||
predicate = null; | ||
predicate = undefined; | ||
} | ||
@@ -62,0 +62,0 @@ if (typeof predicate != 'function' || thisArg !== undefined) { |
@@ -60,3 +60,3 @@ import baseCallback from '../internal/baseCallback'; | ||
if (thisArg && isIterateeCall(collection, iteratee, thisArg)) { | ||
iteratee = null; | ||
iteratee = undefined; | ||
} | ||
@@ -63,0 +63,0 @@ var index = -1; |
@@ -7,5 +7,5 @@ import baseSortByOrder from '../internal/baseSortByOrder'; | ||
* This method is like `_.sortByAll` except that it allows specifying the | ||
* sort orders of the iteratees to sort by. A truthy value in `orders` will | ||
* sort the corresponding property name in ascending order while a falsey | ||
* value will sort it in descending order. | ||
* sort orders of the iteratees to sort by. If `orders` is unspecified, all | ||
* values are sorted in ascending order. Otherwise, a value is sorted in | ||
* ascending order if its corresponding order is "asc", and descending if "desc". | ||
* | ||
@@ -24,3 +24,3 @@ * If a property name is provided for an iteratee the created `_.property` | ||
* @param {Function[]|Object[]|string[]} iteratees The iteratees to sort by. | ||
* @param {boolean[]} orders The sort orders of `iteratees`. | ||
* @param {boolean[]} [orders] The sort orders of `iteratees`. | ||
* @param- {Object} [guard] Enables use as a callback for functions like `_.reduce`. | ||
@@ -38,3 +38,3 @@ * @returns {Array} Returns the new sorted array. | ||
* // sort by `user` in ascending order and by `age` in descending order | ||
* _.map(_.sortByOrder(users, ['user', 'age'], [true, false]), _.values); | ||
* _.map(_.sortByOrder(users, ['user', 'age'], ['asc', 'desc']), _.values); | ||
* // => [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 42]] | ||
@@ -47,3 +47,3 @@ */ | ||
if (guard && isIterateeCall(iteratees, orders, guard)) { | ||
orders = null; | ||
orders = undefined; | ||
} | ||
@@ -50,0 +50,0 @@ if (!isArray(iteratees)) { |
@@ -17,2 +17,3 @@ import after from './function/after'; | ||
import memoize from './function/memoize'; | ||
import modArgs from './function/modArgs'; | ||
import negate from './function/negate'; | ||
@@ -45,2 +46,3 @@ import once from './function/once'; | ||
'memoize': memoize, | ||
'modArgs': modArgs, | ||
'negate': negate, | ||
@@ -47,0 +49,0 @@ 'once': once, |
@@ -28,8 +28,8 @@ import createWrapper from '../internal/createWrapper'; | ||
if (guard && isIterateeCall(func, n, guard)) { | ||
n = null; | ||
n = undefined; | ||
} | ||
n = (func && n == null) ? func.length : nativeMax(+n || 0, 0); | ||
return createWrapper(func, ARY_FLAG, null, null, null, null, n); | ||
return createWrapper(func, ARY_FLAG, undefined, undefined, undefined, undefined, n); | ||
} | ||
export default ary; |
@@ -36,3 +36,3 @@ /** Used as the `TypeError` message for "Functions" methods. */ | ||
if (n <= 1) { | ||
func = null; | ||
func = undefined; | ||
} | ||
@@ -39,0 +39,0 @@ return result; |
@@ -93,5 +93,5 @@ import isObject from '../lang/isObject'; | ||
} else if (isObject(options)) { | ||
leading = options.leading; | ||
leading = !!options.leading; | ||
maxWait = 'maxWait' in options && nativeMax(+options.maxWait || 0, wait); | ||
trailing = 'trailing' in options ? options.trailing : trailing; | ||
trailing = 'trailing' in options ? !!options.trailing : trailing; | ||
} | ||
@@ -106,20 +106,24 @@ | ||
} | ||
lastCalled = 0; | ||
maxTimeoutId = timeoutId = trailingCall = undefined; | ||
} | ||
function complete(isCalled, id) { | ||
if (id) { | ||
clearTimeout(id); | ||
} | ||
maxTimeoutId = timeoutId = trailingCall = undefined; | ||
if (isCalled) { | ||
lastCalled = now(); | ||
result = func.apply(thisArg, args); | ||
if (!timeoutId && !maxTimeoutId) { | ||
args = thisArg = undefined; | ||
} | ||
} | ||
} | ||
function delayed() { | ||
var remaining = wait - (now() - stamp); | ||
if (remaining <= 0 || remaining > wait) { | ||
if (maxTimeoutId) { | ||
clearTimeout(maxTimeoutId); | ||
} | ||
var isCalled = trailingCall; | ||
maxTimeoutId = timeoutId = trailingCall = undefined; | ||
if (isCalled) { | ||
lastCalled = now(); | ||
result = func.apply(thisArg, args); | ||
if (!timeoutId && !maxTimeoutId) { | ||
args = thisArg = null; | ||
} | ||
} | ||
complete(trailingCall, maxTimeoutId); | ||
} else { | ||
@@ -131,13 +135,3 @@ timeoutId = setTimeout(delayed, remaining); | ||
function maxDelayed() { | ||
if (timeoutId) { | ||
clearTimeout(timeoutId); | ||
} | ||
maxTimeoutId = timeoutId = trailingCall = undefined; | ||
if (trailing || (maxWait !== wait)) { | ||
lastCalled = now(); | ||
result = func.apply(thisArg, args); | ||
if (!timeoutId && !maxTimeoutId) { | ||
args = thisArg = null; | ||
} | ||
} | ||
complete(trailing, timeoutId); | ||
} | ||
@@ -182,3 +176,3 @@ | ||
if (isCalled && !timeoutId && !maxTimeoutId) { | ||
args = thisArg = null; | ||
args = thisArg = undefined; | ||
} | ||
@@ -185,0 +179,0 @@ return result; |
@@ -16,3 +16,3 @@ import MapCache from '../internal/MapCache'; | ||
* function. Its creation may be customized by replacing the `_.memoize.Cache` | ||
* constructor with one whose instances implement the [`Map`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-map-prototype-object) | ||
* constructor with one whose instances implement the [`Map`](http://ecma-international.org/ecma-262/6.0/#sec-properties-of-the-map-prototype-object) | ||
* method interface of `get`, `has`, and `set`. | ||
@@ -19,0 +19,0 @@ * |
@@ -37,5 +37,5 @@ import baseFlatten from '../internal/baseFlatten'; | ||
var rearg = restParam(function(func, indexes) { | ||
return createWrapper(func, REARG_FLAG, null, null, null, baseFlatten(indexes)); | ||
return createWrapper(func, REARG_FLAG, undefined, undefined, undefined, baseFlatten(indexes)); | ||
}); | ||
export default rearg; |
@@ -7,9 +7,2 @@ import debounce from './debounce'; | ||
/** Used as an internal `_.debounce` options object by `_.throttle`. */ | ||
var debounceOptions = { | ||
'leading': false, | ||
'maxWait': 0, | ||
'trailing': false | ||
}; | ||
/** | ||
@@ -67,8 +60,5 @@ * Creates a throttled function that only invokes `func` at most once per | ||
} | ||
debounceOptions.leading = leading; | ||
debounceOptions.maxWait = +wait; | ||
debounceOptions.trailing = trailing; | ||
return debounce(func, wait, debounceOptions); | ||
return debounce(func, wait, { 'leading': leading, 'maxWait': +wait, 'trailing': trailing }); | ||
} | ||
export default throttle; |
@@ -30,5 +30,5 @@ import createWrapper from '../internal/createWrapper'; | ||
wrapper = wrapper == null ? identity : wrapper; | ||
return createWrapper(wrapper, PARTIAL_FLAG, null, [value], []); | ||
return createWrapper(wrapper, PARTIAL_FLAG, undefined, [value], []); | ||
} | ||
export default wrap; |
/** | ||
* A specialized version of `_.sum` for arrays without support for iteratees. | ||
* A specialized version of `_.sum` for arrays without support for callback | ||
* shorthands and `this` binding.. | ||
* | ||
* @private | ||
* @param {Array} array The array to iterate over. | ||
* @param {Function} iteratee The function invoked per iteration. | ||
* @returns {number} Returns the sum. | ||
*/ | ||
function arraySum(array) { | ||
function arraySum(array, iteratee) { | ||
var length = array.length, | ||
@@ -13,3 +15,3 @@ result = 0; | ||
while (length--) { | ||
result += +array[length] || 0; | ||
result += +iteratee(array[length]) || 0; | ||
} | ||
@@ -16,0 +18,0 @@ return result; |
@@ -56,3 +56,3 @@ import arrayCopy from './arrayCopy'; | ||
/** | ||
* Used to resolve the [`toStringTag`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.prototype.tostring) | ||
* Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) | ||
* of values. | ||
@@ -108,3 +108,3 @@ */ | ||
} | ||
// Check for circular references and return corresponding clone. | ||
// Check for circular references and return its corresponding clone. | ||
stackA || (stackA = []); | ||
@@ -111,0 +111,0 @@ stackB || (stackB = []); |
@@ -17,3 +17,3 @@ import isObject from '../lang/isObject'; | ||
var result = new object; | ||
object.prototype = null; | ||
object.prototype = undefined; | ||
} | ||
@@ -20,0 +20,0 @@ return result || {}; |
@@ -5,2 +5,5 @@ import baseIndexOf from './baseIndexOf'; | ||
/** Used as the size to enable large array optimizations. */ | ||
var LARGE_ARRAY_SIZE = 200; | ||
/** | ||
@@ -25,3 +28,3 @@ * The base implementation of `_.difference` which accepts a single array | ||
isCommon = true, | ||
cache = (isCommon && values.length >= 200) ? createCache(values) : null, | ||
cache = (isCommon && values.length >= LARGE_ARRAY_SIZE) ? createCache(values) : null, | ||
valuesLength = values.length; | ||
@@ -28,0 +31,0 @@ |
@@ -0,1 +1,2 @@ | ||
import arrayPush from './arrayPush'; | ||
import isArguments from '../lang/isArguments'; | ||
@@ -14,9 +15,10 @@ import isArray from '../lang/isArray'; | ||
* @param {boolean} [isStrict] Restrict flattening to arrays-like objects. | ||
* @param {Array} [result=[]] The initial result value. | ||
* @returns {Array} Returns the new flattened array. | ||
*/ | ||
function baseFlatten(array, isDeep, isStrict) { | ||
function baseFlatten(array, isDeep, isStrict, result) { | ||
result || (result = []); | ||
var index = -1, | ||
length = array.length, | ||
resIndex = -1, | ||
result = []; | ||
length = array.length; | ||
@@ -29,12 +31,8 @@ while (++index < length) { | ||
// Recursively flatten arrays (susceptible to call stack limits). | ||
value = baseFlatten(value, isDeep, isStrict); | ||
baseFlatten(value, isDeep, isStrict, result); | ||
} else { | ||
arrayPush(result, value); | ||
} | ||
var valIndex = -1, | ||
valLength = value.length; | ||
while (++valIndex < valLength) { | ||
result[++resIndex] = value[valIndex]; | ||
} | ||
} else if (!isStrict) { | ||
result[++resIndex] = value; | ||
result[result.length] = value; | ||
} | ||
@@ -41,0 +39,0 @@ } |
@@ -19,3 +19,3 @@ import equalArrays from './equalArrays'; | ||
/** | ||
* Used to resolve the [`toStringTag`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.prototype.tostring) | ||
* Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) | ||
* of values. | ||
@@ -22,0 +22,0 @@ */ |
@@ -17,3 +17,3 @@ import arrayEach from './arrayEach'; | ||
* @param {Object} source The source object. | ||
* @param {Function} [customizer] The function to customize merging properties. | ||
* @param {Function} [customizer] The function to customize merged values. | ||
* @param {Array} [stackA=[]] Tracks traversed source objects. | ||
@@ -28,3 +28,3 @@ * @param {Array} [stackB=[]] Associates values with source counterparts. | ||
var isSrcArr = isArrayLike(source) && (isArray(source) || isTypedArray(source)), | ||
props = isSrcArr ? null : keys(source); | ||
props = isSrcArr ? undefined : keys(source); | ||
@@ -31,0 +31,0 @@ arrayEach(props || source, function(srcValue, key) { |
@@ -19,3 +19,3 @@ import arrayCopy from './arrayCopy'; | ||
* @param {Function} mergeFunc The function to merge values. | ||
* @param {Function} [customizer] The function to customize merging properties. | ||
* @param {Function} [customizer] The function to customize merged values. | ||
* @param {Array} [stackA=[]] Tracks traversed source objects. | ||
@@ -22,0 +22,0 @@ * @param {Array} [stackB=[]] Associates values with source counterparts. |
@@ -1,6 +0,4 @@ | ||
/** Native method references. */ | ||
var floor = Math.floor; | ||
/* Native method references for those with the same name as other `lodash` methods. */ | ||
var nativeRandom = Math.random; | ||
var nativeFloor = Math.floor, | ||
nativeRandom = Math.random; | ||
@@ -17,5 +15,5 @@ /** | ||
function baseRandom(min, max) { | ||
return min + floor(nativeRandom() * (max - min + 1)); | ||
return min + nativeFloor(nativeRandom() * (max - min + 1)); | ||
} | ||
export default baseRandom; |
@@ -10,5 +10,2 @@ /** | ||
function baseToString(value) { | ||
if (typeof value == 'string') { | ||
return value; | ||
} | ||
return value == null ? '' : (value + ''); | ||
@@ -15,0 +12,0 @@ } |
@@ -5,2 +5,5 @@ import baseIndexOf from './baseIndexOf'; | ||
/** Used as the size to enable large array optimizations. */ | ||
var LARGE_ARRAY_SIZE = 200; | ||
/** | ||
@@ -20,3 +23,3 @@ * The base implementation of `_.uniq` without support for callback shorthands | ||
isCommon = true, | ||
isLarge = isCommon && length >= 200, | ||
isLarge = isCommon && length >= LARGE_ARRAY_SIZE, | ||
seen = isLarge ? createCache() : null, | ||
@@ -23,0 +26,0 @@ result = []; |
import LazyWrapper from './LazyWrapper'; | ||
import arrayPush from './arrayPush'; | ||
/** Used for native method references. */ | ||
var arrayProto = Array.prototype; | ||
/** Native method references. */ | ||
var push = arrayProto.push; | ||
/** | ||
@@ -28,7 +23,4 @@ * The base implementation of `wrapperValue` which returns the result of | ||
while (++index < length) { | ||
var args = [result], | ||
action = actions[index]; | ||
push.apply(args, action.args); | ||
result = action.func.apply(action.thisArg, args); | ||
var action = actions[index]; | ||
result = action.func.apply(action.thisArg, arrayPush([result], action.args)); | ||
} | ||
@@ -35,0 +27,0 @@ return result; |
@@ -1,6 +0,4 @@ | ||
/** Native method references. */ | ||
var floor = Math.floor; | ||
/* Native method references for those with the same name as other `lodash` methods. */ | ||
var nativeMin = Math.min; | ||
var nativeFloor = Math.floor, | ||
nativeMin = Math.min; | ||
@@ -34,3 +32,3 @@ /** Used as references for the maximum length and index of an array. */ | ||
while (low < high) { | ||
var mid = floor((low + high) / 2), | ||
var mid = nativeFloor((low + high) / 2), | ||
computed = iteratee(array[mid]), | ||
@@ -37,0 +35,0 @@ isDef = computed !== undefined, |
@@ -1,26 +0,7 @@ | ||
import constant from '../utility/constant'; | ||
import getNative from './getNative'; | ||
import root from './root'; | ||
/** Native method references. */ | ||
var ArrayBuffer = getNative(root, 'ArrayBuffer'), | ||
bufferSlice = getNative(ArrayBuffer && new ArrayBuffer(0), 'slice'), | ||
floor = Math.floor, | ||
Uint8Array = getNative(root, 'Uint8Array'); | ||
var ArrayBuffer = root.ArrayBuffer, | ||
Uint8Array = root.Uint8Array; | ||
/** Used to clone array buffers. */ | ||
var Float64Array = (function() { | ||
// Safari 5 errors when using an array buffer to initialize a typed array | ||
// where the array buffer's `byteLength` is not a multiple of the typed | ||
// array's `BYTES_PER_ELEMENT`. | ||
try { | ||
var func = getNative(root, 'Float64Array'), | ||
result = new func(new ArrayBuffer(10), 0, 1) && func; | ||
} catch(e) {} | ||
return result || null; | ||
}()); | ||
/** Used as the size, in bytes, of each `Float64Array` element. */ | ||
var FLOAT64_BYTES_PER_ELEMENT = Float64Array ? Float64Array.BYTES_PER_ELEMENT : 0; | ||
/** | ||
@@ -34,24 +15,9 @@ * Creates a clone of the given array buffer. | ||
function bufferClone(buffer) { | ||
return bufferSlice.call(buffer, 0); | ||
} | ||
if (!bufferSlice) { | ||
// PhantomJS has `ArrayBuffer` and `Uint8Array` but not `Float64Array`. | ||
bufferClone = !(ArrayBuffer && Uint8Array) ? constant(null) : function(buffer) { | ||
var byteLength = buffer.byteLength, | ||
floatLength = Float64Array ? floor(byteLength / FLOAT64_BYTES_PER_ELEMENT) : 0, | ||
offset = floatLength * FLOAT64_BYTES_PER_ELEMENT, | ||
result = new ArrayBuffer(byteLength); | ||
var result = new ArrayBuffer(buffer.byteLength), | ||
view = new Uint8Array(result); | ||
if (floatLength) { | ||
var view = new Float64Array(result, 0, floatLength); | ||
view.set(new Float64Array(buffer, 0, floatLength)); | ||
} | ||
if (byteLength != offset) { | ||
view = new Uint8Array(result, offset); | ||
view.set(new Uint8Array(buffer, offset)); | ||
} | ||
return result; | ||
}; | ||
view.set(new Uint8Array(buffer)); | ||
return result; | ||
} | ||
export default bufferClone; |
@@ -8,4 +8,4 @@ import baseCompareAscending from './baseCompareAscending'; | ||
* @private | ||
* @param {Object} object The object to compare to `other`. | ||
* @param {Object} other The object to compare to `object`. | ||
* @param {Object} object The object to compare. | ||
* @param {Object} other The other object to compare. | ||
* @returns {number} Returns the sort order indicator for `object`. | ||
@@ -12,0 +12,0 @@ */ |
import baseCompareAscending from './baseCompareAscending'; | ||
/** | ||
* Used by `_.sortByOrder` to compare multiple properties of each element | ||
* in a collection and stable sort them in the following order: | ||
* Used by `_.sortByOrder` to compare multiple properties of a value to another | ||
* and stable sort them. | ||
* | ||
* If `orders` is unspecified, sort in ascending order for all properties. | ||
* Otherwise, for each property, sort in ascending order if its corresponding value in | ||
* orders is true, and descending order if false. | ||
* If `orders` is unspecified, all valuess are sorted in ascending order. Otherwise, | ||
* a value is sorted in ascending order if its corresponding order is "asc", and | ||
* descending if "desc". | ||
* | ||
* @private | ||
* @param {Object} object The object to compare to `other`. | ||
* @param {Object} other The object to compare to `object`. | ||
* @param {Object} object The object to compare. | ||
* @param {Object} other The other object to compare. | ||
* @param {boolean[]} orders The order to sort by for each property. | ||
@@ -30,3 +30,4 @@ * @returns {number} Returns the sort order indicator for `object`. | ||
} | ||
return result * (orders[index] ? 1 : -1); | ||
var order = orders[index]; | ||
return result * ((order === 'asc' || order === true) ? 1 : -1); | ||
} | ||
@@ -33,0 +34,0 @@ } |
@@ -20,3 +20,3 @@ /* Native method references for those with the same name as other `lodash` methods. */ | ||
leftLength = partials.length, | ||
result = Array(argsLength + leftLength); | ||
result = Array(leftLength + argsLength); | ||
@@ -23,0 +23,0 @@ while (++leftIndex < leftLength) { |
@@ -6,9 +6,4 @@ import baseCallback from './baseCallback'; | ||
/** | ||
* Creates a function that aggregates a collection, creating an accumulator | ||
* object composed from the results of running each element in the collection | ||
* through an iteratee. | ||
* Creates a `_.countBy`, `_.groupBy`, `_.indexBy`, or `_.partition` function. | ||
* | ||
* **Note:** This function is used to create `_.countBy`, `_.groupBy`, `_.indexBy`, | ||
* and `_.partition`. | ||
* | ||
* @private | ||
@@ -15,0 +10,0 @@ * @param {Function} setter The function to set keys and values of the accumulator object. |
@@ -6,7 +6,4 @@ import bindCallback from './bindCallback'; | ||
/** | ||
* Creates a function that assigns properties of source object(s) to a given | ||
* destination object. | ||
* Creates a `_.assign`, `_.defaults`, or `_.merge` function. | ||
* | ||
* **Note:** This function is used to create `_.assign`, `_.defaults`, and `_.merge`. | ||
* | ||
* @private | ||
@@ -13,0 +10,0 @@ * @param {Function} assigner The function to assign values. |
import SetCache from './SetCache'; | ||
import constant from '../utility/constant'; | ||
import getNative from './getNative'; | ||
@@ -19,6 +18,6 @@ import root from './root'; | ||
*/ | ||
var createCache = !(nativeCreate && Set) ? constant(null) : function(values) { | ||
return new SetCache(values); | ||
}; | ||
function createCache(values) { | ||
return (nativeCreate && Set) ? new SetCache(values) : null; | ||
} | ||
export default createCache; |
@@ -15,3 +15,3 @@ import baseCreate from './baseCreate'; | ||
// Use a `switch` statement to work with class constructors. | ||
// See https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-function-objects-call-thisargument-argumentslist | ||
// See http://ecma-international.org/ecma-262/6.0/#sec-ecmascript-function-objects-call-thisargument-argumentslist | ||
// for more details. | ||
@@ -26,2 +26,4 @@ var args = arguments; | ||
case 5: return new Ctor(args[0], args[1], args[2], args[3], args[4]); | ||
case 6: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5]); | ||
case 7: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]); | ||
} | ||
@@ -28,0 +30,0 @@ var thisBinding = baseCreate(Ctor.prototype), |
@@ -14,5 +14,5 @@ import createWrapper from './createWrapper'; | ||
if (guard && isIterateeCall(func, arity, guard)) { | ||
arity = null; | ||
arity = undefined; | ||
} | ||
var result = createWrapper(func, flag, null, null, null, null, null, arity); | ||
var result = createWrapper(func, flag, undefined, undefined, undefined, undefined, undefined, arity); | ||
result.placeholder = curryFunc.placeholder; | ||
@@ -19,0 +19,0 @@ return result; |
import arrayExtremum from './arrayExtremum'; | ||
import baseCallback from './baseCallback'; | ||
import baseExtremum from './baseExtremum'; | ||
import isArray from '../lang/isArray'; | ||
import isIterateeCall from './isIterateeCall'; | ||
@@ -18,7 +19,7 @@ import toIterable from './toIterable'; | ||
if (thisArg && isIterateeCall(collection, iteratee, thisArg)) { | ||
iteratee = null; | ||
iteratee = undefined; | ||
} | ||
iteratee = baseCallback(iteratee, thisArg, 3); | ||
if (iteratee.length == 1) { | ||
collection = toIterable(collection); | ||
collection = isArray(collection) ? collection : toIterable(collection); | ||
var result = arrayExtremum(collection, iteratee, comparator, exValue); | ||
@@ -25,0 +26,0 @@ if (!(collection.length && result === exValue)) { |
@@ -13,2 +13,5 @@ import LodashWrapper from './LodashWrapper'; | ||
/** Used as the size to enable large array optimizations. */ | ||
var LARGE_ARRAY_SIZE = 200; | ||
/** Used as the `TypeError` message for "Functions" methods. */ | ||
@@ -38,3 +41,3 @@ var FUNC_ERROR_TEXT = 'Expected a function'; | ||
if (!wrapper && LodashWrapper.prototype.thru && getFuncName(func) == 'wrapper') { | ||
wrapper = new LodashWrapper([]); | ||
wrapper = new LodashWrapper([], true); | ||
} | ||
@@ -47,3 +50,3 @@ } | ||
var funcName = getFuncName(func), | ||
data = funcName == 'wrapper' ? getData(func) : null; | ||
data = funcName == 'wrapper' ? getData(func) : undefined; | ||
@@ -57,8 +60,10 @@ if (data && isLaziable(data[0]) && data[1] == (ARY_FLAG | CURRY_FLAG | PARTIAL_FLAG | REARG_FLAG) && !data[4].length && data[9] == 1) { | ||
return function() { | ||
var args = arguments; | ||
if (wrapper && args.length == 1 && isArray(args[0])) { | ||
return wrapper.plant(args[0]).value(); | ||
var args = arguments, | ||
value = args[0]; | ||
if (wrapper && args.length == 1 && isArray(value) && value.length >= LARGE_ARRAY_SIZE) { | ||
return wrapper.plant(value).value(); | ||
} | ||
var index = 0, | ||
result = length ? funcs[index].apply(this, args) : args[0]; | ||
result = length ? funcs[index].apply(this, args) : value; | ||
@@ -65,0 +70,0 @@ while (++index < length) { |
@@ -48,3 +48,3 @@ import arrayCopy from './arrayCopy'; | ||
isCurryRight = bitmask & CURRY_RIGHT_FLAG, | ||
Ctor = isBindKey ? null : createCtorWrapper(func); | ||
Ctor = isBindKey ? undefined : createCtorWrapper(func); | ||
@@ -73,8 +73,8 @@ function wrapper() { | ||
if (length < arity) { | ||
var newArgPos = argPos ? arrayCopy(argPos) : null, | ||
var newArgPos = argPos ? arrayCopy(argPos) : undefined, | ||
newArity = nativeMax(arity - length, 0), | ||
newsHolders = isCurry ? argsHolders : null, | ||
newHoldersRight = isCurry ? null : argsHolders, | ||
newPartials = isCurry ? args : null, | ||
newPartialsRight = isCurry ? null : args; | ||
newsHolders = isCurry ? argsHolders : undefined, | ||
newHoldersRight = isCurry ? undefined : argsHolders, | ||
newPartials = isCurry ? args : undefined, | ||
newPartialsRight = isCurry ? undefined : args; | ||
@@ -81,0 +81,0 @@ bitmask |= (isCurry ? PARTIAL_FLAG : PARTIAL_RIGHT_FLAG); |
import repeat from '../string/repeat'; | ||
import root from './root'; | ||
/** Native method references. */ | ||
var ceil = Math.ceil; | ||
/* Native method references for those with the same name as other `lodash` methods. */ | ||
var nativeIsFinite = root.isFinite; | ||
var nativeCeil = Math.ceil, | ||
nativeIsFinite = root.isFinite; | ||
@@ -29,5 +27,5 @@ /** | ||
chars = chars == null ? ' ' : (chars + ''); | ||
return repeat(chars, ceil(padLength / chars.length)).slice(0, padLength); | ||
return repeat(chars, nativeCeil(padLength / chars.length)).slice(0, padLength); | ||
} | ||
export default createPadding; |
@@ -15,3 +15,3 @@ import createWrapper from './createWrapper'; | ||
var holders = replaceHolders(partials, partialFunc.placeholder); | ||
return createWrapper(func, flag, null, partials, holders); | ||
return createWrapper(func, flag, undefined, partials, holders); | ||
}); | ||
@@ -18,0 +18,0 @@ return partialFunc; |
@@ -30,3 +30,3 @@ import createCtorWrapper from './createCtorWrapper'; | ||
leftLength = partials.length, | ||
args = Array(argsLength + leftLength); | ||
args = Array(leftLength + argsLength); | ||
@@ -33,0 +33,0 @@ while (++leftIndex < leftLength) { |
@@ -54,3 +54,3 @@ import baseSetData from './baseSetData'; | ||
bitmask &= ~(PARTIAL_FLAG | PARTIAL_RIGHT_FLAG); | ||
partials = holders = null; | ||
partials = holders = undefined; | ||
} | ||
@@ -62,5 +62,5 @@ length -= (holders ? holders.length : 0); | ||
partials = holders = null; | ||
partials = holders = undefined; | ||
} | ||
var data = isBindKey ? null : getData(func), | ||
var data = isBindKey ? undefined : getData(func), | ||
newData = [func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity]; | ||
@@ -67,0 +67,0 @@ |
@@ -17,3 +17,3 @@ /** `Object#toString` result references. */ | ||
* @private | ||
* @param {Object} value The object to compare. | ||
* @param {Object} object The object to compare. | ||
* @param {Object} other The other object to compare. | ||
@@ -20,0 +20,0 @@ * @param {string} tag The `toStringTag` of the objects to compare. |
@@ -12,4 +12,3 @@ /** Used to escape characters for inclusion in compiled string literals. */ | ||
/** | ||
* Used by `_.template` to escape characters for inclusion in compiled | ||
* string literals. | ||
* Used by `_.template` to escape characters for inclusion in compiled string literals. | ||
* | ||
@@ -16,0 +15,0 @@ * @private |
@@ -11,3 +11,3 @@ /* Native method references for those with the same name as other `lodash` methods. */ | ||
* @param {number} end The end of the view. | ||
* @param {Array} [transforms] The transformations to apply to the view. | ||
* @param {Array} transforms The transformations to apply to the view. | ||
* @returns {Object} Returns an object containing the `start` and `end` | ||
@@ -18,3 +18,3 @@ * positions of the view. | ||
var index = -1, | ||
length = transforms ? transforms.length : 0; | ||
length = transforms.length; | ||
@@ -21,0 +21,0 @@ while (++index < length) { |
@@ -5,3 +5,3 @@ /** Used to detect unsigned integer values. */ | ||
/** | ||
* Used as the [maximum length](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-number.max_safe_integer) | ||
* Used as the [maximum length](http://ecma-international.org/ecma-262/6.0/#sec-number.max_safe_integer) | ||
* of an array-like value. | ||
@@ -8,0 +8,0 @@ */ |
/** | ||
* Used as the [maximum length](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-number.max_safe_integer) | ||
* Used as the [maximum length](http://ecma-international.org/ecma-262/6.0/#sec-number.max_safe_integer) | ||
* of an array-like value. | ||
@@ -10,3 +10,3 @@ */ | ||
* | ||
* **Note:** This function is based on [`ToLength`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tolength). | ||
* **Note:** This function is based on [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength). | ||
* | ||
@@ -13,0 +13,0 @@ * @private |
@@ -13,13 +13,9 @@ import LazyWrapper from './LazyWrapper'; | ||
function lazyClone() { | ||
var actions = this.__actions__, | ||
iteratees = this.__iteratees__, | ||
views = this.__views__, | ||
result = new LazyWrapper(this.__wrapped__); | ||
result.__actions__ = actions ? arrayCopy(actions) : null; | ||
var result = new LazyWrapper(this.__wrapped__); | ||
result.__actions__ = arrayCopy(this.__actions__); | ||
result.__dir__ = this.__dir__; | ||
result.__filtered__ = this.__filtered__; | ||
result.__iteratees__ = iteratees ? arrayCopy(iteratees) : null; | ||
result.__iteratees__ = arrayCopy(this.__iteratees__); | ||
result.__takeCount__ = this.__takeCount__; | ||
result.__views__ = views ? arrayCopy(views) : null; | ||
result.__views__ = arrayCopy(this.__views__); | ||
return result; | ||
@@ -26,0 +22,0 @@ } |
@@ -5,5 +5,7 @@ import baseWrapperValue from './baseWrapperValue'; | ||
/** Used as the size to enable large array optimizations. */ | ||
var LARGE_ARRAY_SIZE = 200; | ||
/** Used to indicate the type of lazy iteratees. */ | ||
var LAZY_DROP_WHILE_FLAG = 0, | ||
LAZY_FILTER_FLAG = 1, | ||
var LAZY_FILTER_FLAG = 1, | ||
LAZY_MAP_FLAG = 2; | ||
@@ -23,9 +25,8 @@ | ||
function lazyValue() { | ||
var array = this.__wrapped__.value(); | ||
if (!isArray(array)) { | ||
return baseWrapperValue(array, this.__actions__); | ||
} | ||
var dir = this.__dir__, | ||
var array = this.__wrapped__.value(), | ||
dir = this.__dir__, | ||
isArr = isArray(array), | ||
isRight = dir < 0, | ||
view = getView(0, array.length, this.__views__), | ||
arrLength = isArr ? array.length : 0, | ||
view = getView(0, arrLength, this.__views__), | ||
start = view.start, | ||
@@ -35,8 +36,12 @@ end = view.end, | ||
index = isRight ? end : (start - 1), | ||
takeCount = nativeMin(length, this.__takeCount__), | ||
iteratees = this.__iteratees__, | ||
iterLength = iteratees ? iteratees.length : 0, | ||
iterLength = iteratees.length, | ||
resIndex = 0, | ||
result = []; | ||
takeCount = nativeMin(length, this.__takeCount__); | ||
if (!isArr || arrLength < LARGE_ARRAY_SIZE || (arrLength == length && takeCount == length)) { | ||
return baseWrapperValue((isRight && isArr) ? array.reverse() : array, this.__actions__); | ||
} | ||
var result = []; | ||
outer: | ||
@@ -52,27 +57,13 @@ while (length-- && resIndex < takeCount) { | ||
iteratee = data.iteratee, | ||
type = data.type; | ||
type = data.type, | ||
computed = iteratee(value); | ||
if (type == LAZY_DROP_WHILE_FLAG) { | ||
if (data.done && (isRight ? (index > data.index) : (index < data.index))) { | ||
data.count = 0; | ||
data.done = false; | ||
if (type == LAZY_MAP_FLAG) { | ||
value = computed; | ||
} else if (!computed) { | ||
if (type == LAZY_FILTER_FLAG) { | ||
continue outer; | ||
} else { | ||
break outer; | ||
} | ||
data.index = index; | ||
if (!data.done) { | ||
var limit = data.limit; | ||
if (!(data.done = limit > -1 ? (data.count++ >= limit) : !iteratee(value))) { | ||
continue outer; | ||
} | ||
} | ||
} else { | ||
var computed = iteratee(value); | ||
if (type == LAZY_MAP_FLAG) { | ||
value = computed; | ||
} else if (!computed) { | ||
if (type == LAZY_FILTER_FLAG) { | ||
continue outer; | ||
} else { | ||
break outer; | ||
} | ||
} | ||
} | ||
@@ -79,0 +70,0 @@ } |
@@ -15,9 +15,8 @@ import baseCreate from './baseCreate'; | ||
this.__wrapped__ = value; | ||
this.__actions__ = null; | ||
this.__actions__ = []; | ||
this.__dir__ = 1; | ||
this.__dropCount__ = 0; | ||
this.__filtered__ = false; | ||
this.__iteratees__ = null; | ||
this.__iteratees__ = []; | ||
this.__takeCount__ = POSITIVE_INFINITY; | ||
this.__views__ = null; | ||
this.__views__ = []; | ||
} | ||
@@ -24,0 +23,0 @@ |
import isArrayLike from '../internal/isArrayLike'; | ||
import isObjectLike from '../internal/isObjectLike'; | ||
/** `Object#toString` result references. */ | ||
var argsTag = '[object Arguments]'; | ||
/** Used for native method references. */ | ||
var objectProto = Object.prototype; | ||
/** | ||
* Used to resolve the [`toStringTag`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.prototype.tostring) | ||
* of values. | ||
*/ | ||
var objToString = objectProto.toString; | ||
/** Used to check objects for own properties. */ | ||
var hasOwnProperty = objectProto.hasOwnProperty; | ||
/** Native method references. */ | ||
var propertyIsEnumerable = objectProto.propertyIsEnumerable; | ||
/** | ||
@@ -33,5 +30,6 @@ * Checks if `value` is classified as an `arguments` object. | ||
function isArguments(value) { | ||
return isObjectLike(value) && isArrayLike(value) && objToString.call(value) == argsTag; | ||
return isObjectLike(value) && isArrayLike(value) && | ||
hasOwnProperty.call(value, 'callee') && !propertyIsEnumerable.call(value, 'callee'); | ||
} | ||
export default isArguments; |
@@ -12,3 +12,3 @@ import getNative from '../internal/getNative'; | ||
/** | ||
* Used to resolve the [`toStringTag`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.prototype.tostring) | ||
* Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) | ||
* of values. | ||
@@ -15,0 +15,0 @@ */ |
@@ -10,3 +10,3 @@ import isObjectLike from '../internal/isObjectLike'; | ||
/** | ||
* Used to resolve the [`toStringTag`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.prototype.tostring) | ||
* Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) | ||
* of values. | ||
@@ -13,0 +13,0 @@ */ |
@@ -10,3 +10,3 @@ import isObjectLike from '../internal/isObjectLike'; | ||
/** | ||
* Used to resolve the [`toStringTag`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.prototype.tostring) | ||
* Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) | ||
* of values. | ||
@@ -13,0 +13,0 @@ */ |
import isObjectLike from '../internal/isObjectLike'; | ||
import isPlainObject from './isPlainObject'; | ||
import support from '../support'; | ||
/** Used for native method references. */ | ||
var objectProto = Object.prototype; | ||
/** | ||
* Used to resolve the [`toStringTag`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.prototype.tostring) | ||
* of values. | ||
*/ | ||
var objToString = objectProto.toString; | ||
/** | ||
* Checks if `value` is a DOM element. | ||
@@ -31,12 +21,5 @@ * | ||
function isElement(value) { | ||
return !!value && value.nodeType === 1 && isObjectLike(value) && | ||
(objToString.call(value).indexOf('Element') > -1); | ||
return !!value && value.nodeType === 1 && isObjectLike(value) && !isPlainObject(value); | ||
} | ||
// Fallback for environments without DOM support. | ||
if (!support.dom) { | ||
isElement = function(value) { | ||
return !!value && value.nodeType === 1 && isObjectLike(value) && !isPlainObject(value); | ||
}; | ||
} | ||
export default isElement; |
@@ -10,3 +10,3 @@ import isObjectLike from '../internal/isObjectLike'; | ||
/** | ||
* Used to resolve the [`toStringTag`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.prototype.tostring) | ||
* Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) | ||
* of values. | ||
@@ -13,0 +13,0 @@ */ |
@@ -1,7 +0,5 @@ | ||
import getNative from '../internal/getNative'; | ||
import root from '../internal/root'; | ||
/* Native method references for those with the same name as other `lodash` methods. */ | ||
var nativeIsFinite = root.isFinite, | ||
nativeNumIsFinite = getNative(Number, 'isFinite'); | ||
var nativeIsFinite = root.isFinite; | ||
@@ -11,3 +9,3 @@ /** | ||
* | ||
* **Note:** This method is based on [`Number.isFinite`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-number.isfinite). | ||
* **Note:** This method is based on [`Number.isFinite`](http://ecma-international.org/ecma-262/6.0/#sec-number.isfinite). | ||
* | ||
@@ -36,6 +34,6 @@ * @static | ||
*/ | ||
var isFinite = nativeNumIsFinite || function(value) { | ||
function isFinite(value) { | ||
return typeof value == 'number' && nativeIsFinite(value); | ||
}; | ||
} | ||
export default isFinite; |
@@ -1,4 +0,2 @@ | ||
import baseIsFunction from '../internal/baseIsFunction'; | ||
import getNative from '../internal/getNative'; | ||
import root from '../internal/root'; | ||
import isObject from './isObject'; | ||
@@ -12,3 +10,3 @@ /** `Object#toString` result references. */ | ||
/** | ||
* Used to resolve the [`toStringTag`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.prototype.tostring) | ||
* Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) | ||
* of values. | ||
@@ -18,5 +16,2 @@ */ | ||
/** Native method references. */ | ||
var Uint8Array = getNative(root, 'Uint8Array'); | ||
/** | ||
@@ -38,9 +33,9 @@ * Checks if `value` is classified as a `Function` object. | ||
*/ | ||
var isFunction = !(baseIsFunction(/x/) || (Uint8Array && !baseIsFunction(Uint8Array))) ? baseIsFunction : function(value) { | ||
function isFunction(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 Safari 8 equivalents which return 'object' for typed array constructors. | ||
return objToString.call(value) == funcTag; | ||
}; | ||
return isObject(value) && objToString.call(value) == funcTag; | ||
} | ||
export default isFunction; |
@@ -1,7 +0,4 @@ | ||
import escapeRegExp from '../string/escapeRegExp'; | ||
import isFunction from './isFunction'; | ||
import isObjectLike from '../internal/isObjectLike'; | ||
/** `Object#toString` result references. */ | ||
var funcTag = '[object Function]'; | ||
/** Used to detect host constructors (Safari > 5). */ | ||
@@ -19,11 +16,5 @@ var reIsHostCtor = /^\[object .+?Constructor\]$/; | ||
/** | ||
* Used to resolve the [`toStringTag`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.prototype.tostring) | ||
* of values. | ||
*/ | ||
var objToString = objectProto.toString; | ||
/** Used to detect if a method is native. */ | ||
var reIsNative = RegExp('^' + | ||
escapeRegExp(fnToString.call(hasOwnProperty)) | ||
fnToString.call(hasOwnProperty).replace(/[\\^$.*+?()[\]{}|]/g, '\\$&') | ||
.replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$' | ||
@@ -52,3 +43,3 @@ ); | ||
} | ||
if (objToString.call(value) == funcTag) { | ||
if (isFunction(value)) { | ||
return reIsNative.test(fnToString.call(value)); | ||
@@ -55,0 +46,0 @@ } |
@@ -10,3 +10,3 @@ import isObjectLike from '../internal/isObjectLike'; | ||
/** | ||
* Used to resolve the [`toStringTag`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.prototype.tostring) | ||
* Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) | ||
* of values. | ||
@@ -13,0 +13,0 @@ */ |
@@ -1,3 +0,4 @@ | ||
import getNative from '../internal/getNative'; | ||
import shimIsPlainObject from '../internal/shimIsPlainObject'; | ||
import baseForIn from '../internal/baseForIn'; | ||
import isArguments from './isArguments'; | ||
import isObjectLike from '../internal/isObjectLike'; | ||
@@ -10,4 +11,7 @@ /** `Object#toString` result references. */ | ||
/** Used to check objects for own properties. */ | ||
var hasOwnProperty = objectProto.hasOwnProperty; | ||
/** | ||
* Used to resolve the [`toStringTag`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.prototype.tostring) | ||
* Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) | ||
* of values. | ||
@@ -17,5 +21,2 @@ */ | ||
/** Native method references. */ | ||
var getPrototypeOf = getNative(Object, 'getPrototypeOf'); | ||
/** | ||
@@ -51,14 +52,23 @@ * Checks if `value` is a plain object, that is, an object created by the | ||
*/ | ||
var isPlainObject = !getPrototypeOf ? shimIsPlainObject : function(value) { | ||
if (!(value && objToString.call(value) == objectTag)) { | ||
function isPlainObject(value) { | ||
var Ctor; | ||
// Exit early for non `Object` objects. | ||
if (!(isObjectLike(value) && objToString.call(value) == objectTag && !isArguments(value)) || | ||
(!hasOwnProperty.call(value, 'constructor') && (Ctor = value.constructor, typeof Ctor == 'function' && !(Ctor instanceof Ctor)))) { | ||
return false; | ||
} | ||
var valueOf = getNative(value, 'valueOf'), | ||
objProto = valueOf && (objProto = getPrototypeOf(valueOf)) && getPrototypeOf(objProto); | ||
// IE < 9 iterates inherited properties before own properties. If the first | ||
// iterated property is an object's own property then there are no inherited | ||
// enumerable properties. | ||
var result; | ||
// In most environments an object's own properties are iterated before | ||
// its inherited properties. If the last iterated property is an object's | ||
// own property then there are no inherited enumerable properties. | ||
baseForIn(value, function(subValue, key) { | ||
result = key; | ||
}); | ||
return result === undefined || hasOwnProperty.call(value, result); | ||
} | ||
return objProto | ||
? (value == objProto || getPrototypeOf(value) == objProto) | ||
: shimIsPlainObject(value); | ||
}; | ||
export default isPlainObject; |
@@ -1,2 +0,2 @@ | ||
import isObjectLike from '../internal/isObjectLike'; | ||
import isObject from './isObject'; | ||
@@ -10,3 +10,3 @@ /** `Object#toString` result references. */ | ||
/** | ||
* Used to resolve the [`toStringTag`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.prototype.tostring) | ||
* Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) | ||
* of values. | ||
@@ -33,5 +33,5 @@ */ | ||
function isRegExp(value) { | ||
return isObjectLike(value) && objToString.call(value) == regexpTag; | ||
return isObject(value) && objToString.call(value) == regexpTag; | ||
} | ||
export default isRegExp; |
@@ -10,3 +10,3 @@ import isObjectLike from '../internal/isObjectLike'; | ||
/** | ||
* Used to resolve the [`toStringTag`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.prototype.tostring) | ||
* Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) | ||
* of values. | ||
@@ -13,0 +13,0 @@ */ |
@@ -49,3 +49,3 @@ import isLength from '../internal/isLength'; | ||
/** | ||
* Used to resolve the [`toStringTag`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.prototype.tostring) | ||
* Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) | ||
* of values. | ||
@@ -52,0 +52,0 @@ */ |
144
lodash.js
/** | ||
* @license | ||
* lodash 3.9.3 (Custom Build) <https://lodash.com/> | ||
* lodash 3.10.0 (Custom Build) <https://lodash.com/> | ||
* Build: `lodash modularize modern exports="es" -o ./` | ||
@@ -24,2 +24,3 @@ * Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/> | ||
import arrayEach from './internal/arrayEach'; | ||
import arrayPush from './internal/arrayPush'; | ||
import baseCallback from './internal/baseCallback'; | ||
@@ -46,3 +47,3 @@ import baseForOwn from './internal/baseForOwn'; | ||
/** Used as the semantic version number. */ | ||
var VERSION = '3.9.3'; | ||
var VERSION = '3.10.0'; | ||
@@ -53,4 +54,3 @@ /** Used to compose bitmasks for wrapper metadata. */ | ||
/** Used to indicate the type of lazy iteratees. */ | ||
var LAZY_DROP_WHILE_FLAG = 0, | ||
LAZY_MAP_FLAG = 2; | ||
var LAZY_MAP_FLAG = 2; | ||
@@ -61,10 +61,10 @@ /** Used for native method references. */ | ||
/** Native method references. */ | ||
var floor = Math.floor, | ||
push = arrayProto.push; | ||
/* Native method references for those with the same name as other `lodash` methods. */ | ||
var nativeMax = Math.max, | ||
var nativeFloor = Math.floor, | ||
nativeMax = Math.max, | ||
nativeMin = Math.min; | ||
/** Used as references for `-Infinity` and `Infinity`. */ | ||
var POSITIVE_INFINITY = Number.POSITIVE_INFINITY; | ||
// wrap `_.mixin` so it works when provided only one argument | ||
@@ -108,2 +108,3 @@ var mixin = (function(func) { | ||
lodash.defaults = object.defaults; | ||
lodash.defaultsDeep = object.defaultsDeep; | ||
lodash.defer = func.defer; | ||
@@ -147,2 +148,3 @@ lodash.delay = func.delay; | ||
lodash.mixin = mixin; | ||
lodash.modArgs = func.modArgs; | ||
lodash.negate = func.negate; | ||
@@ -221,2 +223,3 @@ lodash.omit = object.omit; | ||
lodash.capitalize = string.capitalize; | ||
lodash.ceil = math.ceil; | ||
lodash.clone = lang.clone; | ||
@@ -237,2 +240,3 @@ lodash.cloneDeep = lang.cloneDeep; | ||
lodash.first = array.first; | ||
lodash.floor = math.floor; | ||
lodash.get = object.get; | ||
@@ -285,2 +289,3 @@ lodash.gt = lang.gt; | ||
lodash.result = object.result; | ||
lodash.round = math.round; | ||
lodash.size = collection.size; | ||
@@ -354,44 +359,16 @@ lodash.snakeCase = string.snakeCase; | ||
// Add `LazyWrapper` methods that accept an `iteratee` value. | ||
arrayEach(['dropWhile', 'filter', 'map', 'takeWhile'], function(methodName, type) { | ||
var isFilter = type != LAZY_MAP_FLAG, | ||
isDropWhile = type == LAZY_DROP_WHILE_FLAG; | ||
LazyWrapper.prototype[methodName] = function(iteratee, thisArg) { | ||
var filtered = this.__filtered__, | ||
result = (filtered && isDropWhile) ? new LazyWrapper(this) : this.clone(), | ||
iteratees = result.__iteratees__ || (result.__iteratees__ = []); | ||
iteratees.push({ | ||
'done': false, | ||
'count': 0, | ||
'index': 0, | ||
'iteratee': baseCallback(iteratee, thisArg, 1), | ||
'limit': -1, | ||
'type': type | ||
}); | ||
result.__filtered__ = filtered || isFilter; | ||
return result; | ||
}; | ||
}); | ||
// Add `LazyWrapper` methods for `_.drop` and `_.take` variants. | ||
arrayEach(['drop', 'take'], function(methodName, index) { | ||
var whileName = methodName + 'While'; | ||
LazyWrapper.prototype[methodName] = function(n) { | ||
var filtered = this.__filtered__, | ||
result = (filtered && !index) ? this.dropWhile() : this.clone(); | ||
var filtered = this.__filtered__; | ||
if (filtered && !index) { | ||
return new LazyWrapper(this); | ||
} | ||
n = n == null ? 1 : nativeMax(nativeFloor(n) || 0, 0); | ||
n = n == null ? 1 : nativeMax(floor(n) || 0, 0); | ||
var result = this.clone(); | ||
if (filtered) { | ||
if (index) { | ||
result.__takeCount__ = nativeMin(result.__takeCount__, n); | ||
} else { | ||
last(result.__iteratees__).limit = n; | ||
} | ||
result.__takeCount__ = nativeMin(result.__takeCount__, n); | ||
} else { | ||
var views = result.__views__ || (result.__views__ = []); | ||
views.push({ 'size': n, 'type': methodName + (result.__dir__ < 0 ? 'Right' : '') }); | ||
result.__views__.push({ 'size': n, 'type': methodName + (result.__dir__ < 0 ? 'Right' : '') }); | ||
} | ||
@@ -404,5 +381,14 @@ return result; | ||
}; | ||
}); | ||
LazyWrapper.prototype[methodName + 'RightWhile'] = function(predicate, thisArg) { | ||
return this.reverse()[whileName](predicate, thisArg).reverse(); | ||
// Add `LazyWrapper` methods that accept an `iteratee` value. | ||
arrayEach(['filter', 'map', 'takeWhile'], function(methodName, index) { | ||
var type = index + 1, | ||
isFilter = type != LAZY_MAP_FLAG; | ||
LazyWrapper.prototype[methodName] = function(iteratee, thisArg) { | ||
var result = this.clone(); | ||
result.__iteratees__.push({ 'iteratee': baseCallback(iteratee, thisArg, 1), 'type': type }); | ||
result.__filtered__ = result.__filtered__ || isFilter; | ||
return result; | ||
}; | ||
@@ -425,3 +411,3 @@ }); | ||
LazyWrapper.prototype[methodName] = function() { | ||
return this[dropName](1); | ||
return this.__filtered__ ? new LazyWrapper(this) : this[dropName](1); | ||
}; | ||
@@ -455,6 +441,9 @@ }); | ||
var result = this; | ||
if (result.__filtered__ && (start > 0 || end < 0)) { | ||
return new LazyWrapper(result); | ||
} | ||
if (start < 0) { | ||
result = this.takeRight(-start); | ||
result = result.takeRight(-start); | ||
} else if (start) { | ||
result = this.drop(start); | ||
result = result.drop(start); | ||
} | ||
@@ -468,4 +457,8 @@ if (end !== undefined) { | ||
LazyWrapper.prototype.takeRightWhile = function(predicate, thisArg) { | ||
return this.reverse().takeWhile(predicate, thisArg).reverse(); | ||
}; | ||
LazyWrapper.prototype.toArray = function() { | ||
return this.drop(0); | ||
return this.take(POSITIVE_INFINITY); | ||
}; | ||
@@ -475,11 +468,11 @@ | ||
baseForOwn(LazyWrapper.prototype, function(func, methodName) { | ||
var lodashFunc = lodash[methodName]; | ||
var checkIteratee = /^(?:filter|map|reject)|While$/.test(methodName), | ||
retUnwrapped = /^(?:first|last)$/.test(methodName), | ||
lodashFunc = lodash[retUnwrapped ? ('take' + (methodName == 'last' ? 'Right' : '')) : methodName]; | ||
if (!lodashFunc) { | ||
return; | ||
} | ||
var checkIteratee = /^(?:filter|map|reject)|While$/.test(methodName), | ||
retUnwrapped = /^(?:first|last)$/.test(methodName); | ||
lodash.prototype[methodName] = function() { | ||
var args = arguments, | ||
var args = retUnwrapped ? [1] : arguments, | ||
chainAll = this.__chain__, | ||
@@ -493,24 +486,26 @@ value = this.__wrapped__, | ||
if (useLazy && checkIteratee && typeof iteratee == 'function' && iteratee.length != 1) { | ||
// avoid lazy use if the iteratee has a "length" value other than `1` | ||
// Avoid lazy use if the iteratee has a "length" value other than `1`. | ||
isLazy = useLazy = false; | ||
} | ||
var onlyLazy = isLazy && !isHybrid; | ||
if (retUnwrapped && !chainAll) { | ||
return onlyLazy | ||
? func.call(value) | ||
: lodashFunc.call(lodash, this.value()); | ||
} | ||
var interceptor = function(value) { | ||
var otherArgs = [value]; | ||
push.apply(otherArgs, args); | ||
return lodashFunc.apply(lodash, otherArgs); | ||
return (retUnwrapped && chainAll) | ||
? lodashFunc(value, 1)[0] | ||
: lodashFunc.apply(undefined, arrayPush([value], args)); | ||
}; | ||
if (useLazy) { | ||
var wrapper = onlyLazy ? value : new LazyWrapper(this), | ||
result = func.apply(wrapper, args); | ||
if (!retUnwrapped && (isHybrid || result.__actions__)) { | ||
var actions = result.__actions__ || (result.__actions__ = []); | ||
actions.push({ 'func': thru, 'args': [interceptor], 'thisArg': lodash }); | ||
var action = { 'func': thru, 'args': [interceptor], 'thisArg': undefined }, | ||
onlyLazy = isLazy && !isHybrid; | ||
if (retUnwrapped && !chainAll) { | ||
if (onlyLazy) { | ||
value = value.clone(); | ||
value.__actions__.push(action); | ||
return func.call(value); | ||
} | ||
return lodashFunc.call(undefined, this.value())[0]; | ||
} | ||
if (!retUnwrapped && useLazy) { | ||
value = onlyLazy ? value : new LazyWrapper(this); | ||
var result = func.apply(value, args); | ||
result.__actions__.push(action); | ||
return new LodashWrapper(result, chainAll); | ||
@@ -523,3 +518,3 @@ } | ||
// Add `Array` and `String` methods to `lodash.prototype`. | ||
arrayEach(['concat', 'join', 'pop', 'push', 'replace', 'shift', 'sort', 'splice', 'split', 'unshift'], function(methodName) { | ||
arrayEach(['join', 'pop', 'push', 'replace', 'shift', 'sort', 'splice', 'split', 'unshift'], function(methodName) { | ||
var func = (/^(?:replace|split)$/.test(methodName) ? stringProto : arrayProto)[methodName], | ||
@@ -551,3 +546,3 @@ chainName = /^(?:push|sort|unshift)$/.test(methodName) ? 'tap' : 'thru', | ||
realNames[createHybridWrapper(null, BIND_KEY_FLAG).name] = [{ 'name': 'wrapper', 'func': null }]; | ||
realNames[createHybridWrapper(undefined, BIND_KEY_FLAG).name] = [{ 'name': 'wrapper', 'func': undefined }]; | ||
@@ -562,2 +557,3 @@ // Add functions to the lazy wrapper. | ||
lodash.prototype.commit = chain.commit; | ||
lodash.prototype.concat = chain.concat; | ||
lodash.prototype.plant = chain.plant; | ||
@@ -564,0 +560,0 @@ lodash.prototype.reverse = chain.reverse; |
import add from './math/add'; | ||
import ceil from './math/ceil'; | ||
import floor from './math/floor'; | ||
import max from './math/max'; | ||
import min from './math/min'; | ||
import round from './math/round'; | ||
import sum from './math/sum'; | ||
@@ -8,5 +11,8 @@ | ||
'add': add, | ||
'ceil': ceil, | ||
'floor': floor, | ||
'max': max, | ||
'min': min, | ||
'round': round, | ||
'sum': sum | ||
}; |
@@ -42,9 +42,7 @@ import arraySum from '../internal/arraySum'; | ||
if (thisArg && isIterateeCall(collection, iteratee, thisArg)) { | ||
iteratee = null; | ||
iteratee = undefined; | ||
} | ||
var noIteratee = iteratee == null; | ||
iteratee = noIteratee ? iteratee : baseCallback(iteratee, thisArg, 3); | ||
return noIteratee | ||
? arraySum(isArray(collection) ? collection : toIterable(collection)) | ||
iteratee = baseCallback(iteratee, thisArg, 3); | ||
return iteratee.length == 1 | ||
? arraySum(isArray(collection) ? collection : toIterable(collection), iteratee) | ||
: baseSum(collection, iteratee); | ||
@@ -51,0 +49,0 @@ } |
@@ -38,3 +38,3 @@ /* Native method references for those with the same name as other `lodash` methods. */ | ||
start = +start || 0; | ||
if (typeof end === 'undefined') { | ||
if (end === undefined) { | ||
end = start; | ||
@@ -41,0 +41,0 @@ start = 0; |
@@ -37,3 +37,3 @@ import baseRandom from '../internal/baseRandom'; | ||
if (floating && isIterateeCall(min, max, floating)) { | ||
max = floating = null; | ||
max = floating = undefined; | ||
} | ||
@@ -40,0 +40,0 @@ var noMin = min == null, |
import assign from './object/assign'; | ||
import create from './object/create'; | ||
import defaults from './object/defaults'; | ||
import defaultsDeep from './object/defaultsDeep'; | ||
import extend from './object/extend'; | ||
@@ -34,2 +35,3 @@ import findKey from './object/findKey'; | ||
'defaults': defaults, | ||
'defaultsDeep': defaultsDeep, | ||
'extend': extend, | ||
@@ -36,0 +38,0 @@ 'findKey': findKey, |
@@ -13,3 +13,3 @@ import assignWith from '../internal/assignWith'; | ||
* **Note:** This method mutates `object` and is based on | ||
* [`Object.assign`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.assign). | ||
* [`Object.assign`](http://ecma-international.org/ecma-262/6.0/#sec-object.assign). | ||
* | ||
@@ -16,0 +16,0 @@ * @static |
@@ -42,3 +42,3 @@ import baseAssign from '../internal/baseAssign'; | ||
if (guard && isIterateeCall(prototype, properties, guard)) { | ||
properties = null; | ||
properties = undefined; | ||
} | ||
@@ -45,0 +45,0 @@ return properties ? baseAssign(result, properties) : result; |
import assign from './assign'; | ||
import assignDefaults from '../internal/assignDefaults'; | ||
import restParam from '../function/restParam'; | ||
import createDefaults from '../internal/createDefaults'; | ||
@@ -23,11 +23,4 @@ /** | ||
*/ | ||
var defaults = restParam(function(args) { | ||
var object = args[0]; | ||
if (object == null) { | ||
return object; | ||
} | ||
args.push(assignDefaults); | ||
return assign.apply(undefined, args); | ||
}); | ||
var defaults = createDefaults(assign, assignDefaults); | ||
export default defaults; |
@@ -35,3 +35,3 @@ import isIterateeCall from '../internal/isIterateeCall'; | ||
if (guard && isIterateeCall(object, multiValue, guard)) { | ||
multiValue = null; | ||
multiValue = undefined; | ||
} | ||
@@ -38,0 +38,0 @@ var index = -1, |
@@ -13,3 +13,3 @@ import getNative from '../internal/getNative'; | ||
* **Note:** Non-object values are coerced to objects. See the | ||
* [ES spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.keys) | ||
* [ES spec](http://ecma-international.org/ecma-262/6.0/#sec-object.keys) | ||
* for more details. | ||
@@ -38,3 +38,3 @@ * | ||
var keys = !nativeKeys ? shimKeys : function(object) { | ||
var Ctor = object == null ? null : object.constructor; | ||
var Ctor = object == null ? undefined : object.constructor; | ||
if ((typeof Ctor == 'function' && Ctor.prototype === object) || | ||
@@ -41,0 +41,0 @@ (typeof object != 'function' && isArrayLike(object))) { |
@@ -49,3 +49,3 @@ import arrayEach from '../internal/arrayEach'; | ||
} else { | ||
accumulator = baseCreate(isFunction(Ctor) ? Ctor.prototype : null); | ||
accumulator = baseCreate(isFunction(Ctor) ? Ctor.prototype : undefined); | ||
} | ||
@@ -52,0 +52,0 @@ } else { |
{ | ||
"name": "lodash-es", | ||
"version": "3.9.3", | ||
"version": "3.10.0", | ||
"description": "The modern build of lodash exported as ES modules.", | ||
@@ -5,0 +5,0 @@ "homepage": "https://lodash.com/custom-builds", |
@@ -1,2 +0,2 @@ | ||
# lodash-es v3.9.3 | ||
# lodash-es v3.10.0 | ||
@@ -10,2 +10,2 @@ The [modern build](https://github.com/lodash/lodash/wiki/Build-Differences) of [lodash](https://lodash.com/) exported as [ES](https://people.mozilla.org/~jorendorff/es6-draft.html) modules. | ||
See the [package source](https://github.com/lodash/lodash/tree/3.9.3-es) for more details. | ||
See the [package source](https://github.com/lodash/lodash/tree/3.10.0-es) for more details. |
import baseToString from '../internal/baseToString'; | ||
import escapeRegExpChar from '../internal/escapeRegExpChar'; | ||
/** | ||
* Used to match `RegExp` [special characters](http://www.regular-expressions.info/characters.html#special). | ||
* In addition to special characters the forward slash is escaped to allow for | ||
* easier `eval` use and `Function` compilation. | ||
* Used to match `RegExp` [syntax characters](http://ecma-international.org/ecma-262/6.0/#sec-patterns) | ||
* and those outlined by [`EscapeRegExpPattern`](http://ecma-international.org/ecma-262/6.0/#sec-escaperegexppattern). | ||
*/ | ||
var reRegExpChars = /[.*+?^${}()|[\]\/\\]/g, | ||
var reRegExpChars = /^[:!,]|[\\^$.*+?()[\]{}|\/]|(^[0-9a-fA-Fnrtuvx])|([\n\r\u2028\u2029])/g, | ||
reHasRegExpChars = RegExp(reRegExpChars.source); | ||
@@ -28,6 +28,6 @@ | ||
return (string && reHasRegExpChars.test(string)) | ||
? string.replace(reRegExpChars, '\\$&') | ||
: string; | ||
? string.replace(reRegExpChars, escapeRegExpChar) | ||
: (string || '(?:)'); | ||
} | ||
export default escapeRegExp; |
@@ -5,8 +5,6 @@ import baseToString from '../internal/baseToString'; | ||
/** Native method references. */ | ||
var ceil = Math.ceil, | ||
floor = Math.floor; | ||
/* Native method references for those with the same name as other `lodash` methods. */ | ||
var nativeIsFinite = root.isFinite; | ||
var nativeCeil = Math.ceil, | ||
nativeFloor = Math.floor, | ||
nativeIsFinite = root.isFinite; | ||
@@ -44,4 +42,4 @@ /** | ||
var mid = (length - strLength) / 2, | ||
leftLength = floor(mid), | ||
rightLength = ceil(mid); | ||
leftLength = nativeFloor(mid), | ||
rightLength = nativeCeil(mid); | ||
@@ -48,0 +46,0 @@ chars = createPadding('', rightLength, chars); |
@@ -8,14 +8,2 @@ import isIterateeCall from '../internal/isIterateeCall'; | ||
/** Used to detect and test for whitespace. */ | ||
var whitespace = ( | ||
// Basic whitespace characters. | ||
' \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' | ||
); | ||
/* Native method references for those with the same name as other `lodash` methods. */ | ||
@@ -48,23 +36,14 @@ var nativeParseInt = root.parseInt; | ||
function parseInt(string, radix, guard) { | ||
if (guard && isIterateeCall(string, radix, guard)) { | ||
// Firefox < 21 and Opera < 15 follow ES3 for `parseInt`. | ||
// Chrome fails to trim leading <BOM> whitespace characters. | ||
// See https://code.google.com/p/v8/issues/detail?id=3109 for more details. | ||
if (guard ? isIterateeCall(string, radix, guard) : radix == null) { | ||
radix = 0; | ||
} else if (radix) { | ||
radix = +radix; | ||
} | ||
return nativeParseInt(string, radix); | ||
string = trim(string); | ||
return nativeParseInt(string, radix || (reHasHexPrefix.test(string) ? 16 : 10)); | ||
} | ||
// Fallback for environments with pre-ES5 implementations. | ||
if (nativeParseInt(whitespace + '08') != 8) { | ||
parseInt = function(string, radix, guard) { | ||
// Firefox < 21 and Opera < 15 follow ES3 for `parseInt`. | ||
// Chrome fails to trim leading <BOM> whitespace characters. | ||
// See https://code.google.com/p/v8/issues/detail?id=3109 for more details. | ||
if (guard ? isIterateeCall(string, radix, guard) : radix == null) { | ||
radix = 0; | ||
} else if (radix) { | ||
radix = +radix; | ||
} | ||
string = trim(string); | ||
return nativeParseInt(string, radix || (reHasHexPrefix.test(string) ? 16 : 10)); | ||
}; | ||
} | ||
export default parseInt; |
import baseToString from '../internal/baseToString'; | ||
import root from '../internal/root'; | ||
/** Native method references. */ | ||
var floor = Math.floor; | ||
/* Native method references for those with the same name as other `lodash` methods. */ | ||
var nativeIsFinite = root.isFinite; | ||
var nativeFloor = Math.floor, | ||
nativeIsFinite = root.isFinite; | ||
@@ -43,3 +41,3 @@ /** | ||
} | ||
n = floor(n / 2); | ||
n = nativeFloor(n / 2); | ||
string += string; | ||
@@ -46,0 +44,0 @@ } while (n); |
@@ -19,3 +19,3 @@ import assignOwnDefaults from '../internal/assignOwnDefaults'; | ||
/** Used to match [ES template delimiters](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-template-literal-lexical-components). */ | ||
/** Used to match [ES template delimiters](http://ecma-international.org/ecma-262/6.0/#sec-template-literal-lexical-components). */ | ||
var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g; | ||
@@ -131,3 +131,3 @@ | ||
if (otherOptions && isIterateeCall(string, options, otherOptions)) { | ||
options = otherOptions = null; | ||
options = otherOptions = undefined; | ||
} | ||
@@ -134,0 +134,0 @@ string = baseToString(string); |
@@ -55,3 +55,3 @@ import baseToString from '../internal/baseToString'; | ||
if (guard && isIterateeCall(string, options, guard)) { | ||
options = null; | ||
options = undefined; | ||
} | ||
@@ -58,0 +58,0 @@ var length = DEFAULT_TRUNC_LENGTH, |
@@ -32,3 +32,3 @@ import baseToString from '../internal/baseToString'; | ||
if (guard && isIterateeCall(string, pattern, guard)) { | ||
pattern = null; | ||
pattern = undefined; | ||
} | ||
@@ -35,0 +35,0 @@ string = baseToString(string); |
@@ -1,6 +0,1 @@ | ||
import root from './internal/root'; | ||
/** Used to detect DOM support. */ | ||
var document = (document = root.window) ? document.document : null; | ||
/** | ||
@@ -15,23 +10,2 @@ * An object environment feature flags. | ||
(function(x) { | ||
var Ctor = function() { this.x = x; }, | ||
object = { '0': x, 'length': x }, | ||
props = []; | ||
Ctor.prototype = { 'valueOf': x, 'y': x }; | ||
for (var key in new Ctor) { props.push(key); } | ||
/** | ||
* Detect if the DOM is supported. | ||
* | ||
* @memberOf _.support | ||
* @type boolean | ||
*/ | ||
try { | ||
support.dom = document.createDocumentFragment().nodeType === 11; | ||
} catch(e) { | ||
support.dom = false; | ||
} | ||
}(1, 0)); | ||
export default support; |
@@ -46,3 +46,3 @@ import baseCallback from '../internal/baseCallback'; | ||
if (guard && isIterateeCall(func, thisArg, guard)) { | ||
thisArg = null; | ||
thisArg = undefined; | ||
} | ||
@@ -49,0 +49,0 @@ return isObjectLike(func) |
import arrayCopy from '../internal/arrayCopy'; | ||
import arrayPush from '../internal/arrayPush'; | ||
import baseFunctions from '../internal/baseFunctions'; | ||
@@ -7,8 +8,2 @@ import isFunction from '../lang/isFunction'; | ||
/** Used for native method references. */ | ||
var arrayProto = Array.prototype; | ||
/** Native method references. */ | ||
var push = arrayProto.push; | ||
/** | ||
@@ -80,5 +75,3 @@ * Adds all own enumerable function properties of a source object to the | ||
} | ||
var args = [this.value()]; | ||
push.apply(args, arguments); | ||
return func.apply(object, args); | ||
return func.apply(object, arrayPush([this.value()], arguments)); | ||
}; | ||
@@ -85,0 +78,0 @@ }(func)); |
import isIterateeCall from '../internal/isIterateeCall'; | ||
/** Native method references. */ | ||
var ceil = Math.ceil; | ||
/* Native method references for those with the same name as other `lodash` methods. */ | ||
var nativeMax = Math.max; | ||
var nativeCeil = Math.ceil, | ||
nativeMax = Math.max; | ||
@@ -44,3 +42,3 @@ /** | ||
if (step && isIterateeCall(start, end, step)) { | ||
end = step = null; | ||
end = step = undefined; | ||
} | ||
@@ -59,3 +57,3 @@ start = +start || 0; | ||
var index = -1, | ||
length = nativeMax(ceil((end - start) / (step || 1)), 0), | ||
length = nativeMax(nativeCeil((end - start) / (step || 1)), 0), | ||
result = Array(length); | ||
@@ -62,0 +60,0 @@ |
import bindCallback from '../internal/bindCallback'; | ||
import root from '../internal/root'; | ||
/** Native method references. */ | ||
var floor = Math.floor; | ||
/* Native method references for those with the same name as other `lodash` methods. */ | ||
var nativeIsFinite = root.isFinite, | ||
var nativeFloor = Math.floor, | ||
nativeIsFinite = root.isFinite, | ||
nativeMin = Math.min; | ||
@@ -42,3 +40,3 @@ | ||
function times(n, iteratee, thisArg) { | ||
n = floor(n); | ||
n = nativeFloor(n); | ||
@@ -45,0 +43,0 @@ // Exit early to avoid a JSC JIT bug in Safari 8 |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
441728
422
13546