Compare commits

..

2 Commits

Author SHA1 Message Date
John-David Dalton
6d4f76888f Bump to v4.14.1. 2016-07-28 23:40:26 -07:00
John-David Dalton
51ed7e7707 Bump to v4.14.0. 2016-07-24 09:52:22 -07:00
236 changed files with 1181 additions and 848 deletions

View File

@@ -1,4 +1,4 @@
# lodash-es v4.13.1
# lodash-es v4.14.1
The [Lodash](https://lodash.com/) library exported as [ES](http://www.ecma-international.org/ecma-262/6.0/) modules.
@@ -7,4 +7,4 @@ Generated using [lodash-cli](https://www.npmjs.com/package/lodash-cli):
$ lodash modularize exports=es -o ./
```
See the [package source](https://github.com/lodash/lodash/tree/4.13.1-es) for more details.
See the [package source](https://github.com/lodash/lodash/tree/4.14.1-es) for more details.

View File

@@ -7,7 +7,7 @@
* @returns {Object} Returns `map`.
*/
function addMapEntry(map, pair) {
// Don't return `Map#set` because it doesn't return the map instance in IE 11.
// Don't return `map.set` because it's not chainable in IE 11.
map.set(pair[0], pair[1]);
return map;
}

View File

@@ -7,6 +7,7 @@
* @returns {Object} Returns `set`.
*/
function addSetEntry(set, value) {
// Don't return `set.add` because it's not chainable in IE 11.
set.add(value);
return set;
}

View File

@@ -9,8 +9,7 @@
* @returns {*} Returns the result of `func`.
*/
function apply(func, thisArg, args) {
var length = args.length;
switch (length) {
switch (args.length) {
case 0: return func.call(thisArg);
case 1: return func.call(thisArg, args[0]);
case 2: return func.call(thisArg, args[0], args[1]);

View File

@@ -1,5 +1,5 @@
/**
* The base implementation of `_.clamp` which doesn't coerce arguments to numbers.
* The base implementation of `_.clamp` which doesn't coerce arguments.
*
* @private
* @param {number} number The number to clamp.

View File

@@ -125,12 +125,12 @@ function baseClone(value, isDeep, isFull, customizer, key, object, stack) {
if (!isArr) {
var props = isFull ? getAllKeys(value) : keys(value);
}
// Recursively populate clone (susceptible to call stack limits).
arrayEach(props || value, function(subValue, key) {
if (props) {
key = subValue;
subValue = value[key];
}
// Recursively populate clone (susceptible to call stack limits).
assignValue(result, key, baseClone(subValue, isDeep, isFull, customizer, key, value, stack));
});
return result;

View File

@@ -1,3 +1,4 @@
import baseConformsTo from './_baseConformsTo.js';
import keys from './keys.js';
/**
@@ -8,25 +9,9 @@ import keys from './keys.js';
* @returns {Function} Returns the new spec function.
*/
function baseConforms(source) {
var props = keys(source),
length = props.length;
var props = keys(source);
return function(object) {
if (object == null) {
return !length;
}
var index = length;
while (index--) {
var key = props[index],
predicate = source[key],
value = object[key];
if ((value === undefined &&
!(key in Object(object))) || !predicate(value)) {
return false;
}
}
return true;
return baseConformsTo(object, source, props);
};
}

28
_baseConformsTo.js Normal file
View File

@@ -0,0 +1,28 @@
/**
* The base implementation of `_.conformsTo` which accepts `props` to check.
*
* @private
* @param {Object} object The object to inspect.
* @param {Object} source The object of property predicates to conform to.
* @returns {boolean} Returns `true` if `object` conforms, else `false`.
*/
function baseConformsTo(object, source, props) {
var length = props.length;
if (object == null) {
return !length;
}
var index = length;
while (index--) {
var key = props[index],
predicate = source[key],
value = object[key];
if ((value === undefined &&
!(key in Object(object))) || !predicate(value)) {
return false;
}
}
return true;
}
export default baseConformsTo;

View File

@@ -2,13 +2,13 @@
var FUNC_ERROR_TEXT = 'Expected a function';
/**
* The base implementation of `_.delay` and `_.defer` which accepts an array
* of `func` arguments.
* The base implementation of `_.delay` and `_.defer` which accepts `args`
* to provide to `func`.
*
* @private
* @param {Function} func The function to delay.
* @param {number} wait The number of milliseconds to delay invocation.
* @param {Object} args The arguments to provide to `func`.
* @param {Array} args The arguments to provide to `func`.
* @returns {number} Returns the timer id.
*/
function baseDelay(func, wait, args) {

22
_baseGetTag.js Normal file
View File

@@ -0,0 +1,22 @@
/** Used for built-in method references. */
var objectProto = Object.prototype;
/**
* Used to resolve the
* [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
* of values.
*/
var objectToString = objectProto.toString;
/**
* The base implementation of `getTag`.
*
* @private
* @param {*} value The value to query.
* @returns {string} Returns the `toStringTag`.
*/
function baseGetTag(value) {
return objectToString.call(value);
}
export default baseGetTag;

View File

@@ -1,5 +1,5 @@
/**
* The base implementation of `_.gt` which doesn't coerce arguments to numbers.
* The base implementation of `_.gt` which doesn't coerce arguments.
*
* @private
* @param {*} value The value to compare.

View File

@@ -3,7 +3,7 @@ var nativeMax = Math.max,
nativeMin = Math.min;
/**
* The base implementation of `_.inRange` which doesn't coerce arguments to numbers.
* The base implementation of `_.inRange` which doesn't coerce arguments.
*
* @private
* @param {number} number The number to check.

View File

@@ -1,4 +1,5 @@
import indexOfNaN from './_indexOfNaN.js';
import baseFindIndex from './_baseFindIndex.js';
import baseIsNaN from './_baseIsNaN.js';
/**
* The base implementation of `_.indexOf` without `fromIndex` bounds checks.
@@ -11,7 +12,7 @@ import indexOfNaN from './_indexOfNaN.js';
*/
function baseIndexOf(array, value, fromIndex) {
if (value !== value) {
return indexOfNaN(array, fromIndex);
return baseFindIndex(array, baseIsNaN, fromIndex);
}
var index = fromIndex - 1,
length = array.length;

26
_baseIsArrayBuffer.js Normal file
View File

@@ -0,0 +1,26 @@
import isObjectLike from './isObjectLike.js';
var arrayBufferTag = '[object ArrayBuffer]';
/** Used for built-in method references. */
var objectProto = Object.prototype;
/**
* Used to resolve the
* [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
* of values.
*/
var objectToString = objectProto.toString;
/**
* The base implementation of `_.isArrayBuffer` without Node.js optimizations.
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is an array buffer, else `false`.
*/
function baseIsArrayBuffer(value) {
return isObjectLike(value) && objectToString.call(value) == arrayBufferTag;
}
export default baseIsArrayBuffer;

27
_baseIsDate.js Normal file
View File

@@ -0,0 +1,27 @@
import isObjectLike from './isObjectLike.js';
/** `Object#toString` result references. */
var dateTag = '[object Date]';
/** Used for built-in method references. */
var objectProto = Object.prototype;
/**
* Used to resolve the
* [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
* of values.
*/
var objectToString = objectProto.toString;
/**
* The base implementation of `_.isDate` without Node.js optimizations.
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a date object, else `false`.
*/
function baseIsDate(value) {
return isObjectLike(value) && objectToString.call(value) == dateTag;
}
export default baseIsDate;

18
_baseIsMap.js Normal file
View File

@@ -0,0 +1,18 @@
import getTag from './_getTag.js';
import isObjectLike from './isObjectLike.js';
/** `Object#toString` result references. */
var mapTag = '[object Map]';
/**
* The base implementation of `_.isMap` without Node.js optimizations.
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a map, else `false`.
*/
function baseIsMap(value) {
return isObjectLike(value) && getTag(value) == mapTag;
}
export default baseIsMap;

12
_baseIsNaN.js Normal file
View File

@@ -0,0 +1,12 @@
/**
* The base implementation of `_.isNaN` without support for number objects.
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
*/
function baseIsNaN(value) {
return value !== value;
}
export default baseIsNaN;

27
_baseIsRegExp.js Normal file
View File

@@ -0,0 +1,27 @@
import isObject from './isObject.js';
/** `Object#toString` result references. */
var regexpTag = '[object RegExp]';
/** Used for built-in method references. */
var objectProto = Object.prototype;
/**
* Used to resolve the
* [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
* of values.
*/
var objectToString = objectProto.toString;
/**
* The base implementation of `_.isRegExp` without Node.js optimizations.
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
*/
function baseIsRegExp(value) {
return isObject(value) && objectToString.call(value) == regexpTag;
}
export default baseIsRegExp;

18
_baseIsSet.js Normal file
View File

@@ -0,0 +1,18 @@
import getTag from './_getTag.js';
import isObjectLike from './isObjectLike.js';
/** `Object#toString` result references. */
var setTag = '[object Set]';
/**
* The base implementation of `_.isSet` without Node.js optimizations.
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a set, else `false`.
*/
function baseIsSet(value) {
return isObjectLike(value) && getTag(value) == setTag;
}
export default baseIsSet;

69
_baseIsTypedArray.js Normal file
View File

@@ -0,0 +1,69 @@
import isLength from './isLength.js';
import isObjectLike from './isObjectLike.js';
/** `Object#toString` result references. */
var argsTag = '[object Arguments]',
arrayTag = '[object Array]',
boolTag = '[object Boolean]',
dateTag = '[object Date]',
errorTag = '[object Error]',
funcTag = '[object Function]',
mapTag = '[object Map]',
numberTag = '[object Number]',
objectTag = '[object Object]',
regexpTag = '[object RegExp]',
setTag = '[object Set]',
stringTag = '[object String]',
weakMapTag = '[object WeakMap]';
var arrayBufferTag = '[object ArrayBuffer]',
dataViewTag = '[object DataView]',
float32Tag = '[object Float32Array]',
float64Tag = '[object Float64Array]',
int8Tag = '[object Int8Array]',
int16Tag = '[object Int16Array]',
int32Tag = '[object Int32Array]',
uint8Tag = '[object Uint8Array]',
uint8ClampedTag = '[object Uint8ClampedArray]',
uint16Tag = '[object Uint16Array]',
uint32Tag = '[object Uint32Array]';
/** Used to identify `toStringTag` values of typed arrays. */
var typedArrayTags = {};
typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
typedArrayTags[uint32Tag] = true;
typedArrayTags[argsTag] = typedArrayTags[arrayTag] =
typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
typedArrayTags[dataViewTag] = typedArrayTags[dateTag] =
typedArrayTags[errorTag] = typedArrayTags[funcTag] =
typedArrayTags[mapTag] = typedArrayTags[numberTag] =
typedArrayTags[objectTag] = typedArrayTags[regexpTag] =
typedArrayTags[setTag] = typedArrayTags[stringTag] =
typedArrayTags[weakMapTag] = false;
/** Used for built-in method references. */
var objectProto = Object.prototype;
/**
* Used to resolve the
* [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
* of values.
*/
var objectToString = objectProto.toString;
/**
* The base implementation of `_.isTypedArray` without Node.js optimizations.
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
*/
function baseIsTypedArray(value) {
return isObjectLike(value) &&
isLength(value.length) && !!typedArrayTags[objectToString.call(value)];
}
export default baseIsTypedArray;

View File

@@ -1,3 +1,5 @@
import overArg from './_overArg.js';
/* Built-in method references for those with the same name as other `lodash` methods. */
var nativeKeys = Object.keys;
@@ -9,8 +11,6 @@ var nativeKeys = Object.keys;
* @param {Object} object The object to query.
* @returns {Array} Returns the array of property names.
*/
function baseKeys(object) {
return nativeKeys(Object(object));
}
var baseKeys = overArg(nativeKeys, Object);
export default baseKeys;

View File

@@ -1,5 +1,5 @@
/**
* The base implementation of `_.lt` which doesn't coerce arguments to numbers.
* The base implementation of `_.lt` which doesn't coerce arguments.
*
* @private
* @param {*} value The value to compare.

View File

@@ -70,13 +70,12 @@ function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, sta
isCommon = false;
}
}
stack.set(srcValue, newValue);
if (isCommon) {
// Recursively merge objects and arrays (susceptible to call stack limits).
stack.set(srcValue, newValue);
mergeFunc(newValue, srcValue, srcIndex, customizer, stack);
stack['delete'](srcValue);
}
stack['delete'](srcValue);
assignMergeValue(object, key, newValue);
}

View File

@@ -1,7 +1,7 @@
import isIndex from './_isIndex.js';
/**
* The base implementation of `_.nth` which doesn't coerce `n` to an integer.
* The base implementation of `_.nth` which doesn't coerce arguments.
*
* @private
* @param {Array} array The array to query.

View File

@@ -1,4 +1,4 @@
import arrayReduce from './_arrayReduce.js';
import basePickBy from './_basePickBy.js';
/**
* The base implementation of `_.pick` without support for individual
@@ -11,12 +11,9 @@ import arrayReduce from './_arrayReduce.js';
*/
function basePick(object, props) {
object = Object(object);
return arrayReduce(props, function(result, key) {
if (key in object) {
result[key] = object[key];
}
return result;
}, {});
return basePickBy(object, props, function(value, key) {
return key in object;
});
}
export default basePick;

View File

@@ -1,16 +1,14 @@
import getAllKeysIn from './_getAllKeysIn.js';
/**
* The base implementation of `_.pickBy` without support for iteratee shorthands.
*
* @private
* @param {Object} object The source object.
* @param {string[]} props The property identifiers to pick from.
* @param {Function} predicate The function invoked per property.
* @returns {Object} Returns the new object.
*/
function basePickBy(object, predicate) {
function basePickBy(object, props, predicate) {
var index = -1,
props = getAllKeysIn(object),
length = props.length,
result = {};

14
_basePropertyOf.js Normal file
View File

@@ -0,0 +1,14 @@
/**
* The base implementation of `_.propertyOf` without support for deep paths.
*
* @private
* @param {Object} object The object to query.
* @returns {Function} Returns the new accessor function.
*/
function basePropertyOf(object) {
return function(key) {
return object == null ? undefined : object[key];
};
}
export default basePropertyOf;

View File

@@ -4,7 +4,7 @@ var nativeCeil = Math.ceil,
/**
* The base implementation of `_.range` and `_.rangeRight` which doesn't
* coerce arguments to numbers.
* coerce arguments.
*
* @private
* @param {number} start The start of the range.

35
_baseRest.js Normal file
View File

@@ -0,0 +1,35 @@
import apply from './_apply.js';
/* Built-in method references for those with the same name as other `lodash` methods. */
var nativeMax = Math.max;
/**
* The base implementation of `_.rest` which doesn't validate or coerce arguments.
*
* @private
* @param {Function} func The function to apply a rest parameter to.
* @param {number} [start=func.length-1] The start position of the rest parameter.
* @returns {Function} Returns the new function.
*/
function baseRest(func, start) {
start = nativeMax(start === undefined ? (func.length - 1) : start, 0);
return function() {
var args = arguments,
index = -1,
length = nativeMax(args.length - start, 0),
array = Array(length);
while (++index < length) {
array[index] = args[start + index];
}
index = -1;
var otherArgs = Array(start + 1);
while (++index < start) {
otherArgs[index] = args[index];
}
otherArgs[start] = array;
return apply(func, this, otherArgs);
};
}
export default baseRest;

View File

@@ -1,5 +1,5 @@
/**
* The base implementation of `_.unary` without support for storing wrapper metadata.
* The base implementation of `_.unary` without support for storing metadata.
*
* @private
* @param {Function} func The function to cap arguments for.

View File

@@ -1,12 +0,0 @@
/**
* Checks if `value` is a global object.
*
* @private
* @param {*} value The value to check.
* @returns {null|Object} Returns `value` if it's a global object, else `null`.
*/
function checkGlobal(value) {
return (value && value.Object === Object) ? value : null;
}
export default checkGlobal;

View File

@@ -21,9 +21,9 @@ function copyObject(source, props, object, customizer) {
var newValue = customizer
? customizer(object[key], source[key], key, object, source)
: source[key];
: undefined;
assignValue(object, key, newValue);
assignValue(object, key, newValue === undefined ? source[key] : newValue);
}
return object;
}

View File

@@ -16,7 +16,7 @@ function createAggregator(setter, initializer) {
var func = isArray(collection) ? arrayAggregator : baseAggregator,
accumulator = initializer ? initializer() : {};
return func(collection, setter, baseIteratee(iteratee), accumulator);
return func(collection, setter, baseIteratee(iteratee, 2), accumulator);
};
}

View File

@@ -1,5 +1,5 @@
import baseRest from './_baseRest.js';
import isIterateeCall from './_isIterateeCall.js';
import rest from './rest.js';
/**
* Creates a function like `_.assign`.
@@ -9,7 +9,7 @@ import rest from './rest.js';
* @returns {Function} Returns the new assigner function.
*/
function createAssigner(assigner) {
return rest(function(object, sources) {
return baseRest(function(object, sources) {
var index = -1,
length = sources.length,
customizer = length > 1 ? sources[length - 1] : undefined,

View File

@@ -1,7 +1,7 @@
import createCtorWrapper from './_createCtorWrapper.js';
import createCtor from './_createCtor.js';
import root from './_root.js';
/** Used to compose bitmasks for wrapper metadata. */
/** Used to compose bitmasks for function metadata. */
var BIND_FLAG = 1;
/**
@@ -10,14 +10,13 @@ var BIND_FLAG = 1;
*
* @private
* @param {Function} func The function to wrap.
* @param {number} bitmask The bitmask of wrapper flags. See `createWrapper`
* for more details.
* @param {number} bitmask The bitmask flags. See `createWrap` for more details.
* @param {*} [thisArg] The `this` binding of `func`.
* @returns {Function} Returns the new wrapped function.
*/
function createBaseWrapper(func, bitmask, thisArg) {
function createBind(func, bitmask, thisArg) {
var isBind = bitmask & BIND_FLAG,
Ctor = createCtorWrapper(func);
Ctor = createCtor(func);
function wrapper() {
var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
@@ -26,4 +25,4 @@ function createBaseWrapper(func, bitmask, thisArg) {
return wrapper;
}
export default createBaseWrapper;
export default createBind;

View File

@@ -9,7 +9,7 @@ import isObject from './isObject.js';
* @param {Function} Ctor The constructor to wrap.
* @returns {Function} Returns the new wrapped function.
*/
function createCtorWrapper(Ctor) {
function createCtor(Ctor) {
return function() {
// Use a `switch` statement to work with class constructors. See
// http://ecma-international.org/ecma-262/6.0/#sec-ecmascript-function-objects-call-thisargument-argumentslist
@@ -34,4 +34,4 @@ function createCtorWrapper(Ctor) {
};
}
export default createCtorWrapper;
export default createCtor;

View File

@@ -1,7 +1,7 @@
import apply from './_apply.js';
import createCtorWrapper from './_createCtorWrapper.js';
import createHybridWrapper from './_createHybridWrapper.js';
import createRecurryWrapper from './_createRecurryWrapper.js';
import createCtor from './_createCtor.js';
import createHybrid from './_createHybrid.js';
import createRecurry from './_createRecurry.js';
import getHolder from './_getHolder.js';
import replaceHolders from './_replaceHolders.js';
import root from './_root.js';
@@ -11,13 +11,12 @@ import root from './_root.js';
*
* @private
* @param {Function} func The function to wrap.
* @param {number} bitmask The bitmask of wrapper flags. See `createWrapper`
* for more details.
* @param {number} bitmask The bitmask flags. See `createWrap` for more details.
* @param {number} arity The arity of `func`.
* @returns {Function} Returns the new wrapped function.
*/
function createCurryWrapper(func, bitmask, arity) {
var Ctor = createCtorWrapper(func);
function createCurry(func, bitmask, arity) {
var Ctor = createCtor(func);
function wrapper() {
var length = arguments.length,
@@ -34,8 +33,8 @@ function createCurryWrapper(func, bitmask, arity) {
length -= holders.length;
if (length < arity) {
return createRecurryWrapper(
func, bitmask, createHybridWrapper, wrapper.placeholder, undefined,
return createRecurry(
func, bitmask, createHybrid, wrapper.placeholder, undefined,
args, holders, undefined, undefined, arity - length);
}
var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
@@ -44,4 +43,4 @@ function createCurryWrapper(func, bitmask, arity) {
return wrapper;
}
export default createCurryWrapper;
export default createCurry;

View File

@@ -12,18 +12,13 @@ import keys from './keys.js';
function createFind(findIndexFunc) {
return function(collection, predicate, fromIndex) {
var iterable = Object(collection);
predicate = baseIteratee(predicate, 3);
if (!isArrayLike(collection)) {
var props = keys(collection);
var iteratee = baseIteratee(predicate, 3);
collection = keys(collection);
predicate = function(key) { return iteratee(iterable[key], key, iterable); };
}
var index = findIndexFunc(props || collection, function(value, key) {
if (props) {
key = value;
value = iterable[key];
}
return predicate(value, key, iterable);
}, fromIndex);
return index > -1 ? collection[props ? props[index] : index] : undefined;
var index = findIndexFunc(collection, predicate, fromIndex);
return index > -1 ? iterable[iteratee ? collection[index] : index] : undefined;
};
}

View File

@@ -1,10 +1,10 @@
import LodashWrapper from './_LodashWrapper.js';
import baseFlatten from './_baseFlatten.js';
import baseRest from './_baseRest.js';
import getData from './_getData.js';
import getFuncName from './_getFuncName.js';
import isArray from './isArray.js';
import isLaziable from './_isLaziable.js';
import rest from './rest.js';
/** Used as the size to enable large array optimizations. */
var LARGE_ARRAY_SIZE = 200;
@@ -12,7 +12,7 @@ var LARGE_ARRAY_SIZE = 200;
/** Used as the `TypeError` message for "Functions" methods. */
var FUNC_ERROR_TEXT = 'Expected a function';
/** Used to compose bitmasks for wrapper metadata. */
/** Used to compose bitmasks for function metadata. */
var CURRY_FLAG = 8,
PARTIAL_FLAG = 32,
ARY_FLAG = 128,
@@ -26,7 +26,7 @@ var CURRY_FLAG = 8,
* @returns {Function} Returns the new flow function.
*/
function createFlow(fromRight) {
return rest(function(funcs) {
return baseRest(function(funcs) {
funcs = baseFlatten(funcs, 1);
var length = funcs.length,

View File

@@ -1,14 +1,14 @@
import composeArgs from './_composeArgs.js';
import composeArgsRight from './_composeArgsRight.js';
import countHolders from './_countHolders.js';
import createCtorWrapper from './_createCtorWrapper.js';
import createRecurryWrapper from './_createRecurryWrapper.js';
import createCtor from './_createCtor.js';
import createRecurry from './_createRecurry.js';
import getHolder from './_getHolder.js';
import reorder from './_reorder.js';
import replaceHolders from './_replaceHolders.js';
import root from './_root.js';
/** Used to compose bitmasks for wrapper metadata. */
/** Used to compose bitmasks for function metadata. */
var BIND_FLAG = 1,
BIND_KEY_FLAG = 2,
CURRY_FLAG = 8,
@@ -22,8 +22,7 @@ var BIND_FLAG = 1,
*
* @private
* @param {Function|string} func The function or method name to wrap.
* @param {number} bitmask The bitmask of wrapper flags. See `createWrapper`
* for more details.
* @param {number} bitmask The bitmask flags. See `createWrap` for more details.
* @param {*} [thisArg] The `this` binding of `func`.
* @param {Array} [partials] The arguments to prepend to those provided to
* the new function.
@@ -36,13 +35,13 @@ var BIND_FLAG = 1,
* @param {number} [arity] The arity of `func`.
* @returns {Function} Returns the new wrapped function.
*/
function createHybridWrapper(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity) {
function createHybrid(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity) {
var isAry = bitmask & ARY_FLAG,
isBind = bitmask & BIND_FLAG,
isBindKey = bitmask & BIND_KEY_FLAG,
isCurried = bitmask & (CURRY_FLAG | CURRY_RIGHT_FLAG),
isFlip = bitmask & FLIP_FLAG,
Ctor = isBindKey ? undefined : createCtorWrapper(func);
Ctor = isBindKey ? undefined : createCtor(func);
function wrapper() {
var length = arguments.length,
@@ -65,8 +64,8 @@ function createHybridWrapper(func, bitmask, thisArg, partials, holders, partials
length -= holdersCount;
if (isCurried && length < arity) {
var newHolders = replaceHolders(args, placeholder);
return createRecurryWrapper(
func, bitmask, createHybridWrapper, wrapper.placeholder, thisArg,
return createRecurry(
func, bitmask, createHybrid, wrapper.placeholder, thisArg,
args, newHolders, argPos, ary, arity - length
);
}
@@ -83,11 +82,11 @@ function createHybridWrapper(func, bitmask, thisArg, partials, holders, partials
args.length = ary;
}
if (this && this !== root && this instanceof wrapper) {
fn = Ctor || createCtorWrapper(fn);
fn = Ctor || createCtor(fn);
}
return fn.apply(thisBinding, args);
}
return wrapper;
}
export default createHybridWrapper;
export default createHybrid;

View File

@@ -6,13 +6,14 @@ import baseToString from './_baseToString.js';
*
* @private
* @param {Function} operator The function to perform the operation.
* @param {number} [defaultValue] The value used for `undefined` arguments.
* @returns {Function} Returns the new mathematical operation function.
*/
function createMathOperation(operator) {
function createMathOperation(operator, defaultValue) {
return function(value, other) {
var result;
if (value === undefined && other === undefined) {
return 0;
return defaultValue;
}
if (value !== undefined) {
result = value;

View File

@@ -2,10 +2,9 @@ import apply from './_apply.js';
import arrayMap from './_arrayMap.js';
import baseFlatten from './_baseFlatten.js';
import baseIteratee from './_baseIteratee.js';
import baseRest from './_baseRest.js';
import baseUnary from './_baseUnary.js';
import isArray from './isArray.js';
import isFlattenableIteratee from './_isFlattenableIteratee.js';
import rest from './rest.js';
/**
* Creates a function like `_.over`.
@@ -15,12 +14,12 @@ import rest from './rest.js';
* @returns {Function} Returns the new over function.
*/
function createOver(arrayFunc) {
return rest(function(iteratees) {
return baseRest(function(iteratees) {
iteratees = (iteratees.length == 1 && isArray(iteratees[0]))
? arrayMap(iteratees[0], baseUnary(baseIteratee))
: arrayMap(baseFlatten(iteratees, 1, isFlattenableIteratee), baseUnary(baseIteratee));
: arrayMap(baseFlatten(iteratees, 1), baseUnary(baseIteratee));
return rest(function(args) {
return baseRest(function(args) {
var thisArg = this;
return arrayFunc(iteratees, function(iteratee) {
return apply(iteratee, thisArg, args);

View File

@@ -1,8 +1,8 @@
import apply from './_apply.js';
import createCtorWrapper from './_createCtorWrapper.js';
import createCtor from './_createCtor.js';
import root from './_root.js';
/** Used to compose bitmasks for wrapper metadata. */
/** Used to compose bitmasks for function metadata. */
var BIND_FLAG = 1;
/**
@@ -11,16 +11,15 @@ var BIND_FLAG = 1;
*
* @private
* @param {Function} func The function to wrap.
* @param {number} bitmask The bitmask of wrapper flags. See `createWrapper`
* for more details.
* @param {number} bitmask The bitmask flags. See `createWrap` for more details.
* @param {*} thisArg The `this` binding of `func`.
* @param {Array} partials The arguments to prepend to those provided to
* the new function.
* @returns {Function} Returns the new wrapped function.
*/
function createPartialWrapper(func, bitmask, thisArg, partials) {
function createPartial(func, bitmask, thisArg, partials) {
var isBind = bitmask & BIND_FLAG,
Ctor = createCtorWrapper(func);
Ctor = createCtor(func);
function wrapper() {
var argsIndex = -1,
@@ -41,4 +40,4 @@ function createPartialWrapper(func, bitmask, thisArg, partials) {
return wrapper;
}
export default createPartialWrapper;
export default createPartial;

View File

@@ -1,6 +1,6 @@
import baseRange from './_baseRange.js';
import isIterateeCall from './_isIterateeCall.js';
import toNumber from './toNumber.js';
import toFinite from './toFinite.js';
/**
* Creates a `_.range` or `_.rangeRight` function.
@@ -15,15 +15,14 @@ function createRange(fromRight) {
end = step = undefined;
}
// Ensure the sign of `-0` is preserved.
start = toNumber(start);
start = start === start ? start : 0;
start = toFinite(start);
if (end === undefined) {
end = start;
start = 0;
} else {
end = toNumber(end) || 0;
end = toFinite(end);
}
step = step === undefined ? (start < end ? 1 : -1) : (toNumber(step) || 0);
step = step === undefined ? (start < end ? 1 : -1) : toFinite(step);
return baseRange(start, end, step, fromRight);
};
}

View File

@@ -1,7 +1,8 @@
import isLaziable from './_isLaziable.js';
import setData from './_setData.js';
import setWrapToString from './_setWrapToString.js';
/** Used to compose bitmasks for wrapper metadata. */
/** Used to compose bitmasks for function metadata. */
var BIND_FLAG = 1,
BIND_KEY_FLAG = 2,
CURRY_BOUND_FLAG = 4,
@@ -14,8 +15,7 @@ var BIND_FLAG = 1,
*
* @private
* @param {Function} func The function to wrap.
* @param {number} bitmask The bitmask of wrapper flags. See `createWrapper`
* for more details.
* @param {number} bitmask The bitmask flags. See `createWrap` for more details.
* @param {Function} wrapFunc The function to create the `func` wrapper.
* @param {*} placeholder The placeholder value.
* @param {*} [thisArg] The `this` binding of `func`.
@@ -27,7 +27,7 @@ var BIND_FLAG = 1,
* @param {number} [arity] The arity of `func`.
* @returns {Function} Returns the new wrapped function.
*/
function createRecurryWrapper(func, bitmask, wrapFunc, placeholder, thisArg, partials, holders, argPos, ary, arity) {
function createRecurry(func, bitmask, wrapFunc, placeholder, thisArg, partials, holders, argPos, ary, arity) {
var isCurry = bitmask & CURRY_FLAG,
newHolders = isCurry ? holders : undefined,
newHoldersRight = isCurry ? undefined : holders,
@@ -50,7 +50,7 @@ function createRecurryWrapper(func, bitmask, wrapFunc, placeholder, thisArg, par
setData(result, newData);
}
result.placeholder = placeholder;
return result;
return setWrapToString(result, func, bitmask);
}
export default createRecurryWrapper;
export default createRecurry;

View File

@@ -6,7 +6,7 @@ import setToArray from './_setToArray.js';
var INFINITY = 1 / 0;
/**
* Creates a set of `values`.
* Creates a set object of `values`.
*
* @private
* @param {Array} values The values to add to the set.

View File

@@ -1,17 +1,18 @@
import baseSetData from './_baseSetData.js';
import createBaseWrapper from './_createBaseWrapper.js';
import createCurryWrapper from './_createCurryWrapper.js';
import createHybridWrapper from './_createHybridWrapper.js';
import createPartialWrapper from './_createPartialWrapper.js';
import createBind from './_createBind.js';
import createCurry from './_createCurry.js';
import createHybrid from './_createHybrid.js';
import createPartial from './_createPartial.js';
import getData from './_getData.js';
import mergeData from './_mergeData.js';
import setData from './_setData.js';
import setWrapToString from './_setWrapToString.js';
import toInteger from './toInteger.js';
/** Used as the `TypeError` message for "Functions" methods. */
var FUNC_ERROR_TEXT = 'Expected a function';
/** Used to compose bitmasks for wrapper metadata. */
/** Used to compose bitmasks for function metadata. */
var BIND_FLAG = 1,
BIND_KEY_FLAG = 2,
CURRY_FLAG = 8,
@@ -28,7 +29,7 @@ var nativeMax = Math.max;
*
* @private
* @param {Function|string} func The function or method name to wrap.
* @param {number} bitmask The bitmask of wrapper flags.
* @param {number} bitmask The bitmask flags.
* The bitmask may be composed of the following flags:
* 1 - `_.bind`
* 2 - `_.bindKey`
@@ -48,7 +49,7 @@ var nativeMax = Math.max;
* @param {number} [arity] The arity of `func`.
* @returns {Function} Returns the new wrapped function.
*/
function createWrapper(func, bitmask, thisArg, partials, holders, argPos, ary, arity) {
function createWrap(func, bitmask, thisArg, partials, holders, argPos, ary, arity) {
var isBindKey = bitmask & BIND_KEY_FLAG;
if (!isBindKey && typeof func != 'function') {
throw new TypeError(FUNC_ERROR_TEXT);
@@ -91,16 +92,16 @@ function createWrapper(func, bitmask, thisArg, partials, holders, argPos, ary, a
bitmask &= ~(CURRY_FLAG | CURRY_RIGHT_FLAG);
}
if (!bitmask || bitmask == BIND_FLAG) {
var result = createBaseWrapper(func, bitmask, thisArg);
var result = createBind(func, bitmask, thisArg);
} else if (bitmask == CURRY_FLAG || bitmask == CURRY_RIGHT_FLAG) {
result = createCurryWrapper(func, bitmask, arity);
result = createCurry(func, bitmask, arity);
} else if ((bitmask == PARTIAL_FLAG || bitmask == (BIND_FLAG | PARTIAL_FLAG)) && !holders.length) {
result = createPartialWrapper(func, bitmask, thisArg, partials);
result = createPartial(func, bitmask, thisArg, partials);
} else {
result = createHybridWrapper.apply(undefined, newData);
result = createHybrid.apply(undefined, newData);
}
var setter = data ? baseSetData : setData;
return setter(result, newData);
return setWrapToString(setter(result, newData), func, bitmask);
}
export default createWrapper;
export default createWrap;

View File

@@ -1,3 +1,5 @@
import basePropertyOf from './_basePropertyOf.js';
/** Used to map latin-1 supplementary letters to basic latin letters. */
var deburredLetters = {
'\xc0': 'A', '\xc1': 'A', '\xc2': 'A', '\xc3': 'A', '\xc4': 'A', '\xc5': 'A',
@@ -26,8 +28,6 @@ var deburredLetters = {
* @param {string} letter The matched letter to deburr.
* @returns {string} Returns the deburred letter.
*/
function deburrLetter(letter) {
return deburredLetters[letter];
}
var deburrLetter = basePropertyOf(deburredLetters);
export default deburrLetter;

11
_defineProperty.js Normal file
View File

@@ -0,0 +1,11 @@
import getNative from './_getNative.js';
/* Used to set `toString` methods. */
var defineProperty = (function() {
var func = getNative(Object, 'defineProperty'),
name = getNative.name;
return (name && name.length > 2) ? func : undefined;
}());
export default defineProperty;

View File

@@ -29,7 +29,7 @@ function equalArrays(array, other, equalFunc, customizer, bitmask, stack) {
}
// Assume cyclic values are equal.
var stacked = stack.get(array);
if (stacked) {
if (stacked && stack.get(other)) {
return stacked == other;
}
var index = -1,
@@ -37,6 +37,7 @@ function equalArrays(array, other, equalFunc, customizer, bitmask, stack) {
seen = (bitmask & UNORDERED_COMPARE_FLAG) ? new SetCache : undefined;
stack.set(array, other);
stack.set(other, array);
// Ignore non-index properties.
while (++index < arrLength) {
@@ -75,6 +76,7 @@ function equalArrays(array, other, equalFunc, customizer, bitmask, stack) {
}
}
stack['delete'](array);
stack['delete'](other);
return result;
}

View File

@@ -1,5 +1,6 @@
import Symbol from './_Symbol.js';
import Uint8Array from './_Uint8Array.js';
import eq from './eq.js';
import equalArrays from './_equalArrays.js';
import mapToArray from './_mapToArray.js';
import setToArray from './_setToArray.js';
@@ -63,18 +64,14 @@ function equalByTag(object, other, tag, equalFunc, customizer, bitmask, stack) {
case boolTag:
case dateTag:
// Coerce dates and booleans to numbers, dates to milliseconds and
// booleans to `1` or `0` treating invalid dates coerced to `NaN` as
// not equal.
return +object == +other;
case numberTag:
// Coerce booleans to `1` or `0` and dates to milliseconds.
// Invalid dates are coerced to `NaN`.
return eq(+object, +other);
case errorTag:
return object.name == other.name && object.message == other.message;
case numberTag:
// Treat `NaN` vs. `NaN` as equal.
return (object != +object) ? other != +other : object == +other;
case regexpTag:
case stringTag:
// Coerce regexes to strings and treat strings, primitives and objects,
@@ -98,10 +95,12 @@ function equalByTag(object, other, tag, equalFunc, customizer, bitmask, stack) {
return stacked == other;
}
bitmask |= UNORDERED_COMPARE_FLAG;
stack.set(object, other);
// Recursively compare objects (susceptible to call stack limits).
return equalArrays(convert(object), convert(other), equalFunc, customizer, bitmask, stack);
stack.set(object, other);
var result = equalArrays(convert(object), convert(other), equalFunc, customizer, bitmask, stack);
stack['delete'](object);
return result;
case symbolTag:
if (symbolValueOf) {

View File

@@ -37,11 +37,12 @@ function equalObjects(object, other, equalFunc, customizer, bitmask, stack) {
}
// Assume cyclic values are equal.
var stacked = stack.get(object);
if (stacked) {
if (stacked && stack.get(other)) {
return stacked == other;
}
var result = true;
stack.set(object, other);
stack.set(other, object);
var skipCtor = isPartial;
while (++index < objLength) {
@@ -77,6 +78,7 @@ function equalObjects(object, other, equalFunc, customizer, bitmask, stack) {
}
}
stack['delete'](object);
stack['delete'](other);
return result;
}

View File

@@ -1,3 +1,5 @@
import basePropertyOf from './_basePropertyOf.js';
/** Used to map characters to HTML entities. */
var htmlEscapes = {
'&': '&amp;',
@@ -15,8 +17,6 @@ var htmlEscapes = {
* @param {string} chr The matched character to escape.
* @returns {string} Returns the escaped character.
*/
function escapeHtmlChar(chr) {
return htmlEscapes[chr];
}
var escapeHtmlChar = basePropertyOf(htmlEscapes);
export default escapeHtmlChar;

4
_freeGlobal.js Normal file
View File

@@ -0,0 +1,4 @@
/** Detect free variable `global` from Node.js. */
var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
export default freeGlobal;

View File

@@ -1,3 +1,5 @@
import overArg from './_overArg.js';
/* Built-in method references for those with the same name as other `lodash` methods. */
var nativeGetPrototype = Object.getPrototypeOf;
@@ -8,8 +10,6 @@ var nativeGetPrototype = Object.getPrototypeOf;
* @param {*} value The value to query.
* @returns {null|Object} Returns the `[[Prototype]]`.
*/
function getPrototype(value) {
return nativeGetPrototype(Object(value));
}
var getPrototype = overArg(nativeGetPrototype, Object);
export default getPrototype;

View File

@@ -1,7 +1,8 @@
import overArg from './_overArg.js';
import stubArray from './stubArray.js';
/** Built-in value references. */
var getOwnPropertySymbols = Object.getOwnPropertySymbols;
/* Built-in method references for those with the same name as other `lodash` methods. */
var nativeGetSymbols = Object.getOwnPropertySymbols;
/**
* Creates an array of the own enumerable symbol properties of `object`.
@@ -10,15 +11,6 @@ var getOwnPropertySymbols = Object.getOwnPropertySymbols;
* @param {Object} object The object to query.
* @returns {Array} Returns the array of symbols.
*/
function getSymbols(object) {
// Coerce `object` to an object to avoid non-object errors in V8.
// See https://bugs.chromium.org/p/v8/issues/detail?id=3443 for more details.
return getOwnPropertySymbols(Object(object));
}
// Fallback for IE < 11.
if (!getOwnPropertySymbols) {
getSymbols = stubArray;
}
var getSymbols = nativeGetSymbols ? overArg(nativeGetSymbols, Object) : stubArray;
export default getSymbols;

View File

@@ -1,9 +1,10 @@
import arrayPush from './_arrayPush.js';
import getPrototype from './_getPrototype.js';
import getSymbols from './_getSymbols.js';
import stubArray from './stubArray.js';
/** Built-in value references. */
var getOwnPropertySymbols = Object.getOwnPropertySymbols;
/* Built-in method references for those with the same name as other `lodash` methods. */
var nativeGetSymbols = Object.getOwnPropertySymbols;
/**
* Creates an array of the own and inherited enumerable symbol properties
@@ -13,7 +14,7 @@ var getOwnPropertySymbols = Object.getOwnPropertySymbols;
* @param {Object} object The object to query.
* @returns {Array} Returns the array of symbols.
*/
var getSymbolsIn = !getOwnPropertySymbols ? getSymbols : function(object) {
var getSymbolsIn = !nativeGetSymbols ? stubArray : function(object) {
var result = [];
while (object) {
arrayPush(result, getSymbols(object));

View File

@@ -3,6 +3,7 @@ import Map from './_Map.js';
import Promise from './_Promise.js';
import Set from './_Set.js';
import WeakMap from './_WeakMap.js';
import baseGetTag from './_baseGetTag.js';
import toSource from './_toSource.js';
/** `Object#toString` result references. */
@@ -38,9 +39,7 @@ var dataViewCtorString = toSource(DataView),
* @param {*} value The value to query.
* @returns {string} Returns the `toStringTag`.
*/
function getTag(value) {
return objectToString.call(value);
}
var getTag = baseGetTag;
// Fallback for data views, maps, sets, and weak maps in IE 11,
// for data views in Edge, and promises in Node.js.

17
_getWrapDetails.js Normal file
View File

@@ -0,0 +1,17 @@
/** Used to match wrap detail comments. */
var reWrapDetails = /\{\n\/\* \[wrapped with (.+)\] \*/,
reSplitDetails = /,? & /;
/**
* Extracts wrapper details from the `source` body comment.
*
* @private
* @param {string} source The source to inspect.
* @returns {Array} Returns the wrapper details.
*/
function getWrapDetails(source) {
var match = source.match(reWrapDetails);
return match ? match[1].split(reSplitDetails) : [];
}
export default getWrapDetails;

View File

@@ -1,23 +0,0 @@
/**
* Gets the index at which the first occurrence of `NaN` is found in `array`.
*
* @private
* @param {Array} array The array to search.
* @param {number} fromIndex The index to search from.
* @param {boolean} [fromRight] Specify iterating from right to left.
* @returns {number} Returns the index of the matched `NaN`, else `-1`.
*/
function indexOfNaN(array, fromIndex, fromRight) {
var length = array.length,
index = fromIndex + (fromRight ? 1 : -1);
while ((fromRight ? index-- : ++index < length)) {
var other = array[index];
if (other !== other) {
return index;
}
}
return -1;
}
export default indexOfNaN;

21
_insertWrapDetails.js Normal file
View File

@@ -0,0 +1,21 @@
/** Used to match wrap detail comments. */
var reWrapComment = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/;
/**
* Inserts wrapper `details` in a comment at the top of the `source` body.
*
* @private
* @param {string} source The source to modify.
* @returns {Array} details The details to insert.
* @returns {string} Returns the modified source.
*/
function insertWrapDetails(source, details) {
var length = details.length,
lastIndex = length - 1;
details[lastIndex] = (length > 1 ? '& ' : '') + details[lastIndex];
details = details.join(length > 2 ? ', ' : ' ');
return source.replace(reWrapComment, '{\n/* [wrapped with ' + details + '] */\n');
}
export default insertWrapDetails;

View File

@@ -1,6 +1,10 @@
import Symbol from './_Symbol.js';
import isArguments from './isArguments.js';
import isArray from './isArray.js';
/** Built-in value references. */
var spreadableSymbol = Symbol ? Symbol.isConcatSpreadable : undefined;
/**
* Checks if `value` is a flattenable `arguments` object or array.
*
@@ -9,7 +13,8 @@ import isArray from './isArray.js';
* @returns {boolean} Returns `true` if `value` is flattenable, else `false`.
*/
function isFlattenable(value) {
return isArray(value) || isArguments(value);
return isArray(value) || isArguments(value) ||
!!(spreadableSymbol && value && value[spreadableSymbol]);
}
export default isFlattenable;

View File

@@ -1,16 +0,0 @@
import isArray from './isArray.js';
import isFunction from './isFunction.js';
/**
* Checks if `value` is a flattenable array and not a `_.matchesProperty`
* iteratee shorthand.
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is flattenable, else `false`.
*/
function isFlattenableIteratee(value) {
return isArray(value) && !(value.length == 2 && !isFunction(value[0]));
}
export default isFlattenableIteratee;

View File

@@ -5,7 +5,7 @@ import replaceHolders from './_replaceHolders.js';
/** Used as the internal argument placeholder. */
var PLACEHOLDER = '__lodash_placeholder__';
/** Used to compose bitmasks for wrapper metadata. */
/** Used to compose bitmasks for function metadata. */
var BIND_FLAG = 1,
BIND_KEY_FLAG = 2,
CURRY_BOUND_FLAG = 4,

View File

@@ -16,7 +16,10 @@ import isObject from './isObject.js';
*/
function mergeDefaults(objValue, srcValue, key, object, source, stack) {
if (isObject(objValue) && isObject(srcValue)) {
baseMerge(objValue, srcValue, undefined, mergeDefaults, stack.set(srcValue, objValue));
// Recursively merge objects and arrays (susceptible to call stack limits).
stack.set(srcValue, objValue);
baseMerge(objValue, srcValue, undefined, mergeDefaults, stack);
stack['delete'](srcValue);
}
return objValue;
}

22
_nodeUtil.js Normal file
View File

@@ -0,0 +1,22 @@
import freeGlobal from './_freeGlobal.js';
/** Detect free variable `exports`. */
var freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;
/** Detect free variable `module`. */
var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;
/** Detect the popular CommonJS extension `module.exports`. */
var moduleExports = freeModule && freeModule.exports === freeExports;
/** Detect free variable `process` from Node.js. */
var freeProcess = moduleExports && freeGlobal.process;
/** Used to access faster Node.js helpers. */
var nodeUtil = (function() {
try {
return freeProcess && freeProcess.binding('util');
} catch (e) {}
}());
export default nodeUtil;

15
_overArg.js Normal file
View File

@@ -0,0 +1,15 @@
/**
* Creates a function that invokes `func` with its first argument transformed.
*
* @private
* @param {Function} func The function to wrap.
* @param {Function} transform The argument transform.
* @returns {Function} Returns the new function.
*/
function overArg(func, transform) {
return function(arg) {
return func(transform(arg));
};
}
export default overArg;

View File

@@ -1,15 +1,9 @@
import checkGlobal from './_checkGlobal.js';
/** Detect free variable `global` from Node.js. */
var freeGlobal = checkGlobal(typeof global == 'object' && global);
import freeGlobal from './_freeGlobal.js';
/** Detect free variable `self`. */
var freeSelf = checkGlobal(typeof self == 'object' && self);
/** Detect `this` as the global object. */
var thisGlobal = checkGlobal(typeof this == 'object' && this);
var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
/** Used as a reference to the global object. */
var root = freeGlobal || freeSelf || thisGlobal || Function('return this')();
var root = freeGlobal || freeSelf || Function('return this')();
export default root;

27
_setWrapToString.js Normal file
View File

@@ -0,0 +1,27 @@
import constant from './constant.js';
import defineProperty from './_defineProperty.js';
import getWrapDetails from './_getWrapDetails.js';
import identity from './identity.js';
import insertWrapDetails from './_insertWrapDetails.js';
import updateWrapDetails from './_updateWrapDetails.js';
/**
* Sets the `toString` method of `wrapper` to mimic the source of `reference`
* with wrapper details in a comment at the top of the source body.
*
* @private
* @param {Function} wrapper The function to modify.
* @param {Function} reference The reference function.
* @param {number} bitmask The bitmask flags. See `createWrap` for more details.
* @returns {Function} Returns `wrapper`.
*/
var setWrapToString = !defineProperty ? identity : function(wrapper, reference, bitmask) {
var source = (reference + '');
return defineProperty(wrapper, 'toString', {
'configurable': true,
'enumerable': false,
'value': constant(insertWrapDetails(source, updateWrapDetails(getWrapDetails(source), bitmask)))
});
};
export default setWrapToString;

View File

@@ -1,4 +1,5 @@
import ListCache from './_ListCache.js';
import Map from './_Map.js';
import MapCache from './_MapCache.js';
/** Used as the size to enable large array optimizations. */
@@ -16,8 +17,13 @@ var LARGE_ARRAY_SIZE = 200;
*/
function stackSet(key, value) {
var cache = this.__data__;
if (cache instanceof ListCache && cache.__data__.length == LARGE_ARRAY_SIZE) {
cache = this.__data__ = new MapCache(cache.__data__);
if (cache instanceof ListCache) {
var pairs = cache.__data__;
if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {
pairs.push([key, value]);
return this;
}
cache = this.__data__ = new MapCache(pairs);
}
cache.set(key, value);
return this;

View File

@@ -2,7 +2,8 @@ import memoize from './memoize.js';
import toString from './toString.js';
/** Used to match property names within property paths. */
var rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(\.|\[\])(?:\4|$))/g;
var reLeadingDot = /^\./,
rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
/** Used to match backslashes in property paths. */
var reEscapeChar = /\\(\\)?/g;
@@ -15,8 +16,13 @@ var reEscapeChar = /\\(\\)?/g;
* @returns {Array} Returns the property path array.
*/
var stringToPath = memoize(function(string) {
string = toString(string);
var result = [];
toString(string).replace(rePropName, function(match, number, quote, string) {
if (reLeadingDot.test(string)) {
result.push('');
}
string.replace(rePropName, function(match, number, quote, string) {
result.push(quote ? string.replace(reEscapeChar, '$1') : (number || match));
});
return result;

View File

@@ -1,3 +1,5 @@
import basePropertyOf from './_basePropertyOf.js';
/** Used to map HTML entities to characters. */
var htmlUnescapes = {
'&amp;': '&',
@@ -15,8 +17,6 @@ var htmlUnescapes = {
* @param {string} chr The matched character to unescape.
* @returns {string} Returns the unescaped character.
*/
function unescapeHtmlChar(chr) {
return htmlUnescapes[chr];
}
var unescapeHtmlChar = basePropertyOf(htmlUnescapes);
export default unescapeHtmlChar;

46
_updateWrapDetails.js Normal file
View File

@@ -0,0 +1,46 @@
import arrayEach from './_arrayEach.js';
import arrayIncludes from './_arrayIncludes.js';
/** Used to compose bitmasks for function metadata. */
var BIND_FLAG = 1,
BIND_KEY_FLAG = 2,
CURRY_FLAG = 8,
CURRY_RIGHT_FLAG = 16,
PARTIAL_FLAG = 32,
PARTIAL_RIGHT_FLAG = 64,
ARY_FLAG = 128,
REARG_FLAG = 256,
FLIP_FLAG = 512;
/** Used to associate wrap methods with their bit flags. */
var wrapFlags = [
['ary', ARY_FLAG],
['bind', BIND_FLAG],
['bindKey', BIND_KEY_FLAG],
['curry', CURRY_FLAG],
['curryRight', CURRY_RIGHT_FLAG],
['flip', FLIP_FLAG],
['partial', PARTIAL_FLAG],
['partialRight', PARTIAL_RIGHT_FLAG],
['rearg', REARG_FLAG]
];
/**
* Updates wrapper `details` based on `bitmask` flags.
*
* @private
* @returns {Array} details The details to modify.
* @param {number} bitmask The bitmask flags. See `createWrap` for more details.
* @returns {Array} Returns `details`.
*/
function updateWrapDetails(details, bitmask) {
arrayEach(wrapFlags, function(pair) {
var value = '_.' + pair[0];
if ((bitmask & pair[1]) && !arrayIncludes(details, value)) {
details.push(value);
}
});
return details.sort();
}
export default updateWrapDetails;

2
add.js
View File

@@ -17,6 +17,6 @@ import createMathOperation from './_createMathOperation.js';
*/
var add = createMathOperation(function(augend, addend) {
return augend + addend;
});
}, 0);
export default add;

View File

@@ -63,4 +63,4 @@ export { default as zip } from './zip.js';
export { default as zipObject } from './zipObject.js';
export { default as zipObjectDeep } from './zipObjectDeep.js';
export { default as zipWith } from './zipWith.js';
export { default as default } from './array.default';
export { default } from './array.default.js';

6
ary.js
View File

@@ -1,6 +1,6 @@
import createWrapper from './_createWrapper.js';
import createWrap from './_createWrap.js';
/** Used to compose bitmasks for wrapper metadata. */
/** Used to compose bitmasks for function metadata. */
var ARY_FLAG = 128;
/**
@@ -23,7 +23,7 @@ var ARY_FLAG = 128;
function ary(func, n, guard) {
n = guard ? undefined : n;
n = (func && n == null) ? func.length : n;
return createWrapper(func, ARY_FLAG, undefined, undefined, undefined, undefined, n);
return createWrap(func, ARY_FLAG, undefined, undefined, undefined, undefined, n);
}
export default ary;

View File

@@ -36,18 +36,18 @@ var nonEnumShadows = !propertyIsEnumerable.call({ 'valueOf': 1 }, 'valueOf');
* @example
*
* function Foo() {
* this.c = 3;
* this.a = 1;
* }
*
* function Bar() {
* this.e = 5;
* this.c = 3;
* }
*
* Foo.prototype.d = 4;
* Bar.prototype.f = 6;
* Foo.prototype.b = 2;
* Bar.prototype.d = 4;
*
* _.assign({ 'a': 1 }, new Foo, new Bar);
* // => { 'a': 1, 'c': 3, 'e': 5 }
* _.assign({ 'a': 0 }, new Foo, new Bar);
* // => { 'a': 1, 'c': 3 }
*/
var assign = createAssigner(function(object, source) {
if (nonEnumShadows || isPrototype(source) || isArrayLike(source)) {

View File

@@ -32,18 +32,18 @@ var nonEnumShadows = !propertyIsEnumerable.call({ 'valueOf': 1 }, 'valueOf');
* @example
*
* function Foo() {
* this.b = 2;
* this.a = 1;
* }
*
* function Bar() {
* this.d = 4;
* this.c = 3;
* }
*
* Foo.prototype.c = 3;
* Bar.prototype.e = 5;
* Foo.prototype.b = 2;
* Bar.prototype.d = 4;
*
* _.assignIn({ 'a': 1 }, new Foo, new Bar);
* // => { 'a': 1, 'b': 2, 'c': 3, 'd': 4, 'e': 5 }
* _.assignIn({ 'a': 0 }, new Foo, new Bar);
* // => { 'a': 1, 'b': 2, 'c': 3, 'd': 4 }
*/
var assignIn = createAssigner(function(object, source) {
if (nonEnumShadows || isPrototype(source) || isArrayLike(source)) {

4
at.js
View File

@@ -1,6 +1,6 @@
import baseAt from './_baseAt.js';
import baseFlatten from './_baseFlatten.js';
import rest from './rest.js';
import baseRest from './_baseRest.js';
/**
* Creates an array of values corresponding to `paths` of `object`.
@@ -19,7 +19,7 @@ import rest from './rest.js';
* _.at(object, ['a[0].b.c', 'a[1]']);
* // => [3, 4]
*/
var at = rest(function(object, paths) {
var at = baseRest(function(object, paths) {
return baseAt(object, baseFlatten(paths, 1));
});

View File

@@ -1,6 +1,6 @@
import apply from './_apply.js';
import baseRest from './_baseRest.js';
import isError from './isError.js';
import rest from './rest.js';
/**
* Attempts to invoke `func`, returning either the result or the caught error
@@ -24,7 +24,7 @@ import rest from './rest.js';
* elements = [];
* }
*/
var attempt = rest(function(func, args) {
var attempt = baseRest(function(func, args) {
try {
return apply(func, undefined, args);
} catch (e) {

View File

@@ -18,7 +18,7 @@ var FUNC_ERROR_TEXT = 'Expected a function';
* @example
*
* jQuery(element).on('click', _.before(5, addContactToList));
* // => allows adding up to 4 contacts to the list
* // => Allows adding up to 4 contacts to the list.
*/
function before(n, func) {
var result;

14
bind.js
View File

@@ -1,9 +1,9 @@
import createWrapper from './_createWrapper.js';
import baseRest from './_baseRest.js';
import createWrap from './_createWrap.js';
import getHolder from './_getHolder.js';
import replaceHolders from './_replaceHolders.js';
import rest from './rest.js';
/** Used to compose bitmasks for wrapper metadata. */
/** Used to compose bitmasks for function metadata. */
var BIND_FLAG = 1,
PARTIAL_FLAG = 32;
@@ -27,9 +27,9 @@ var BIND_FLAG = 1,
* @returns {Function} Returns the new bound function.
* @example
*
* var greet = function(greeting, punctuation) {
* function greet(greeting, punctuation) {
* return greeting + ' ' + this.user + punctuation;
* };
* }
*
* var object = { 'user': 'fred' };
*
@@ -42,13 +42,13 @@ var BIND_FLAG = 1,
* bound('hi');
* // => 'hi fred!'
*/
var bind = rest(function(func, thisArg, partials) {
var bind = baseRest(function(func, thisArg, partials) {
var bitmask = BIND_FLAG;
if (partials.length) {
var holders = replaceHolders(partials, getHolder(bind));
bitmask |= PARTIAL_FLAG;
}
return createWrapper(func, bitmask, thisArg, partials, holders);
return createWrap(func, bitmask, thisArg, partials, holders);
});
// Assign default placeholders.

View File

@@ -1,7 +1,7 @@
import arrayEach from './_arrayEach.js';
import baseFlatten from './_baseFlatten.js';
import baseRest from './_baseRest.js';
import bind from './bind.js';
import rest from './rest.js';
import toKey from './_toKey.js';
/**
@@ -21,16 +21,16 @@ import toKey from './_toKey.js';
*
* var view = {
* 'label': 'docs',
* 'onClick': function() {
* 'click': function() {
* console.log('clicked ' + this.label);
* }
* };
*
* _.bindAll(view, ['onClick']);
* jQuery(element).on('click', view.onClick);
* _.bindAll(view, ['click']);
* jQuery(element).on('click', view.click);
* // => Logs 'clicked docs' when clicked.
*/
var bindAll = rest(function(object, methodNames) {
var bindAll = baseRest(function(object, methodNames) {
arrayEach(baseFlatten(methodNames, 1), function(key) {
key = toKey(key);
object[key] = bind(object[key], object);

View File

@@ -1,9 +1,9 @@
import createWrapper from './_createWrapper.js';
import baseRest from './_baseRest.js';
import createWrap from './_createWrap.js';
import getHolder from './_getHolder.js';
import replaceHolders from './_replaceHolders.js';
import rest from './rest.js';
/** Used to compose bitmasks for wrapper metadata. */
/** Used to compose bitmasks for function metadata. */
var BIND_FLAG = 1,
BIND_KEY_FLAG = 2,
PARTIAL_FLAG = 32;
@@ -53,13 +53,13 @@ var BIND_FLAG = 1,
* bound('hi');
* // => 'hiya fred!'
*/
var bindKey = rest(function(object, key, partials) {
var bindKey = baseRest(function(object, key, partials) {
var bitmask = BIND_FLAG | BIND_KEY_FLAG;
if (partials.length) {
var holders = replaceHolders(partials, getHolder(bindKey));
bitmask |= PARTIAL_FLAG;
}
return createWrapper(key, bitmask, object, partials, holders);
return createWrap(key, bitmask, object, partials, holders);
});
// Assign default placeholders.

View File

@@ -1,4 +1,3 @@
import at from './at.js';
import countBy from './countBy.js';
import each from './each.js';
import eachRight from './eachRight.js';
@@ -29,10 +28,10 @@ import some from './some.js';
import sortBy from './sortBy.js';
export default {
at, countBy, each, eachRight, every,
filter, find, findLast, flatMap, flatMapDeep,
flatMapDepth, forEach, forEachRight, groupBy, includes,
invokeMap, keyBy, map, orderBy, partition,
reduce, reduceRight, reject, sample, sampleSize,
shuffle, size, some, sortBy
countBy, each, eachRight, every, filter,
find, findLast, flatMap, flatMapDeep, flatMapDepth,
forEach, forEachRight, groupBy, includes, invokeMap,
keyBy, map, orderBy, partition, reduce,
reduceRight, reject, sample, sampleSize, shuffle,
size, some, sortBy
};

View File

@@ -1,4 +1,3 @@
export { default as at } from './at.js';
export { default as countBy } from './countBy.js';
export { default as each } from './each.js';
export { default as eachRight } from './eachRight.js';
@@ -27,4 +26,4 @@ export { default as shuffle } from './shuffle.js';
export { default as size } from './size.js';
export { default as some } from './some.js';
export { default as sortBy } from './sortBy.js';
export { default as default } from './collection.default';
export { default } from './collection.default.js';

View File

@@ -1,7 +1,7 @@
import apply from './_apply.js';
import arrayMap from './_arrayMap.js';
import baseIteratee from './_baseIteratee.js';
import rest from './rest.js';
import baseRest from './_baseRest.js';
/** Used as the `TypeError` message for "Functions" methods. */
var FUNC_ERROR_TEXT = 'Expected a function';
@@ -23,7 +23,7 @@ var FUNC_ERROR_TEXT = 'Expected a function';
* var func = _.cond([
* [_.matches({ 'a': 1 }), _.constant('matches A')],
* [_.conforms({ 'b': _.isNumber }), _.constant('matches B')],
* [_.constant(true), _.constant('no match')]
* [_.stubTrue, _.constant('no match')]
* ]);
*
* func({ 'a': 1, 'b': 2 });
@@ -46,7 +46,7 @@ function cond(pairs) {
return [toIteratee(pair[0]), pair[1]];
});
return rest(function(args) {
return baseRest(function(args) {
var index = -1;
while (++index < length) {
var pair = pairs[index];

View File

@@ -6,6 +6,9 @@ import baseConforms from './_baseConforms.js';
* the corresponding property values of a given object, returning `true` if
* all predicates return truthy, else `false`.
*
* **Note:** The created function is equivalent to `_.conformsTo` with
* `source` partially applied.
*
* @static
* @memberOf _
* @since 4.0.0
@@ -14,13 +17,13 @@ import baseConforms from './_baseConforms.js';
* @returns {Function} Returns the new spec function.
* @example
*
* var users = [
* { 'user': 'barney', 'age': 36 },
* { 'user': 'fred', 'age': 40 }
* var objects = [
* { 'a': 2, 'b': 1 },
* { 'a': 1, 'b': 2 }
* ];
*
* _.filter(users, _.conforms({ 'age': function(n) { return n > 38; } }));
* // => [{ 'user': 'fred', 'age': 40 }]
* _.filter(objects, _.conforms({ 'b': function(n) { return n > 1; } }));
* // => [{ 'a': 1, 'b': 2 }]
*/
function conforms(source) {
return baseConforms(baseClone(source, true));

32
conformsTo.js Normal file
View File

@@ -0,0 +1,32 @@
import baseConformsTo from './_baseConformsTo.js';
import keys from './keys.js';
/**
* Checks if `object` conforms to `source` by invoking the predicate
* properties of `source` with the corresponding property values of `object`.
*
* **Note:** This method is equivalent to `_.conforms` when `source` is
* partially applied.
*
* @static
* @memberOf _
* @since 4.14.0
* @category Lang
* @param {Object} object The object to inspect.
* @param {Object} source The object of property predicates to conform to.
* @returns {boolean} Returns `true` if `object` conforms, else `false`.
* @example
*
* var object = { 'a': 1, 'b': 2 };
*
* _.conformsTo(object, { 'b': function(n) { return n > 1; } });
* // => true
*
* _.conformsTo(object, { 'b': function(n) { return n > 2; } });
* // => false
*/
function conformsTo(object, source) {
return source == null || baseConformsTo(object, source, keys(source));
}
export default conformsTo;

View File

@@ -17,7 +17,7 @@ var hasOwnProperty = objectProto.hasOwnProperty;
* @since 0.5.0
* @category Collection
* @param {Array|Object} collection The collection to iterate over.
* @param {Array|Function|Object|string} [iteratee=_.identity]
* @param {Function} [iteratee=_.identity]
* The iteratee to transform keys.
* @returns {Object} Returns the composed aggregate object.
* @example

View File

@@ -1,6 +1,6 @@
import createWrapper from './_createWrapper.js';
import createWrap from './_createWrap.js';
/** Used to compose bitmasks for wrapper metadata. */
/** Used to compose bitmasks for function metadata. */
var CURRY_FLAG = 8;
/**
@@ -46,7 +46,7 @@ var CURRY_FLAG = 8;
*/
function curry(func, arity, guard) {
arity = guard ? undefined : arity;
var result = createWrapper(func, CURRY_FLAG, undefined, undefined, undefined, undefined, undefined, arity);
var result = createWrap(func, CURRY_FLAG, undefined, undefined, undefined, undefined, undefined, arity);
result.placeholder = curry.placeholder;
return result;
}

View File

@@ -1,6 +1,6 @@
import createWrapper from './_createWrapper.js';
import createWrap from './_createWrap.js';
/** Used to compose bitmasks for wrapper metadata. */
/** Used to compose bitmasks for function metadata. */
var CURRY_RIGHT_FLAG = 16;
/**
@@ -43,7 +43,7 @@ var CURRY_RIGHT_FLAG = 16;
*/
function curryRight(func, arity, guard) {
arity = guard ? undefined : arity;
var result = createWrapper(func, CURRY_RIGHT_FLAG, undefined, undefined, undefined, undefined, undefined, arity);
var result = createWrap(func, CURRY_RIGHT_FLAG, undefined, undefined, undefined, undefined, undefined, arity);
result.placeholder = curryRight.placeholder;
return result;
}

View File

@@ -1,2 +1,2 @@
export { default as now } from './now.js';
export { default as default } from './date.default';
export { default } from './date.default.js';

View File

@@ -14,14 +14,18 @@ var nativeMax = Math.max,
* milliseconds have elapsed since the last time the debounced function was
* invoked. The debounced function comes with a `cancel` method to cancel
* delayed `func` invocations and a `flush` method to immediately invoke them.
* Provide an options object to indicate whether `func` should be invoked on
* the leading and/or trailing edge of the `wait` timeout. The `func` is invoked
* with the last arguments provided to the debounced function. Subsequent calls
* to the debounced function return the result of the last `func` invocation.
* Provide `options` to indicate whether `func` should be invoked on the
* leading and/or trailing edge of the `wait` timeout. The `func` is invoked
* with the last arguments provided to the debounced function. Subsequent
* calls to the debounced function return the result of the last `func`
* invocation.
*
* **Note:** If `leading` and `trailing` options are `true`, `func` is invoked
* on the trailing edge of the timeout only if the debounced function is
* invoked more than once during the `wait` timeout.
* **Note:** If `leading` and `trailing` options are `true`, `func` is
* invoked on the trailing edge of the timeout only if the debounced function
* is invoked more than once during the `wait` timeout.
*
* If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
* until to the next tick, similar to `setTimeout` with a timeout of `0`.
*
* See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
* for details over the differences between `_.debounce` and `_.throttle`.
@@ -142,6 +146,9 @@ function debounce(func, wait, options) {
}
function cancel() {
if (timerId !== undefined) {
clearTimeout(timerId);
}
lastInvokeTime = 0;
lastArgs = lastCallTime = lastThis = timerId = undefined;
}

25
defaultTo.js Normal file
View File

@@ -0,0 +1,25 @@
/**
* Checks `value` to determine whether a default value should be returned in
* its place. The `defaultValue` is returned if `value` is `NaN`, `null`,
* or `undefined`.
*
* @static
* @memberOf _
* @since 4.14.0
* @category Util
* @param {*} value The value to check.
* @param {*} defaultValue The default value.
* @returns {*} Returns the resolved value.
* @example
*
* _.defaultTo(1, 10);
* // => 1
*
* _.defaultTo(undefined, 10);
* // => 10
*/
function defaultTo(value, defaultValue) {
return (value == null || value !== value) ? defaultValue : value;
}
export default defaultTo;

View File

@@ -1,7 +1,7 @@
import apply from './_apply.js';
import assignInDefaults from './_assignInDefaults.js';
import assignInWith from './assignInWith.js';
import rest from './rest.js';
import baseRest from './_baseRest.js';
/**
* Assigns own and inherited enumerable string keyed properties of source
@@ -21,10 +21,10 @@ import rest from './rest.js';
* @see _.defaultsDeep
* @example
*
* _.defaults({ 'user': 'barney' }, { 'age': 36 }, { 'user': 'fred' });
* // => { 'user': 'barney', 'age': 36 }
* _.defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
* // => { 'a': 1, 'b': 2 }
*/
var defaults = rest(function(args) {
var defaults = baseRest(function(args) {
args.push(undefined, assignInDefaults);
return apply(assignInWith, undefined, args);
});

View File

@@ -1,7 +1,7 @@
import apply from './_apply.js';
import baseRest from './_baseRest.js';
import mergeDefaults from './_mergeDefaults.js';
import mergeWith from './mergeWith.js';
import rest from './rest.js';
/**
* This method is like `_.defaults` except that it recursively assigns
@@ -19,11 +19,10 @@ import rest from './rest.js';
* @see _.defaults
* @example
*
* _.defaultsDeep({ 'user': { 'name': 'barney' } }, { 'user': { 'name': 'fred', 'age': 36 } });
* // => { 'user': { 'name': 'barney', 'age': 36 } }
*
* _.defaultsDeep({ 'a': { 'b': 2 } }, { 'a': { 'b': 1, 'c': 3 } });
* // => { 'a': { 'b': 2, 'c': 3 } }
*/
var defaultsDeep = rest(function(args) {
var defaultsDeep = baseRest(function(args) {
args.push(undefined, mergeDefaults);
return apply(mergeWith, undefined, args);
});

View File

@@ -1,5 +1,5 @@
import baseDelay from './_baseDelay.js';
import rest from './rest.js';
import baseRest from './_baseRest.js';
/**
* Defers invoking the `func` until the current call stack has cleared. Any
@@ -19,7 +19,7 @@ import rest from './rest.js';
* }, 'deferred');
* // => Logs 'deferred' after one or more milliseconds.
*/
var defer = rest(function(func, args) {
var defer = baseRest(function(func, args) {
return baseDelay(func, 1, args);
});

View File

@@ -1,5 +1,5 @@
import baseDelay from './_baseDelay.js';
import rest from './rest.js';
import baseRest from './_baseRest.js';
import toNumber from './toNumber.js';
/**
@@ -21,7 +21,7 @@ import toNumber from './toNumber.js';
* }, 1000, 'later');
* // => Logs 'later' after one second.
*/
var delay = rest(function(func, wait, args) {
var delay = baseRest(function(func, wait, args) {
return baseDelay(func, toNumber(wait) || 0, args);
});

View File

@@ -1,14 +1,16 @@
import baseDifference from './_baseDifference.js';
import baseFlatten from './_baseFlatten.js';
import baseRest from './_baseRest.js';
import isArrayLikeObject from './isArrayLikeObject.js';
import rest from './rest.js';
/**
* Creates an array of unique `array` values not included in the other given
* arrays using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
* Creates an array of `array` values not included in the other given arrays
* using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
* for equality comparisons. The order of result values is determined by the
* order they occur in the first array.
*
* **Note:** Unlike `_.pullAll`, this method returns a new array.
*
* @static
* @memberOf _
* @since 0.1.0
@@ -22,7 +24,7 @@ import rest from './rest.js';
* _.difference([2, 1], [2, 3]);
* // => [1]
*/
var difference = rest(function(array, values) {
var difference = baseRest(function(array, values) {
return isArrayLikeObject(array)
? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true))
: [];

Some files were not shown because too many files have changed in this diff Show More