lodash3
Advanced tools
Comparing version 3.9.3 to 3.10.1
var baseSlice = require('../internal/baseSlice'), | ||
isIterateeCall = require('../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) { |
var baseDifference = require('../internal/baseDifference'), | ||
baseFlatten = require('../internal/baseFlatten'), | ||
isArrayLike = require('../internal/isArrayLike'), | ||
isObjectLike = require('../internal/isObjectLike'), | ||
restParam = require('../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 @@ : []; |
@@ -6,3 +6,3 @@ var baseFlatten = require('../internal/baseFlatten'), | ||
* Flattens a nested array. If `isDeep` is `true` the array is recursively | ||
* flattened, otherwise it is only flattened a single level. | ||
* flattened, otherwise it's only flattened a single level. | ||
* | ||
@@ -9,0 +9,0 @@ * @static |
@@ -9,4 +9,4 @@ var baseIndexOf = require('../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) | ||
* for equality comparisons. If `fromIndex` is negative, it is used as the offset | ||
* using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) | ||
* for equality comparisons. If `fromIndex` is negative, it's used as the offset | ||
* from the end of `array`. If `array` is sorted providing `true` for `fromIndex` | ||
@@ -44,6 +44,5 @@ * performs a faster binary search. | ||
} 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 @@ var baseIndexOf = require('../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 @@ var baseIndexOf = require('../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 @@ * |
@@ -6,3 +6,3 @@ var createSortedIndex = require('../internal/createSortedIndex'); | ||
* be inserted into `array` in order to maintain its sort order. If an iteratee | ||
* function is provided it is invoked for `value` and each element of `array` | ||
* function is provided it's invoked for `value` and each element of `array` | ||
* to compute their sort ranking. The iteratee is bound to `thisArg` and | ||
@@ -9,0 +9,0 @@ * invoked with one argument; (value). |
@@ -7,3 +7,3 @@ var baseFlatten = require('../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,6 +8,6 @@ var baseCallback = require('../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 | ||
* is kept. Providing `true` for `isSorted` performs a faster search algorithm | ||
* for sorted arrays. If an iteratee function is provided it is invoked for | ||
* for sorted arrays. If an iteratee function is provided it's invoked for | ||
* each element in the array to generate the criterion by which uniqueness | ||
@@ -63,3 +63,3 @@ * is computed. The `iteratee` is bound to `thisArg` and invoked with three | ||
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 @@ var baseDifference = require('../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 @@ * |
@@ -1,2 +0,3 @@ | ||
var baseDifference = require('../internal/baseDifference'), | ||
var arrayPush = require('../internal/arrayPush'), | ||
baseDifference = require('../internal/baseDifference'), | ||
baseUniq = require('../internal/baseUniq'), | ||
@@ -27,3 +28,3 @@ isArrayLike = require('../internal/isArrayLike'); | ||
var result = result | ||
? baseDifference(result, array).concat(baseDifference(array, result)) | ||
? arrayPush(baseDifference(result, array), baseDifference(array, result)) | ||
: array; | ||
@@ -30,0 +31,0 @@ } |
module.exports = { | ||
'chain': require('./chain/chain'), | ||
'commit': require('./chain/commit'), | ||
'concat': require('./chain/concat'), | ||
'lodash': require('./chain/lodash'), | ||
@@ -5,0 +6,0 @@ 'plant': require('./chain/plant'), |
@@ -17,11 +17,12 @@ var LazyWrapper = require('../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 @@ var LodashWrapper = require('../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 @@ var baseLodash = require('../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 @@ var LazyWrapper = require('../internal/LazyWrapper'), | ||
var value = this.__wrapped__; | ||
var interceptor = function(value) { | ||
return 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); | ||
} | ||
module.exports = wrapperReverse; |
@@ -58,3 +58,3 @@ var arrayEvery = require('../internal/arrayEvery'), | ||
if (thisArg && isIterateeCall(collection, predicate, thisArg)) { | ||
predicate = null; | ||
predicate = undefined; | ||
} | ||
@@ -61,0 +61,0 @@ if (typeof predicate != 'function' || thisArg !== undefined) { |
@@ -13,5 +13,5 @@ var baseIndexOf = require('../internal/baseIndexOf'), | ||
/** | ||
* Checks if `value` is in `collection` using | ||
* [`SameValueZero`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) | ||
* for equality comparisons. If `fromIndex` is negative, it is used as the offset | ||
* Checks if `target` is in `collection` using | ||
* [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) | ||
* for equality comparisons. If `fromIndex` is negative, it's used as the offset | ||
* from the end of `collection`. | ||
@@ -48,5 +48,2 @@ * | ||
} | ||
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); | ||
} | ||
module.exports = includes; |
@@ -10,3 +10,3 @@ var baseEach = require('../internal/baseEach'), | ||
* an array of the results of each invoked method. Any additional arguments | ||
* are provided to each invoked method. If `methodName` is a function it is | ||
* are provided to each invoked method. If `methodName` is a function it's | ||
* invoked for, and `this` bound to, each element in `collection`. | ||
@@ -37,3 +37,3 @@ * | ||
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); | ||
@@ -40,0 +40,0 @@ }); |
@@ -17,3 +17,4 @@ var arrayReduce = require('../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 @@ var arraySome = require('../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 @@ var baseCallback = require('../internal/baseCallback'), | ||
if (thisArg && isIterateeCall(collection, iteratee, thisArg)) { | ||
iteratee = null; | ||
iteratee = undefined; | ||
} | ||
@@ -63,0 +63,0 @@ var index = -1; |
@@ -7,5 +7,5 @@ var baseSortByOrder = require('../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)) { |
@@ -18,2 +18,3 @@ module.exports = { | ||
'memoize': require('./function/memoize'), | ||
'modArgs': require('./function/modArgs'), | ||
'negate': require('./function/negate'), | ||
@@ -20,0 +21,0 @@ 'once': require('./function/once'), |
@@ -9,3 +9,3 @@ /** Used as the `TypeError` message for "Functions" methods. */ | ||
* The opposite of `_.before`; this method creates a function that invokes | ||
* `func` once it is called `n` or more times. | ||
* `func` once it's called `n` or more times. | ||
* | ||
@@ -12,0 +12,0 @@ * @static |
@@ -28,8 +28,8 @@ var createWrapper = require('../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); | ||
} | ||
module.exports = ary; |
@@ -6,3 +6,3 @@ /** Used as the `TypeError` message for "Functions" methods. */ | ||
* Creates a function that invokes `func`, with the `this` binding and arguments | ||
* of the created function, while it is called less than `n` times. Subsequent | ||
* of the created function, while it's called less than `n` times. Subsequent | ||
* calls to the created function return the result of the last `func` invocation. | ||
@@ -37,3 +37,3 @@ * | ||
if (n <= 1) { | ||
func = null; | ||
func = undefined; | ||
} | ||
@@ -40,0 +40,0 @@ return result; |
@@ -35,3 +35,3 @@ var isObject = require('../lang/isObject'), | ||
* @param {number} [options.maxWait] The maximum time `func` is allowed to be | ||
* delayed before it is invoked. | ||
* delayed before it's invoked. | ||
* @param {boolean} [options.trailing=true] Specify invoking on the trailing | ||
@@ -94,5 +94,5 @@ * edge of the timeout. | ||
} 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; | ||
} | ||
@@ -107,20 +107,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 { | ||
@@ -132,13 +136,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); | ||
} | ||
@@ -183,3 +177,3 @@ | ||
if (isCalled && !timeoutId && !maxTimeoutId) { | ||
args = thisArg = null; | ||
args = thisArg = undefined; | ||
} | ||
@@ -186,0 +180,0 @@ return result; |
@@ -6,3 +6,3 @@ var baseDelay = require('../internal/baseDelay'), | ||
* Defers invoking the `func` until the current call stack has cleared. Any | ||
* additional arguments are provided to `func` when it is invoked. | ||
* additional arguments are provided to `func` when it's invoked. | ||
* | ||
@@ -9,0 +9,0 @@ * @static |
@@ -6,3 +6,3 @@ var baseDelay = require('../internal/baseDelay'), | ||
* Invokes `func` after `wait` milliseconds. Any additional arguments are | ||
* provided to `func` when it is invoked. | ||
* provided to `func` when it's invoked. | ||
* | ||
@@ -9,0 +9,0 @@ * @static |
@@ -16,3 +16,3 @@ var MapCache = require('../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 @@ var baseFlatten = require('../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)); | ||
}); | ||
module.exports = rearg; |
@@ -11,3 +11,3 @@ /** Used as the `TypeError` message for "Functions" methods. */ | ||
* | ||
* **Note:** This method is based on the [rest parameter](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/rest_parameters). | ||
* **Note:** This method is based on the [rest parameter](https://developer.mozilla.org/Web/JavaScript/Reference/Functions/rest_parameters). | ||
* | ||
@@ -14,0 +14,0 @@ * @static |
@@ -8,3 +8,3 @@ /** Used as the `TypeError` message for "Functions" methods. */ | ||
* | ||
* **Note:** This method is based on the [spread operator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Spread_operator). | ||
* **Note:** This method is based on the [spread operator](https://developer.mozilla.org/Web/JavaScript/Reference/Operators/Spread_operator). | ||
* | ||
@@ -11,0 +11,0 @@ * @static |
@@ -7,9 +7,2 @@ var debounce = require('./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 }); | ||
} | ||
module.exports = throttle; |
@@ -30,5 +30,5 @@ var createWrapper = require('../internal/createWrapper'), | ||
wrapper = wrapper == null ? identity : wrapper; | ||
return createWrapper(wrapper, PARTIAL_FLAG, null, [value], []); | ||
return createWrapper(wrapper, PARTIAL_FLAG, undefined, [value], []); | ||
} | ||
module.exports = 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 @@ var arrayCopy = require('./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 @@ var isObject = require('../lang/isObject'); | ||
var result = new object; | ||
object.prototype = null; | ||
object.prototype = undefined; | ||
} | ||
@@ -20,0 +20,0 @@ return result || {}; |
@@ -5,2 +5,5 @@ var baseIndexOf = require('./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 @@ |
@@ -1,2 +0,3 @@ | ||
var isArguments = require('../lang/isArguments'), | ||
var arrayPush = require('./arrayPush'), | ||
isArguments = require('../lang/isArguments'), | ||
isArray = require('../lang/isArray'), | ||
@@ -14,9 +15,10 @@ isArrayLike = require('./isArrayLike'), | ||
* @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 @@ var equalArrays = require('./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 @@ var arrayEach = require('./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 @@ var arrayCopy = require('./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)); | ||
} | ||
module.exports = 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 @@ var baseIndexOf = require('./baseIndexOf'), | ||
/** Used as the size to enable large array optimizations. */ | ||
var LARGE_ARRAY_SIZE = 200; | ||
/** | ||
@@ -13,3 +16,3 @@ * The base implementation of `_.uniq` without support for callback shorthands | ||
* @param {Function} [iteratee] The function invoked per iteration. | ||
* @returns {Array} Returns the new duplicate-value-free array. | ||
* @returns {Array} Returns the new duplicate free array. | ||
*/ | ||
@@ -21,3 +24,3 @@ function baseUniq(array, iteratee) { | ||
isCommon = true, | ||
isLarge = isCommon && length >= 200, | ||
isLarge = isCommon && length >= LARGE_ARRAY_SIZE, | ||
seen = isLarge ? createCache() : null, | ||
@@ -24,0 +27,0 @@ result = []; |
@@ -1,9 +0,4 @@ | ||
var LazyWrapper = require('./LazyWrapper'); | ||
var LazyWrapper = require('./LazyWrapper'), | ||
arrayPush = require('./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,25 +0,5 @@ | ||
var constant = require('../utility/constant'), | ||
getNative = require('./getNative'); | ||
/** Native method references. */ | ||
var ArrayBuffer = getNative(global, 'ArrayBuffer'), | ||
bufferSlice = getNative(ArrayBuffer && new ArrayBuffer(0), 'slice'), | ||
floor = Math.floor, | ||
Uint8Array = getNative(global, 'Uint8Array'); | ||
var ArrayBuffer = global.ArrayBuffer, | ||
Uint8Array = global.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(global, '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; | ||
/** | ||
@@ -33,24 +13,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; | ||
} | ||
module.exports = bufferClone; |
@@ -8,4 +8,4 @@ var baseCompareAscending = require('./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 @@ */ |
var baseCompareAscending = require('./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 @@ var baseCallback = require('./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 @@ var bindCallback = require('./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. |
var SetCache = require('./SetCache'), | ||
constant = require('../utility/constant'), | ||
getNative = require('./getNative'); | ||
@@ -18,6 +17,6 @@ | ||
*/ | ||
var createCache = !(nativeCreate && Set) ? constant(null) : function(values) { | ||
return new SetCache(values); | ||
}; | ||
function createCache(values) { | ||
return (nativeCreate && Set) ? new SetCache(values) : null; | ||
} | ||
module.exports = createCache; |
@@ -15,3 +15,3 @@ var baseCreate = require('./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 @@ var createWrapper = require('./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; |
var arrayExtremum = require('./arrayExtremum'), | ||
baseCallback = require('./baseCallback'), | ||
baseExtremum = require('./baseExtremum'), | ||
isArray = require('../lang/isArray'), | ||
isIterateeCall = require('./isIterateeCall'), | ||
@@ -18,7 +19,7 @@ toIterable = require('./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 @@ var LodashWrapper = require('./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) { |
@@ -47,3 +47,3 @@ var arrayCopy = require('./arrayCopy'), | ||
isCurryRight = bitmask & CURRY_RIGHT_FLAG, | ||
Ctor = isBindKey ? null : createCtorWrapper(func); | ||
Ctor = isBindKey ? undefined : createCtorWrapper(func); | ||
@@ -72,8 +72,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; | ||
@@ -80,0 +80,0 @@ bitmask |= (isCurry ? PARTIAL_FLAG : PARTIAL_RIGHT_FLAG); |
var repeat = require('../string/repeat'); | ||
/** Native method references. */ | ||
var ceil = Math.ceil; | ||
/* Native method references for those with the same name as other `lodash` methods. */ | ||
var nativeIsFinite = global.isFinite; | ||
var nativeCeil = Math.ceil, | ||
nativeIsFinite = global.isFinite; | ||
@@ -28,5 +26,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); | ||
} | ||
module.exports = createPadding; |
@@ -15,3 +15,3 @@ var createWrapper = require('./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; |
@@ -29,3 +29,3 @@ var createCtorWrapper = require('./createCtorWrapper'); | ||
leftLength = partials.length, | ||
args = Array(argsLength + leftLength); | ||
args = Array(leftLength + argsLength); | ||
@@ -32,0 +32,0 @@ while (++leftIndex < leftLength) { |
@@ -54,3 +54,3 @@ var baseSetData = require('./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 @@ var realNames = require('./realNames'); | ||
function getFuncName(func) { | ||
var result = func.name, | ||
var result = (func.name + ''), | ||
array = realNames[result], | ||
@@ -14,0 +14,0 @@ length = array ? array.length : 0; |
@@ -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 @@ */ |
@@ -14,7 +14,8 @@ var LazyWrapper = require('./LazyWrapper'), | ||
function isLaziable(func) { | ||
var funcName = getFuncName(func); | ||
if (!(funcName in LazyWrapper.prototype)) { | ||
var funcName = getFuncName(func), | ||
other = lodash[funcName]; | ||
if (typeof other != 'function' || !(funcName in LazyWrapper.prototype)) { | ||
return false; | ||
} | ||
var other = lodash[funcName]; | ||
if (func === other) { | ||
@@ -21,0 +22,0 @@ return true; |
/** | ||
* 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 @@ var LazyWrapper = require('./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 @@ var baseWrapperValue = require('./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(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 @@ var baseCreate = require('./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 @@ |
@@ -8,3 +8,3 @@ /** | ||
* @param {Function} [iteratee] The function invoked per iteration. | ||
* @returns {Array} Returns the new duplicate-value-free array. | ||
* @returns {Array} Returns the new duplicate free array. | ||
*/ | ||
@@ -11,0 +11,0 @@ function sortedUniq(array, iteratee) { |
@@ -7,6 +7,6 @@ var baseClone = require('../internal/baseClone'), | ||
* Creates a clone of `value`. If `isDeep` is `true` nested objects are cloned, | ||
* otherwise they are assigned by reference. If `customizer` is provided it is | ||
* otherwise they are assigned by reference. If `customizer` is provided it's | ||
* invoked to produce the cloned values. If `customizer` returns `undefined` | ||
* cloning is handled by the method instead. The `customizer` is bound to | ||
* `thisArg` and invoked with two argument; (value [, index|key, object]). | ||
* `thisArg` and invoked with up to three argument; (value [, index|key, object]). | ||
* | ||
@@ -67,3 +67,3 @@ * **Note:** This method is loosely based on the | ||
return typeof customizer == 'function' | ||
? baseClone(value, isDeep, bindCallback(customizer, thisArg, 1)) | ||
? baseClone(value, isDeep, bindCallback(customizer, thisArg, 3)) | ||
: baseClone(value, isDeep); | ||
@@ -70,0 +70,0 @@ } |
@@ -5,6 +5,6 @@ var baseClone = require('../internal/baseClone'), | ||
/** | ||
* Creates a deep clone of `value`. If `customizer` is provided it is invoked | ||
* Creates a deep clone of `value`. If `customizer` is provided it's invoked | ||
* to produce the cloned values. If `customizer` returns `undefined` cloning | ||
* is handled by the method instead. The `customizer` is bound to `thisArg` | ||
* and invoked with two argument; (value [, index|key, object]). | ||
* and invoked with up to three argument; (value [, index|key, object]). | ||
* | ||
@@ -52,3 +52,3 @@ * **Note:** This method is loosely based on the | ||
return typeof customizer == 'function' | ||
? baseClone(value, true, bindCallback(customizer, thisArg, 1)) | ||
? baseClone(value, true, bindCallback(customizer, thisArg, 3)) | ||
: baseClone(value, true); | ||
@@ -55,0 +55,0 @@ } |
var isArrayLike = require('../internal/isArrayLike'), | ||
isObjectLike = require('../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'); | ||
} | ||
module.exports = isArguments; |
@@ -12,3 +12,3 @@ var getNative = require('../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 @@ var isObjectLike = require('../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 @@ var isObjectLike = require('../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 @@ */ |
var isObjectLike = require('../internal/isObjectLike'), | ||
isPlainObject = require('./isPlainObject'), | ||
support = require('../support'); | ||
isPlainObject = require('./isPlainObject'); | ||
/** 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); | ||
}; | ||
} | ||
module.exports = isElement; |
@@ -10,3 +10,3 @@ var isArguments = require('./isArguments'), | ||
/** | ||
* Checks if `value` is empty. A value is considered empty unless it is an | ||
* Checks if `value` is empty. A value is considered empty unless it's an | ||
* `arguments` object, array, string, or jQuery-like collection with a length | ||
@@ -13,0 +13,0 @@ * greater than `0` or an object with own enumerable properties. |
@@ -6,6 +6,6 @@ var baseIsEqual = require('../internal/baseIsEqual'), | ||
* Performs a deep comparison between two values to determine if they are | ||
* equivalent. If `customizer` is provided it is invoked to compare values. | ||
* equivalent. If `customizer` is provided it's invoked to compare values. | ||
* If `customizer` returns `undefined` comparisons are handled by the method | ||
* instead. The `customizer` is bound to `thisArg` and invoked with three | ||
* arguments: (value, other [, index|key]). | ||
* instead. The `customizer` is bound to `thisArg` and invoked with up to | ||
* three arguments: (value, other [, index|key]). | ||
* | ||
@@ -12,0 +12,0 @@ * **Note:** This method supports comparing arrays, booleans, `Date` objects, |
@@ -10,3 +10,3 @@ var isObjectLike = require('../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,6 +0,3 @@ | ||
var getNative = require('../internal/getNative'); | ||
/* Native method references for those with the same name as other `lodash` methods. */ | ||
var nativeIsFinite = global.isFinite, | ||
nativeNumIsFinite = getNative(Number, 'isFinite'); | ||
var nativeIsFinite = global.isFinite; | ||
@@ -10,3 +7,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). | ||
* | ||
@@ -35,6 +32,6 @@ * @static | ||
*/ | ||
var isFinite = nativeNumIsFinite || function(value) { | ||
function isFinite(value) { | ||
return typeof value == 'number' && nativeIsFinite(value); | ||
}; | ||
} | ||
module.exports = isFinite; |
@@ -1,3 +0,2 @@ | ||
var baseIsFunction = require('../internal/baseIsFunction'), | ||
getNative = require('../internal/getNative'); | ||
var isObject = require('./isObject'); | ||
@@ -11,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. | ||
@@ -17,5 +16,2 @@ */ | ||
/** Native method references. */ | ||
var Uint8Array = getNative(global, 'Uint8Array'); | ||
/** | ||
@@ -37,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; | ||
}; | ||
// and Safari 8 which returns 'object' for typed array constructors. | ||
return isObject(value) && objToString.call(value) == funcTag; | ||
} | ||
module.exports = isFunction; |
@@ -8,3 +8,3 @@ var baseIsMatch = require('../internal/baseIsMatch'), | ||
* `object` contains equivalent property values. If `customizer` is provided | ||
* it is invoked to compare values. If `customizer` returns `undefined` | ||
* it's invoked to compare values. If `customizer` returns `undefined` | ||
* comparisons are handled by the method instead. The `customizer` is bound | ||
@@ -11,0 +11,0 @@ * to `thisArg` and invoked with three arguments: (value, other, index|key). |
@@ -1,7 +0,4 @@ | ||
var escapeRegExp = require('../string/escapeRegExp'), | ||
var isFunction = require('./isFunction'), | ||
isObjectLike = require('../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 @@ var isObjectLike = require('../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 @@ | ||
var getNative = require('../internal/getNative'), | ||
shimIsPlainObject = require('../internal/shimIsPlainObject'); | ||
var baseForIn = require('../internal/baseForIn'), | ||
isArguments = require('./isArguments'), | ||
isObjectLike = require('../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); | ||
}; | ||
module.exports = isPlainObject; |
@@ -1,2 +0,2 @@ | ||
var isObjectLike = require('../internal/isObjectLike'); | ||
var isObject = require('./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; | ||
} | ||
module.exports = isRegExp; |
@@ -10,3 +10,3 @@ var isObjectLike = require('../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 @@ var isLength = require('../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 @@ */ |
module.exports = { | ||
'add': require('./math/add'), | ||
'ceil': require('./math/ceil'), | ||
'floor': require('./math/floor'), | ||
'max': require('./math/max'), | ||
'min': require('./math/min'), | ||
'round': require('./math/round'), | ||
'sum': require('./math/sum') | ||
}; |
@@ -9,3 +9,3 @@ var createExtremum = require('../internal/createExtremum'), | ||
* Gets the maximum value of `collection`. If `collection` is empty or falsey | ||
* `-Infinity` is returned. If an iteratee function is provided it is invoked | ||
* `-Infinity` is returned. If an iteratee function is provided it's invoked | ||
* for each value in `collection` to generate the criterion by which the value | ||
@@ -12,0 +12,0 @@ * is ranked. The `iteratee` is bound to `thisArg` and invoked with three |
@@ -9,3 +9,3 @@ var createExtremum = require('../internal/createExtremum'), | ||
* Gets the minimum value of `collection`. If `collection` is empty or falsey | ||
* `Infinity` is returned. If an iteratee function is provided it is invoked | ||
* `Infinity` is returned. If an iteratee function is provided it's invoked | ||
* for each value in `collection` to generate the criterion by which the value | ||
@@ -12,0 +12,0 @@ * is ranked. The `iteratee` is bound to `thisArg` and invoked with three |
@@ -42,9 +42,7 @@ var arraySum = require('../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 @@ } |
@@ -7,3 +7,3 @@ /* Native method references for those with the same name as other `lodash` methods. */ | ||
* Checks if `n` is between `start` and up to but not including, `end`. If | ||
* `end` is not specified it is set to `start` with `start` then set to `0`. | ||
* `end` is not specified it's set to `start` with `start` then set to `0`. | ||
* | ||
@@ -39,3 +39,3 @@ * @static | ||
start = +start || 0; | ||
if (typeof end === 'undefined') { | ||
if (end === undefined) { | ||
end = start; | ||
@@ -42,0 +42,0 @@ start = 0; |
@@ -37,3 +37,3 @@ var baseRandom = require('../internal/baseRandom'), | ||
if (floating && isIterateeCall(min, max, floating)) { | ||
max = floating = null; | ||
max = floating = undefined; | ||
} | ||
@@ -40,0 +40,0 @@ var noMin = min == null, |
@@ -5,2 +5,3 @@ module.exports = { | ||
'defaults': require('./object/defaults'), | ||
'defaultsDeep': require('./object/defaultsDeep'), | ||
'extend': require('./object/extend'), | ||
@@ -7,0 +8,0 @@ 'findKey': require('./object/findKey'), |
@@ -8,3 +8,3 @@ var assignWith = require('../internal/assignWith'), | ||
* object. Subsequent sources overwrite property assignments of previous sources. | ||
* If `customizer` is provided it is invoked to produce the assigned values. | ||
* If `customizer` is provided it's invoked to produce the assigned values. | ||
* The `customizer` is bound to `thisArg` and invoked with five arguments: | ||
@@ -14,3 +14,3 @@ * (objectValue, sourceValue, key, object, source). | ||
* **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). | ||
* | ||
@@ -17,0 +17,0 @@ * @static |
@@ -42,3 +42,3 @@ var baseAssign = require('../internal/baseAssign'), | ||
if (guard && isIterateeCall(prototype, properties, guard)) { | ||
properties = null; | ||
properties = undefined; | ||
} | ||
@@ -45,0 +45,0 @@ return properties ? baseAssign(result, properties) : result; |
var assign = require('./assign'), | ||
assignDefaults = require('../internal/assignDefaults'), | ||
restParam = require('../function/restParam'); | ||
createDefaults = require('../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); | ||
module.exports = defaults; |
@@ -29,3 +29,3 @@ var baseGet = require('../internal/baseGet'), | ||
function get(object, path, defaultValue) { | ||
var result = object == null ? undefined : baseGet(object, toPath(path), path + ''); | ||
var result = object == null ? undefined : baseGet(object, toPath(path), (path + '')); | ||
return result === undefined ? defaultValue : result; | ||
@@ -32,0 +32,0 @@ } |
@@ -35,3 +35,3 @@ var isIterateeCall = require('../internal/isIterateeCall'), | ||
if (guard && isIterateeCall(object, multiValue, guard)) { | ||
multiValue = null; | ||
multiValue = undefined; | ||
} | ||
@@ -38,0 +38,0 @@ var index = -1, |
@@ -13,3 +13,3 @@ var getNative = require('../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))) { |
@@ -8,3 +8,3 @@ var baseMerge = require('../internal/baseMerge'), | ||
* overwrite property assignments of previous sources. If `customizer` is | ||
* provided it is invoked to produce the merged values of the destination and | ||
* provided it's invoked to produce the merged values of the destination and | ||
* source properties. If `customizer` returns `undefined` merging is handled | ||
@@ -11,0 +11,0 @@ * by the method instead. The `customizer` is bound to `thisArg` and invoked |
@@ -10,3 +10,3 @@ var baseFlatten = require('../internal/baseFlatten'), | ||
* names may be specified as individual arguments or as arrays of property | ||
* names. If `predicate` is provided it is invoked for each property of `object` | ||
* names. If `predicate` is provided it's invoked for each property of `object` | ||
* picking the properties `predicate` returns truthy for. The predicate is | ||
@@ -13,0 +13,0 @@ * bound to `thisArg` and invoked with three arguments: (value, key, object). |
@@ -10,3 +10,3 @@ var baseGet = require('../internal/baseGet'), | ||
* This method is like `_.get` except that if the resolved value is a function | ||
* it is invoked with the `this` binding of its parent object and its result | ||
* it's invoked with the `this` binding of its parent object and its result | ||
* is returned. | ||
@@ -13,0 +13,0 @@ * |
@@ -8,3 +8,3 @@ var isIndex = require('../internal/isIndex'), | ||
* Sets the property value of `path` on `object`. If a portion of `path` | ||
* does not exist it is created. | ||
* does not exist it's created. | ||
* | ||
@@ -11,0 +11,0 @@ * @static |
@@ -49,3 +49,3 @@ var arrayEach = require('../internal/arrayEach'), | ||
} else { | ||
accumulator = baseCreate(isFunction(Ctor) ? Ctor.prototype : null); | ||
accumulator = baseCreate(isFunction(Ctor) ? Ctor.prototype : undefined); | ||
} | ||
@@ -52,0 +52,0 @@ } else { |
{ | ||
"name": "lodash3", | ||
"version": "3.9.3", | ||
"version": "3.10.1", | ||
"description": "The modern build of lodash modular utilities.", | ||
@@ -5,0 +5,0 @@ "homepage": "https://lodash.com/", |
@@ -1,2 +0,2 @@ | ||
# lodash v3.9.3 | ||
# lodash v3.10.1 | ||
@@ -31,3 +31,3 @@ The [modern build](https://github.com/lodash/lodash/wiki/Build-Differences) of [lodash](https://lodash.com/) exported as [Node.js](http://nodejs.org/)/[io.js](https://iojs.org/) modules. | ||
See the [package source](https://github.com/lodash/lodash/tree/3.9.3-npm) for more details. | ||
See the [package source](https://github.com/lodash/lodash/tree/3.10.1-npm) for more details. | ||
@@ -43,4 +43,4 @@ **Note:**<br> | ||
* npm packages for [modern](https://www.npmjs.com/package/lodash), [compatibility](https://www.npmjs.com/package/lodash-compat), & [per method](https://www.npmjs.com/browse/keyword/lodash-modularized) builds | ||
* AMD modules for [modern](https://github.com/lodash/lodash/tree/3.9.3-amd) & [compatibility](https://github.com/lodash/lodash-compat/tree/3.9.3-amd) builds | ||
* ES modules for the [modern](https://github.com/lodash/lodash/tree/3.9.3-es) build | ||
* AMD modules for [modern](https://github.com/lodash/lodash/tree/3.10.1-amd) & [compatibility](https://github.com/lodash/lodash-compat/tree/3.10.1-amd) builds | ||
* ES modules for the [modern](https://github.com/lodash/lodash/tree/3.10.1-es) build | ||
@@ -60,4 +60,3 @@ ## Further Reading | ||
* [Lazily evaluated](http://filimanjaro.com/blog/2014/introducing-lazy-evaluation/) chaining | ||
* [_(…)](https://lodash.com/docs#_) supports intuitive chaining | ||
* [_.add](https://lodash.com/docs#add) for mathematical composition | ||
* [_(…)](https://lodash.com/docs#_) supports implicit chaining | ||
* [_.ary](https://lodash.com/docs#ary) & [_.rearg](https://lodash.com/docs#rearg) to change function argument limits & order | ||
@@ -73,2 +72,3 @@ * [_.at](https://lodash.com/docs#at) for cherry-picking collection values | ||
* [_.debounce](https://lodash.com/docs#debounce) & [_.throttle](https://lodash.com/docs#throttle) are cancelable & accept options for more control | ||
* [_.defaultsDeep](https://lodash.com/docs#defaultsDeep) for recursively assigning default properties | ||
* [_.fill](https://lodash.com/docs#fill) to fill arrays with values | ||
@@ -89,4 +89,5 @@ * [_.findKey](https://lodash.com/docs#findKey) for finding keys | ||
* [_.matchesProperty](https://lodash.com/docs#matchesProperty) to complement [_.matches](https://lodash.com/docs#matches) & [_.property](https://lodash.com/docs#property) | ||
* [_.merge](https://lodash.com/docs#merge) for a deep [_.extend](https://lodash.com/docs#extend) | ||
* [_.method](https://lodash.com/docs#method) & [_.methodOf](https://lodash.com/docs#methodOf) to create functions that invoke methods | ||
* [_.merge](https://lodash.com/docs#merge) for a deep [_.extend](https://lodash.com/docs#extend) | ||
* [_.modArgs](https://lodash.com/docs#modArgs) for more advanced functional composition | ||
* [_.parseInt](https://lodash.com/docs#parseInt) for consistent cross-environment behavior | ||
@@ -99,3 +100,2 @@ * [_.pull](https://lodash.com/docs#pull), [_.pullAt](https://lodash.com/docs#pullAt), & [_.remove](https://lodash.com/docs#remove) for mutating arrays | ||
* [_.sortByAll](https://lodash.com/docs#sortByAll) & [_.sortByOrder](https://lodash.com/docs#sortByOrder) for sorting by multiple properties & orders | ||
* [_.sum](https://lodash.com/docs#sum) to get the sum of values | ||
* [_.support](https://lodash.com/docs#support) for flagging environment features | ||
@@ -105,4 +105,6 @@ * [_.template](https://lodash.com/docs#template) supports [*“imports”*](https://lodash.com/docs#templateSettings-imports) options & [ES template delimiters](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-template-literal-lexical-components) | ||
* [_.unzipWith](https://lodash.com/docs#unzipWith) & [_.zipWith](https://lodash.com/docs#zipWith) to specify how grouped values should be combined | ||
* [_.valuesIn](https://lodash.com/docs#valuesIn) for getting values of all enumerable properties | ||
* [_.xor](https://lodash.com/docs#xor) to complement [_.difference](https://lodash.com/docs#difference), [_.intersection](https://lodash.com/docs#intersection), & [_.union](https://lodash.com/docs#union) | ||
* [_.valuesIn](https://lodash.com/docs#valuesIn) for getting values of all enumerable properties | ||
* [_.add](https://lodash.com/docs#add), [_.round](https://lodash.com/docs#round), [_.sum](https://lodash.com/docs#sum), & | ||
[more](https://lodash.com/docs "_.ceil & _.floor") math methods | ||
* [_.bind](https://lodash.com/docs#bind), [_.curry](https://lodash.com/docs#curry), [_.partial](https://lodash.com/docs#partial), & | ||
@@ -125,3 +127,3 @@ [more](https://lodash.com/docs "_.bindKey, _.curryRight, _.partialRight") support customizable argument placeholders | ||
Tested in Chrome 41-42, Firefox 37-38, IE 6-11, MS Edge, Opera 28-29, Safari 5-8, ChakraNode 0.12.2, io.js 2.1.0, Node.js 0.8.28, 0.10.38, & 0.12.4, PhantomJS 1.9.8, RingoJS 0.11, & Rhino 1.7.6. | ||
Tested in Chrome 43-44, Firefox 38-39, IE 6-11, MS Edge, Safari 5-8, ChakraNode 0.12.2, io.js 2.5.0, Node.js 0.8.28, 0.10.40, & 0.12.7, PhantomJS 1.9.8, RingoJS 0.11, & Rhino 1.7.6. | ||
Automated [browser](https://saucelabs.com/u/lodash) & [CI](https://travis-ci.org/lodash/lodash/) test runs are available. Special thanks to [Sauce Labs](https://saucelabs.com/) for providing automated browser testing. |
@@ -1,9 +0,9 @@ | ||
var baseToString = require('../internal/baseToString'); | ||
var baseToString = require('../internal/baseToString'), | ||
escapeRegExpChar = require('../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 || '(?:)'); | ||
} | ||
module.exports = escapeRegExp; |
var baseToString = require('../internal/baseToString'), | ||
createPadding = require('../internal/createPadding'); | ||
/** 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 = global.isFinite; | ||
var nativeCeil = Math.ceil, | ||
nativeFloor = Math.floor, | ||
nativeIsFinite = global.isFinite; | ||
@@ -42,4 +40,4 @@ /** | ||
var mid = (length - strLength) / 2, | ||
leftLength = floor(mid), | ||
rightLength = ceil(mid); | ||
leftLength = nativeFloor(mid), | ||
rightLength = nativeCeil(mid); | ||
@@ -46,0 +44,0 @@ chars = createPadding('', rightLength, chars); |
@@ -7,14 +7,2 @@ var isIterateeCall = require('../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. */ | ||
@@ -47,23 +35,14 @@ var nativeParseInt = global.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)); | ||
}; | ||
} | ||
module.exports = parseInt; |
var baseToString = require('../internal/baseToString'); | ||
/** Native method references. */ | ||
var floor = Math.floor; | ||
/* Native method references for those with the same name as other `lodash` methods. */ | ||
var nativeIsFinite = global.isFinite; | ||
var nativeFloor = Math.floor, | ||
nativeIsFinite = global.isFinite; | ||
@@ -42,3 +40,3 @@ /** | ||
} | ||
n = floor(n / 2); | ||
n = nativeFloor(n / 2); | ||
string += string; | ||
@@ -45,0 +43,0 @@ } while (n); |
@@ -19,3 +19,3 @@ var assignOwnDefaults = require('../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 @@ var baseToString = require('../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 @@ var baseToString = require('../internal/baseToString'), | ||
if (guard && isIterateeCall(string, pattern, guard)) { | ||
pattern = null; | ||
pattern = undefined; | ||
} | ||
@@ -35,0 +35,0 @@ string = baseToString(string); |
@@ -1,4 +0,1 @@ | ||
/** Used to detect DOM support. */ | ||
var document = (document = global.window) ? document.document : null; | ||
/** | ||
@@ -13,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)); | ||
module.exports = support; |
@@ -6,3 +6,3 @@ var isError = require('../lang/isError'), | ||
* Attempts to invoke `func`, returning either the result or the caught error | ||
* object. Any additional arguments are provided to `func` when it is invoked. | ||
* object. Any additional arguments are provided to `func` when it's invoked. | ||
* | ||
@@ -9,0 +9,0 @@ * @static |
@@ -46,3 +46,3 @@ var baseCallback = require('../internal/baseCallback'), | ||
if (guard && isIterateeCall(func, thisArg, guard)) { | ||
thisArg = null; | ||
thisArg = undefined; | ||
} | ||
@@ -49,0 +49,0 @@ return isObjectLike(func) |
var arrayCopy = require('../internal/arrayCopy'), | ||
arrayPush = require('../internal/arrayPush'), | ||
baseFunctions = require('../internal/baseFunctions'), | ||
@@ -7,8 +8,2 @@ isFunction = require('../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)); |
@@ -26,3 +26,3 @@ var baseGet = require('../internal/baseGet'), | ||
return function(path) { | ||
return baseGet(object, toPath(path), path + ''); | ||
return baseGet(object, toPath(path), (path + '')); | ||
}; | ||
@@ -29,0 +29,0 @@ } |
var isIterateeCall = require('../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; | ||
/** | ||
* Creates an array of numbers (positive and/or negative) progressing from | ||
* `start` up to, but not including, `end`. If `end` is not specified it is | ||
* `start` up to, but not including, `end`. If `end` is not specified it's | ||
* set to `start` with `start` then set to `0`. If `end` is less than `start` | ||
@@ -44,3 +42,3 @@ * a zero-length range is created unless a negative `step` is specified. | ||
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 @@ |
var bindCallback = require('../internal/bindCallback'); | ||
/** Native method references. */ | ||
var floor = Math.floor; | ||
/* Native method references for those with the same name as other `lodash` methods. */ | ||
var nativeIsFinite = global.isFinite, | ||
var nativeFloor = Math.floor, | ||
nativeIsFinite = global.isFinite, | ||
nativeMin = Math.min; | ||
@@ -41,3 +39,3 @@ | ||
function times(n, iteratee, thisArg) { | ||
n = floor(n); | ||
n = nativeFloor(n); | ||
@@ -44,0 +42,0 @@ // Exit early to avoid a JSC JIT bug in Safari 8 |
Sorry, the diff of this file is too big to display
841171
421
24377
122