Compare commits

...

2 Commits

Author SHA1 Message Date
John-David Dalton
94ba2e24e8 Bump to v4.4.0. 2016-02-15 20:25:07 -08:00
John-David Dalton
8bff780a94 Bump to v4.3.0. 2016-02-08 00:50:21 -08:00
139 changed files with 776 additions and 317 deletions

33
LICENSE
View File

@@ -1,22 +1,23 @@
The MIT License (MIT)
Copyright 2012-2016 The Dojo Foundation <http://dojofoundation.org/>
Based on Underscore.js, copyright 2009-2016 Jeremy Ashkenas,
DocumentCloud and Investigative Reporters & Editors <http://underscorejs.org/>
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@@ -1,4 +1,4 @@
# lodash-es v4.2.1
# lodash-es v4.4.0
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.2.1-es) for more details.
See the [package source](https://github.com/lodash/lodash/tree/4.4.0-es) for more details.

View File

@@ -7,6 +7,7 @@ var objectProto = Object.prototype;
* Creates an hash object.
*
* @private
* @constructor
* @returns {Object} Returns the new hash object.
*/
function Hash() {}

View File

@@ -8,6 +8,7 @@ var MAX_ARRAY_LENGTH = 4294967295;
* Creates a lazy wrapper object which wraps `value` to enable lazy evaluation.
*
* @private
* @constructor
* @param {*} value The value to wrap.
*/
function LazyWrapper(value) {

View File

@@ -8,6 +8,7 @@ import mapSet from './_mapSet';
* Creates a map cache object to store key-value pairs.
*
* @private
* @constructor
* @param {Array} [values] The values to cache.
*/
function MapCache(values) {

View File

@@ -6,6 +6,7 @@ import cachePush from './_cachePush';
* Creates a set cache object to store unique values.
*
* @private
* @constructor
* @param {Array} [values] The values to cache.
*/
function SetCache(values) {

View File

@@ -8,6 +8,7 @@ import stackSet from './_stackSet';
* Creates a stack cache object to store key-value pairs.
*
* @private
* @constructor
* @param {Array} [values] The values to cache.
*/
function Stack(values) {

View File

@@ -0,0 +1,14 @@
import isArrayLikeObject from './isArrayLikeObject';
/**
* Casts `value` to an empty array if it's not an array like object.
*
* @private
* @param {*} value The value to inspect.
* @returns {Array} Returns the array-like object.
*/
function baseCastArrayLikeObject(value) {
return isArrayLikeObject(value) ? value : [];
}
export default baseCastArrayLikeObject;

14
_baseCastFunction.js Normal file
View File

@@ -0,0 +1,14 @@
import identity from './identity';
/**
* Casts `value` to `identity` if it's not a function.
*
* @private
* @param {*} value The value to inspect.
* @returns {Array} Returns the array-like object.
*/
function baseCastFunction(value) {
return typeof value == 'function' ? value : identity;
}
export default baseCastFunction;

15
_baseCastPath.js Normal file
View File

@@ -0,0 +1,15 @@
import isArray from './isArray';
import stringToPath from './_stringToPath';
/**
* Casts `value` to a path array if it's not one.
*
* @private
* @param {*} value The value to inspect.
* @returns {Array} Returns the cast property path array.
*/
function baseCastPath(value) {
return isArray(value) ? value : stringToPath(value);
}
export default baseCastPath;

View File

@@ -3,6 +3,7 @@ import arrayEach from './_arrayEach';
import assignValue from './_assignValue';
import baseAssign from './_baseAssign';
import baseForOwn from './_baseForOwn';
import cloneBuffer from './_cloneBuffer';
import copyArray from './_copyArray';
import copySymbols from './_copySymbols';
import getTag from './_getTag';
@@ -10,6 +11,7 @@ import initCloneArray from './_initCloneArray';
import initCloneByTag from './_initCloneByTag';
import initCloneObject from './_initCloneObject';
import isArray from './isArray';
import isBuffer from './isBuffer';
import isHostObject from './_isHostObject';
import isObject from './isObject';
@@ -91,6 +93,9 @@ function baseClone(value, isDeep, customizer, key, object, stack) {
var tag = getTag(value),
isFunc = tag == funcTag || tag == genTag;
if (isBuffer(value)) {
return cloneBuffer(value, isDeep);
}
if (tag == objectTag || tag == argsTag || (isFunc && !object)) {
if (isHostObject(value)) {
return object ? value : {};

View File

@@ -1,5 +1,8 @@
import isObject from './isObject';
/** Built-in value references. */
var objectCreate = Object.create;
/**
* The base implementation of `_.create` without support for assigning
* properties to the created object.
@@ -8,16 +11,8 @@ import isObject from './isObject';
* @param {Object} prototype The object to inherit from.
* @returns {Object} Returns the new object.
*/
var baseCreate = (function() {
function object() {}
return function(prototype) {
if (isObject(prototype)) {
object.prototype = prototype;
var result = new object;
object.prototype = undefined;
}
return result || {};
};
}());
function baseCreate(proto) {
return isObject(proto) ? objectCreate(proto) : {};
}
export default baseCreate;

View File

@@ -8,7 +8,7 @@ var FUNC_ERROR_TEXT = 'Expected a function';
* @private
* @param {Function} func The function to delay.
* @param {number} wait The number of milliseconds to delay invocation.
* @param {Object} args The arguments provide to `func`.
* @param {Object} args The arguments to provide to `func`.
* @returns {number} Returns the timer id.
*/
function baseDelay(func, wait, args) {

View File

@@ -8,12 +8,12 @@ import isArrayLikeObject from './isArrayLikeObject';
*
* @private
* @param {Array} array The array to flatten.
* @param {boolean} [isDeep] Specify a deep flatten.
* @param {number} depth The maximum recursion depth.
* @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, result) {
function baseFlatten(array, depth, isStrict, result) {
result || (result = []);
var index = -1,
@@ -21,11 +21,11 @@ function baseFlatten(array, isDeep, isStrict, result) {
while (++index < length) {
var value = array[index];
if (isArrayLikeObject(value) &&
if (depth > 0 && isArrayLikeObject(value) &&
(isStrict || isArray(value) || isArguments(value))) {
if (isDeep) {
if (depth > 1) {
// Recursively flatten arrays (susceptible to call stack limits).
baseFlatten(value, isDeep, isStrict, result);
baseFlatten(value, depth - 1, isStrict, result);
} else {
arrayPush(result, value);
}

View File

@@ -3,7 +3,7 @@ import isFunction from './isFunction';
/**
* The base implementation of `_.functions` which creates an array of
* `object` function property names filtered from those provided.
* `object` function property names filtered from `props`.
*
* @private
* @param {Object} object The object to inspect.

View File

@@ -1,4 +1,4 @@
import baseToPath from './_baseToPath';
import baseCastPath from './_baseCastPath';
import isKey from './_isKey';
/**
@@ -10,7 +10,7 @@ import isKey from './_isKey';
* @returns {*} Returns the resolved value.
*/
function baseGet(object, path) {
path = isKey(path, object) ? [path + ''] : baseToPath(path);
path = isKey(path, object) ? [path + ''] : baseCastPath(path);
var index = 0,
length = path.length;

View File

@@ -42,11 +42,17 @@ function baseIntersection(arrays, iteratee, comparator) {
var value = array[index],
computed = iteratee ? iteratee(value) : value;
if (!(seen ? cacheHas(seen, computed) : includes(result, computed, comparator))) {
if (!(seen
? cacheHas(seen, computed)
: includes(result, computed, comparator)
)) {
var othIndex = othLength;
while (--othIndex) {
var cache = caches[othIndex];
if (!(cache ? cacheHas(cache, computed) : includes(arrays[othIndex], computed, comparator))) {
if (!(cache
? cacheHas(cache, computed)
: includes(arrays[othIndex], computed, comparator))
) {
continue outer;
}
}

View File

@@ -1,5 +1,5 @@
import apply from './_apply';
import baseToPath from './_baseToPath';
import baseCastPath from './_baseCastPath';
import isKey from './_isKey';
import last from './last';
import parent from './_parent';
@@ -16,7 +16,7 @@ import parent from './_parent';
*/
function baseInvoke(object, path, args) {
if (!isKey(path, object)) {
path = baseToPath(path);
path = baseCastPath(path);
object = parent(object, path);
path = last(path);
}

View File

@@ -6,7 +6,6 @@ var nativeKeys = Object.keys;
* property of prototypes or treat sparse arrays as dense.
*
* @private
* @type Function
* @param {Object} object The object to query.
* @returns {Array} Returns the array of property names.
*/

View File

@@ -21,7 +21,10 @@ function baseMerge(object, source, srcIndex, customizer, stack) {
if (object === source) {
return;
}
var props = (isArray(source) || isTypedArray(source)) ? undefined : keysIn(source);
var props = (isArray(source) || isTypedArray(source))
? undefined
: keysIn(source);
arrayEach(props || source, function(srcValue, key) {
if (props) {
key = srcValue;
@@ -32,7 +35,10 @@ function baseMerge(object, source, srcIndex, customizer, stack) {
baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);
}
else {
var newValue = customizer ? customizer(object[key], srcValue, (key + ''), object, source, stack) : undefined;
var newValue = customizer
? customizer(object[key], srcValue, (key + ''), object, source, stack)
: undefined;
if (newValue === undefined) {
newValue = srcValue;
}

View File

@@ -33,21 +33,24 @@ function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, sta
assignMergeValue(object, key, stacked);
return;
}
var newValue = customizer ? customizer(objValue, srcValue, (key + ''), object, source, stack) : undefined,
isCommon = newValue === undefined;
var newValue = customizer
? customizer(objValue, srcValue, (key + ''), object, source, stack)
: undefined;
var isCommon = newValue === undefined;
if (isCommon) {
newValue = srcValue;
if (isArray(srcValue) || isTypedArray(srcValue)) {
if (isArray(objValue)) {
newValue = srcIndex ? copyArray(objValue) : objValue;
newValue = objValue;
}
else if (isArrayLikeObject(objValue)) {
newValue = copyArray(objValue);
}
else {
isCommon = false;
newValue = baseClone(srcValue);
newValue = baseClone(srcValue, true);
}
}
else if (isPlainObject(srcValue) || isArguments(srcValue)) {
@@ -56,10 +59,10 @@ function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, sta
}
else if (!isObject(objValue) || (srcIndex && isFunction(objValue))) {
isCommon = false;
newValue = baseClone(srcValue);
newValue = baseClone(srcValue, true);
}
else {
newValue = srcIndex ? baseClone(objValue) : objValue;
newValue = objValue;
}
}
else {

View File

@@ -1,4 +1,4 @@
import baseToPath from './_baseToPath';
import baseCastPath from './_baseCastPath';
import isIndex from './_isIndex';
import isKey from './_isKey';
import last from './last';
@@ -31,7 +31,7 @@ function basePullAt(array, indexes) {
splice.call(array, index, 1);
}
else if (!isKey(index, array)) {
var path = baseToPath(index),
var path = baseCastPath(index),
object = parent(array, path);
if (object != null) {

View File

@@ -1,5 +1,5 @@
import assignValue from './_assignValue';
import baseToPath from './_baseToPath';
import baseCastPath from './_baseCastPath';
import isIndex from './_isIndex';
import isKey from './_isKey';
import isObject from './isObject';
@@ -15,7 +15,7 @@ import isObject from './isObject';
* @returns {Object} Returns `object`.
*/
function baseSet(object, path, value, customizer) {
path = isKey(path, object) ? [path + ''] : baseToPath(path);
path = isKey(path, object) ? [path + ''] : baseCastPath(path);
var index = -1,
length = path.length,
@@ -30,7 +30,9 @@ function baseSet(object, path, value, customizer) {
var objValue = nested[key];
newValue = customizer ? customizer(objValue, key, nested) : undefined;
if (newValue === undefined) {
newValue = objValue == null ? (isIndex(path[index + 1]) ? [] : {}) : objValue;
newValue = objValue == null
? (isIndex(path[index + 1]) ? [] : {})
: objValue;
}
}
assignValue(nested, key, newValue);

View File

@@ -1,16 +0,0 @@
import isArray from './isArray';
import stringToPath from './_stringToPath';
/**
* The base implementation of `_.toPath` which only converts `value` to a
* path if it's not one.
*
* @private
* @param {*} value The value to process.
* @returns {Array} Returns the property path array.
*/
function baseToPath(value) {
return isArray(value) ? value : stringToPath(value);
}
export default baseToPath;

View File

@@ -1,4 +1,4 @@
import baseToPath from './_baseToPath';
import baseCastPath from './_baseCastPath';
import has from './has';
import isKey from './_isKey';
import last from './last';
@@ -13,7 +13,7 @@ import parent from './_parent';
* @returns {boolean} Returns `true` if the property is deleted, else `false`.
*/
function baseUnset(object, path) {
path = isKey(path, object) ? [path + ''] : baseToPath(path);
path = isKey(path, object) ? [path + ''] : baseCastPath(path);
object = parent(object, path);
var key = last(path);
return (object != null && has(object, key)) ? delete object[key] : true;

19
_cloneArrayBuffer.js Normal file
View File

@@ -0,0 +1,19 @@
import Uint8Array from './_Uint8Array';
/**
* Creates a clone of `arrayBuffer`.
*
* @private
* @param {ArrayBuffer} arrayBuffer The array buffer to clone.
* @returns {ArrayBuffer} Returns the cloned array buffer.
*/
function cloneArrayBuffer(arrayBuffer) {
var Ctor = arrayBuffer.constructor,
result = new Ctor(arrayBuffer.byteLength),
view = new Uint8Array(result);
view.set(new Uint8Array(arrayBuffer));
return result;
}
export default cloneArrayBuffer;

View File

@@ -1,18 +1,19 @@
import Uint8Array from './_Uint8Array';
/**
* Creates a clone of `buffer`.
* Creates a clone of `buffer`.
*
* @private
* @param {ArrayBuffer} buffer The array buffer to clone.
* @returns {ArrayBuffer} Returns the cloned array buffer.
* @param {Buffer} buffer The buffer to clone.
* @param {boolean} [isDeep] Specify a deep clone.
* @returns {Buffer} Returns the cloned buffer.
*/
function cloneBuffer(buffer) {
function cloneBuffer(buffer, isDeep) {
if (isDeep) {
return buffer.slice();
}
var Ctor = buffer.constructor,
result = new Ctor(buffer.byteLength),
view = new Uint8Array(result);
result = new Ctor(buffer.length);
view.set(new Uint8Array(buffer));
buffer.copy(result);
return result;
}

View File

@@ -1,4 +1,4 @@
import cloneBuffer from './_cloneBuffer';
import cloneArrayBuffer from './_cloneArrayBuffer';
/**
* Creates a clone of `typedArray`.
@@ -9,10 +9,11 @@ import cloneBuffer from './_cloneBuffer';
* @returns {Object} Returns the cloned typed array.
*/
function cloneTypedArray(typedArray, isDeep) {
var buffer = typedArray.buffer,
var arrayBuffer = typedArray.buffer,
buffer = isDeep ? cloneArrayBuffer(arrayBuffer) : arrayBuffer,
Ctor = typedArray.constructor;
return new Ctor(isDeep ? cloneBuffer(buffer) : buffer, typedArray.byteOffset, typedArray.length);
return new Ctor(buffer, typedArray.byteOffset, typedArray.length);
}
export default cloneTypedArray;

View File

@@ -18,8 +18,11 @@ function copyObjectWith(source, props, object, customizer) {
length = props.length;
while (++index < length) {
var key = props[index],
newValue = customizer ? customizer(object[key], source[key], key, object, source) : source[key];
var key = props[index];
var newValue = customizer
? customizer(object[key], source[key], key, object, source)
: source[key];
assignValue(object, key, newValue);
}

View File

@@ -15,7 +15,10 @@ function createAssigner(assigner) {
customizer = length > 1 ? sources[length - 1] : undefined,
guard = length > 2 ? sources[2] : undefined;
customizer = typeof customizer == 'function' ? (length--, customizer) : undefined;
customizer = typeof customizer == 'function'
? (length--, customizer)
: undefined;
if (guard && isIterateeCall(sources[0], sources[1], guard)) {
customizer = length < 3 ? undefined : customizer;
length = 1;

View File

@@ -24,8 +24,11 @@ function createCaseFirst(methodName) {
return function(string) {
string = toString(string);
var strSymbols = reHasComplexSymbol.test(string) ? stringToArray(string) : undefined,
chr = strSymbols ? strSymbols[0] : string.charAt(0),
var strSymbols = reHasComplexSymbol.test(string)
? stringToArray(string)
: undefined;
var chr = strSymbols ? strSymbols[0] : string.charAt(0),
trailing = strSymbols ? strSymbols.slice(1).join('') : string.slice(1);
return chr[methodName]() + trailing;

View File

@@ -27,7 +27,7 @@ var FUNC_ERROR_TEXT = 'Expected a function';
*/
function createFlow(fromRight) {
return rest(function(funcs) {
funcs = baseFlatten(funcs);
funcs = baseFlatten(funcs, 1);
var length = funcs.length,
index = length,
@@ -52,7 +52,10 @@ function createFlow(fromRight) {
var funcName = getFuncName(func),
data = funcName == 'wrapper' ? getData(func) : undefined;
if (data && isLaziable(data[0]) && data[1] == (ARY_FLAG | CURRY_FLAG | PARTIAL_FLAG | REARG_FLAG) && !data[4].length && data[9] == 1) {
if (data && isLaziable(data[0]) &&
data[1] == (ARY_FLAG | CURRY_FLAG | PARTIAL_FLAG | REARG_FLAG) &&
!data[4].length && data[9] == 1
) {
wrapper = wrapper[getFuncName(data[0])].apply(wrapper, data[3]);
} else {
wrapper = (func.length == 1 && isLaziable(func)) ? wrapper[funcName]() : wrapper.thru(func);
@@ -62,7 +65,8 @@ function createFlow(fromRight) {
var args = arguments,
value = args[0];
if (wrapper && args.length == 1 && isArray(value) && value.length >= LARGE_ARRAY_SIZE) {
if (wrapper && args.length == 1 &&
isArray(value) && value.length >= LARGE_ARRAY_SIZE) {
return wrapper.plant(value).value();
}
var index = 0,

View File

@@ -60,7 +60,10 @@ function createHybridWrapper(func, bitmask, thisArg, partials, holders, partials
length -= argsHolders.length;
if (length < arity) {
return createRecurryWrapper(func, bitmask, createHybridWrapper, placeholder, thisArg, args, argsHolders, argPos, ary, arity - length);
return createRecurryWrapper(
func, bitmask, createHybridWrapper, placeholder, thisArg, args,
argsHolders, argPos, ary, arity - length
);
}
}
var thisBinding = isBind ? thisArg : this,

View File

@@ -13,7 +13,7 @@ import rest from './rest';
*/
function createOver(arrayFunc) {
return rest(function(iteratees) {
iteratees = arrayMap(baseFlatten(iteratees), baseIteratee);
iteratees = arrayMap(baseFlatten(iteratees, 1), baseIteratee);
return rest(function(args) {
var thisArg = this;
return arrayFunc(iteratees, function(iteratee) {

View File

@@ -40,9 +40,12 @@ function createRecurryWrapper(func, bitmask, wrapFunc, placeholder, thisArg, par
if (!(bitmask & CURRY_BOUND_FLAG)) {
bitmask &= ~(BIND_FLAG | BIND_KEY_FLAG);
}
var newData = [func, bitmask, thisArg, newPartials, newsHolders, newPartialsRight, newHoldersRight, newArgPos, ary, arity],
result = wrapFunc.apply(undefined, newData);
var newData = [
func, bitmask, thisArg, newPartials, newsHolders, newPartialsRight,
newHoldersRight, newArgPos, ary, arity
];
var result = wrapFunc.apply(undefined, newData);
if (isLaziable(func)) {
setData(result, newData);
}

View File

@@ -67,8 +67,12 @@ function createWrapper(func, bitmask, thisArg, partials, holders, argPos, ary, a
partials = holders = undefined;
}
var data = isBindKey ? undefined : getData(func),
newData = [func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity];
var data = isBindKey ? undefined : getData(func);
var newData = [
func, bitmask, thisArg, partials, holders, partialsRight, holdersRight,
argPos, ary, arity
];
if (data) {
mergeData(newData, data);

View File

@@ -1,10 +1,12 @@
import Map from './_Map';
import Set from './_Set';
import WeakMap from './_WeakMap';
/** `Object#toString` result references. */
var mapTag = '[object Map]',
objectTag = '[object Object]',
setTag = '[object Set]';
setTag = '[object Set]',
weakMapTag = '[object WeakMap]';
/** Used for built-in method references. */
var objectProto = Object.prototype;
@@ -18,9 +20,10 @@ var funcToString = Function.prototype.toString;
*/
var objectToString = objectProto.toString;
/** Used to detect maps and sets. */
/** Used to detect maps, sets, and weakmaps. */
var mapCtorString = Map ? funcToString.call(Map) : '',
setCtorString = Set ? funcToString.call(Set) : '';
setCtorString = Set ? funcToString.call(Set) : '',
weakMapCtorString = WeakMap ? funcToString.call(WeakMap) : '';
/**
* Gets the `toStringTag` of `value`.
@@ -33,19 +36,20 @@ function getTag(value) {
return objectToString.call(value);
}
// Fallback for IE 11 providing `toStringTag` values for maps and sets.
if ((Map && getTag(new Map) != mapTag) || (Set && getTag(new Set) != setTag)) {
// Fallback for IE 11 providing `toStringTag` values for maps, sets, and weakmaps.
if ((Map && getTag(new Map) != mapTag) ||
(Set && getTag(new Set) != setTag) ||
(WeakMap && getTag(new WeakMap) != weakMapTag)) {
getTag = function(value) {
var result = objectToString.call(value),
Ctor = result == objectTag ? value.constructor : null,
ctorString = typeof Ctor == 'function' ? funcToString.call(Ctor) : '';
if (ctorString) {
if (ctorString == mapCtorString) {
return mapTag;
}
if (ctorString == setCtorString) {
return setTag;
switch (ctorString) {
case mapCtorString: return mapTag;
case setCtorString: return setTag;
case weakMapCtorString: return weakMapTag;
}
}
return result;

View File

@@ -1,4 +1,4 @@
import baseToPath from './_baseToPath';
import baseCastPath from './_baseCastPath';
import isArguments from './isArguments';
import isArray from './isArray';
import isIndex from './_isIndex';
@@ -23,7 +23,7 @@ function hasPath(object, path, hasFunc) {
}
var result = hasFunc(object, path);
if (!result && !isKey(path)) {
path = baseToPath(path);
path = baseCastPath(path);
object = parent(object, path);
if (object != null) {
path = last(path);

View File

@@ -1,4 +1,4 @@
import cloneBuffer from './_cloneBuffer';
import cloneArrayBuffer from './_cloneArrayBuffer';
import cloneMap from './_cloneMap';
import cloneRegExp from './_cloneRegExp';
import cloneSet from './_cloneSet';
@@ -42,7 +42,7 @@ function initCloneByTag(object, tag, isDeep) {
var Ctor = object.constructor;
switch (tag) {
case arrayBufferTag:
return cloneBuffer(object);
return cloneArrayBuffer(object);
case boolTag:
case dateTag:

View File

@@ -4,7 +4,7 @@ import isIndex from './_isIndex';
import isObject from './isObject';
/**
* Checks if the provided arguments are from an iteratee call.
* Checks if the given arguments are from an iteratee call.
*
* @private
* @param {*} value The potential iteratee value argument.

View File

@@ -8,7 +8,7 @@
function isKeyable(value) {
var type = typeof value;
return type == 'number' || type == 'boolean' ||
(type == 'string' && value !== '__proto__') || value == null;
(type == 'string' && value != '__proto__') || value == null;
}
export default isKeyable;

View File

@@ -36,7 +36,8 @@ function lazyValue() {
resIndex = 0,
takeCount = nativeMin(length, this.__takeCount__);
if (!isArr || arrLength < LARGE_ARRAY_SIZE || (arrLength == length && takeCount == length)) {
if (!isArr || arrLength < LARGE_ARRAY_SIZE ||
(arrLength == length && takeCount == length)) {
return baseWrapperValue(array, this.__actions__);
}
var result = [];

View File

@@ -9,7 +9,11 @@ import Map from './_Map';
* @memberOf MapCache
*/
function mapClear() {
this.__data__ = { 'hash': new Hash, 'map': Map ? new Map : [], 'string': new Hash };
this.__data__ = {
'hash': new Hash,
'map': Map ? new Map : [],
'string': new Hash
};
}
export default mapClear;

View File

@@ -7,10 +7,14 @@ var objectTypes = {
};
/** Detect free variable `exports`. */
var freeExports = (objectTypes[typeof exports] && exports && !exports.nodeType) ? exports : null;
var freeExports = (objectTypes[typeof exports] && exports && !exports.nodeType)
? exports
: undefined;
/** Detect free variable `module`. */
var freeModule = (objectTypes[typeof module] && module && !module.nodeType) ? module : null;
var freeModule = (objectTypes[typeof module] && module && !module.nodeType)
? module
: undefined;
/** Detect free variable `global` from Node.js. */
var freeGlobal = checkGlobal(freeExports && freeModule && typeof global == 'object' && global);
@@ -30,6 +34,8 @@ var thisGlobal = checkGlobal(objectTypes[typeof this] && this);
* The `this` value is used if it's the global object to avoid Greasemonkey's
* restricted `window` object, otherwise the `window` object is used.
*/
var root = freeGlobal || ((freeWindow !== (thisGlobal && thisGlobal.window)) && freeWindow) || freeSelf || thisGlobal || Function('return this')();
var root = freeGlobal ||
((freeWindow !== (thisGlobal && thisGlobal.window)) && freeWindow) ||
freeSelf || thisGlobal || Function('return this')();
export default root;

View File

@@ -1,14 +0,0 @@
import isArrayLikeObject from './isArrayLikeObject';
/**
* Converts `value` to an array-like object if it's not one.
*
* @private
* @param {*} value The value to process.
* @returns {Array} Returns the array-like object.
*/
function toArrayLikeObject(value) {
return isArrayLikeObject(value) ? value : [];
}
export default toArrayLikeObject;

View File

@@ -1,14 +0,0 @@
import identity from './identity';
/**
* Converts `value` to a function if it's not one.
*
* @private
* @param {*} value The value to process.
* @returns {Function} Returns the function.
*/
function toFunction(value) {
return typeof value == 'function' ? value : identity;
}
export default toFunction;

3
add.js
View File

@@ -14,6 +14,9 @@
*/
function add(augend, addend) {
var result;
if (augend === undefined && addend === undefined) {
return 0;
}
if (augend !== undefined) {
result = augend;
}

View File

@@ -13,6 +13,7 @@ import findIndex from './findIndex';
import findLastIndex from './findLastIndex';
import flatten from './flatten';
import flattenDeep from './flattenDeep';
import flattenDepth from './flattenDepth';
import fromPairs from './fromPairs';
import head from './head';
import indexOf from './indexOf';
@@ -64,14 +65,14 @@ export default {
chunk, compact, concat, difference, differenceBy,
differenceWith, drop, dropRight, dropRightWhile, dropWhile,
fill, findIndex, findLastIndex, flatten, flattenDeep,
fromPairs, head, indexOf, initial, intersection,
intersectionBy, intersectionWith, join, last, lastIndexOf,
pull, pullAll, pullAllBy, pullAt, remove,
reverse, slice, sortedIndex, sortedIndexBy, sortedIndexOf,
sortedLastIndex, sortedLastIndexBy, sortedLastIndexOf, sortedUniq, sortedUniqBy,
tail, take, takeRight, takeRightWhile, takeWhile,
union, unionBy, unionWith, uniq, uniqBy,
uniqWith, unzip, unzipWith, without, xor,
xorBy, xorWith, zip, zipObject, zipObjectDeep,
zipWith
flattenDepth, fromPairs, head, indexOf, initial,
intersection, intersectionBy, intersectionWith, join, last,
lastIndexOf, pull, pullAll, pullAllBy, pullAt,
remove, reverse, slice, sortedIndex, sortedIndexBy,
sortedIndexOf, sortedLastIndex, sortedLastIndexBy, sortedLastIndexOf, sortedUniq,
sortedUniqBy, tail, take, takeRight, takeRightWhile,
takeWhile, union, unionBy, unionWith, uniq,
uniqBy, uniqWith, unzip, unzipWith, without,
xor, xorBy, xorWith, zip, zipObject,
zipObjectDeep, zipWith
};

View File

@@ -13,6 +13,7 @@ export { default as findIndex } from './findIndex';
export { default as findLastIndex } from './findLastIndex';
export { default as flatten } from './flatten';
export { default as flattenDeep } from './flattenDeep';
export { default as flattenDepth } from './flattenDepth';
export { default as fromPairs } from './fromPairs';
export { default as head } from './head';
export { default as indexOf } from './indexOf';

2
at.js
View File

@@ -23,7 +23,7 @@ import rest from './rest';
* // => ['a', 'c']
*/
var at = rest(function(object, paths) {
return baseAt(object, baseFlatten(paths));
return baseAt(object, baseFlatten(paths, 1));
});
export default at;

View File

@@ -1,5 +1,5 @@
import apply from './_apply';
import isObject from './isObject';
import isError from './isError';
import rest from './rest';
/**
@@ -26,7 +26,7 @@ var attempt = rest(function(func, args) {
try {
return apply(func, undefined, args);
} catch (e) {
return isObject(e) ? e : new Error(e);
return isError(e) ? e : new Error(e);
}
});

View File

@@ -52,4 +52,7 @@ var bind = rest(function(func, thisArg, partials) {
return createWrapper(func, bitmask, thisArg, partials, holders);
});
// Assign default placeholders.
bind.placeholder = {};
export default bind;

View File

@@ -30,7 +30,7 @@ import rest from './rest';
* // => logs 'clicked docs' when clicked
*/
var bindAll = rest(function(object, methodNames) {
arrayEach(baseFlatten(methodNames), function(key) {
arrayEach(baseFlatten(methodNames, 1), function(key) {
object[key] = bind(object[key], object);
});
return object;

View File

@@ -62,4 +62,7 @@ var bindKey = rest(function(object, key, partials) {
return createWrapper(key, bitmask, object, partials, holders);
});
// Assign default placeholders.
bindKey.placeholder = {};
export default bindKey;

43
castArray.js Normal file
View File

@@ -0,0 +1,43 @@
import isArray from './isArray';
/**
* Casts `value` as an array if it's not one.
*
* @static
* @memberOf _
* @category Lang
* @param {*} value The value to inspect.
* @returns {Array} Returns the cast array.
* @example
*
* _.castArray(1);
* // => [1]
*
* _.castArray({ 'a': 1 });
* // => [{ 'a': 1 }]
*
* _.castArray('abc');
* // => ['abc']
*
* _.castArray(null);
* // => [null]
*
* _.castArray(undefined);
* // => [undefined]
*
* _.castArray();
* // => []
*
* var array = [1, 2, 3];
* console.log(_.castArray(array) === array);
* // => true
*/
function castArray() {
if (!arguments.length) {
return [];
}
var value = arguments[0];
return isArray(value) ? value : [value];
}
export default castArray;

View File

@@ -28,7 +28,7 @@ var concat = rest(function(array, values) {
if (!isArray(array)) {
array = array == null ? [] : [Object(array)];
}
values = baseFlatten(values);
values = baseFlatten(values, 1);
return arrayConcat(array, values);
});

View File

@@ -3,7 +3,7 @@ import baseCreate from './_baseCreate';
/**
* Creates an object that inherits from the `prototype` object. If a `properties`
* object is provided its own enumerable properties are assigned to the created object.
* object is given its own enumerable properties are assigned to the created object.
*
* @static
* @memberOf _

View File

@@ -50,4 +50,7 @@ function curry(func, arity, guard) {
return result;
}
// Assign default placeholders.
curry.placeholder = {};
export default curry;

View File

@@ -47,4 +47,7 @@ function curryRight(func, arity, guard) {
return result;
}
// Assign default placeholders.
curryRight.placeholder = {};
export default curryRight;

View File

@@ -135,11 +135,13 @@ function debounce(func, wait, options) {
if (maxWait === false) {
var leadingCall = leading && !timeoutId;
} else {
if (!maxTimeoutId && !leading) {
if (!lastCalled && !maxTimeoutId && !leading) {
lastCalled = stamp;
}
var remaining = maxWait - (stamp - lastCalled),
isCalled = remaining <= 0 || remaining > maxWait;
var remaining = maxWait - (stamp - lastCalled);
var isCalled = (remaining <= 0 || remaining > maxWait) &&
(leading || maxTimeoutId);
if (isCalled) {
if (maxTimeoutId) {

View File

@@ -5,7 +5,7 @@ import rest from './rest';
/**
* Creates an array of unique `array` values not included in the other
* provided arrays using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
* given arrays using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
* for equality comparisons.
*
* @static
@@ -21,7 +21,7 @@ import rest from './rest';
*/
var difference = rest(function(array, values) {
return isArrayLikeObject(array)
? baseDifference(array, baseFlatten(values, false, true))
? baseDifference(array, baseFlatten(values, 1, true))
: [];
});

View File

@@ -32,7 +32,7 @@ var differenceBy = rest(function(array, values) {
iteratee = undefined;
}
return isArrayLikeObject(array)
? baseDifference(array, baseFlatten(values, false, true), baseIteratee(iteratee))
? baseDifference(array, baseFlatten(values, 1, true), baseIteratee(iteratee))
: [];
});

View File

@@ -29,7 +29,7 @@ var differenceWith = rest(function(array, values) {
comparator = undefined;
}
return isArrayLikeObject(array)
? baseDifference(array, baseFlatten(values, false, true), undefined, comparator)
? baseDifference(array, baseFlatten(values, 1, true), undefined, comparator)
: [];
});

View File

@@ -22,7 +22,7 @@ import map from './map';
* // => [1, 1, 2, 2]
*/
function flatMap(collection, iteratee) {
return baseFlatten(map(collection, iteratee));
return baseFlatten(map(collection, iteratee), 1);
}
export default flatMap;

View File

@@ -1,7 +1,7 @@
import baseFlatten from './_baseFlatten';
/**
* Flattens `array` a single level.
* Flattens `array` a single level deep.
*
* @static
* @memberOf _
@@ -10,12 +10,12 @@ import baseFlatten from './_baseFlatten';
* @returns {Array} Returns the new flattened array.
* @example
*
* _.flatten([1, [2, 3, [4]]]);
* // => [1, 2, 3, [4]]
* _.flatten([1, [2, [3, [4]], 5]]);
* // => [1, 2, [3, [4]], 5]
*/
function flatten(array) {
var length = array ? array.length : 0;
return length ? baseFlatten(array) : [];
return length ? baseFlatten(array, 1) : [];
}
export default flatten;

View File

@@ -1,21 +1,24 @@
import baseFlatten from './_baseFlatten';
/** Used as references for various `Number` constants. */
var INFINITY = 1 / 0;
/**
* This method is like `_.flatten` except that it recursively flattens `array`.
* Recursively flattens `array`.
*
* @static
* @memberOf _
* @category Array
* @param {Array} array The array to recursively flatten.
* @param {Array} array The array to flatten.
* @returns {Array} Returns the new flattened array.
* @example
*
* _.flattenDeep([1, [2, 3, [4]]]);
* // => [1, 2, 3, 4]
* _.flattenDeep([1, [2, [3, [4]], 5]]);
* // => [1, 2, 3, 4, 5]
*/
function flattenDeep(array) {
var length = array ? array.length : 0;
return length ? baseFlatten(array, true) : [];
return length ? baseFlatten(array, INFINITY) : [];
}
export default flattenDeep;

32
flattenDepth.js Normal file
View File

@@ -0,0 +1,32 @@
import baseFlatten from './_baseFlatten';
import toInteger from './toInteger';
/**
* Recursively flatten `array` up to `depth` times.
*
* @static
* @memberOf _
* @category Array
* @param {Array} array The array to flatten.
* @param {number} [depth=1] The maximum recursion depth.
* @returns {Array} Returns the new flattened array.
* @example
*
* var array = [1, [2, [3, [4]], 5]];
*
* _.flattenDepth(array, 1);
* // => [1, 2, [3, [4]], 5]
*
* _.flattenDepth(array, 2);
* // => [1, 2, 3, [4], 5]
*/
function flattenDepth(array, depth) {
var length = array ? array.length : 0;
if (!length) {
return [];
}
depth = depth === undefined ? 1 : toInteger(depth);
return baseFlatten(array, depth);
}
export default flattenDepth;

View File

@@ -1,9 +1,9 @@
import createFlow from './_createFlow';
/**
* Creates a function that returns the result of invoking the provided
* functions with the `this` binding of the created function, where each
* successive invocation is supplied the return value of the previous.
* Creates a function that returns the result of invoking the given functions
* with the `this` binding of the created function, where each successive
* invocation is supplied the return value of the previous.
*
* @static
* @memberOf _

View File

@@ -2,7 +2,7 @@ import createFlow from './_createFlow';
/**
* This method is like `_.flow` except that it creates a function that
* invokes the provided functions from right to left.
* invokes the given functions from right to left.
*
* @static
* @memberOf _

View File

@@ -1,7 +1,7 @@
import arrayEach from './_arrayEach';
import baseCastFunction from './_baseCastFunction';
import baseEach from './_baseEach';
import isArray from './isArray';
import toFunction from './_toFunction';
/**
* Iterates over elements of `collection` invoking `iteratee` for each element.
@@ -34,7 +34,7 @@ import toFunction from './_toFunction';
function forEach(collection, iteratee) {
return (typeof iteratee == 'function' && isArray(collection))
? arrayEach(collection, iteratee)
: baseEach(collection, toFunction(iteratee));
: baseEach(collection, baseCastFunction(iteratee));
}
export default forEach;

View File

@@ -1,7 +1,7 @@
import arrayEachRight from './_arrayEachRight';
import baseCastFunction from './_baseCastFunction';
import baseEachRight from './_baseEachRight';
import isArray from './isArray';
import toFunction from './_toFunction';
/**
* This method is like `_.forEach` except that it iterates over elements of
@@ -24,7 +24,7 @@ import toFunction from './_toFunction';
function forEachRight(collection, iteratee) {
return (typeof iteratee == 'function' && isArray(collection))
? arrayEachRight(collection, iteratee)
: baseEachRight(collection, toFunction(iteratee));
: baseEachRight(collection, baseCastFunction(iteratee));
}
export default forEachRight;

View File

@@ -1,6 +1,6 @@
import baseCastFunction from './_baseCastFunction';
import baseFor from './_baseFor';
import keysIn from './keysIn';
import toFunction from './_toFunction';
/**
* Iterates over own and inherited enumerable properties of an object invoking
@@ -29,7 +29,9 @@ import toFunction from './_toFunction';
* // => logs 'a', 'b', then 'c' (iteration order is not guaranteed)
*/
function forIn(object, iteratee) {
return object == null ? object : baseFor(object, toFunction(iteratee), keysIn);
return object == null
? object
: baseFor(object, baseCastFunction(iteratee), keysIn);
}
export default forIn;

View File

@@ -1,6 +1,6 @@
import baseCastFunction from './_baseCastFunction';
import baseForRight from './_baseForRight';
import keysIn from './keysIn';
import toFunction from './_toFunction';
/**
* This method is like `_.forIn` except that it iterates over properties of
@@ -27,7 +27,9 @@ import toFunction from './_toFunction';
* // => logs 'c', 'b', then 'a' assuming `_.forIn` logs 'a', 'b', then 'c'
*/
function forInRight(object, iteratee) {
return object == null ? object : baseForRight(object, toFunction(iteratee), keysIn);
return object == null
? object
: baseForRight(object, baseCastFunction(iteratee), keysIn);
}
export default forInRight;

View File

@@ -1,5 +1,5 @@
import baseCastFunction from './_baseCastFunction';
import baseForOwn from './_baseForOwn';
import toFunction from './_toFunction';
/**
* Iterates over own enumerable properties of an object invoking `iteratee`
@@ -28,7 +28,7 @@ import toFunction from './_toFunction';
* // => logs 'a' then 'b' (iteration order is not guaranteed)
*/
function forOwn(object, iteratee) {
return object && baseForOwn(object, toFunction(iteratee));
return object && baseForOwn(object, baseCastFunction(iteratee));
}
export default forOwn;

View File

@@ -1,5 +1,5 @@
import baseCastFunction from './_baseCastFunction';
import baseForOwnRight from './_baseForOwnRight';
import toFunction from './_toFunction';
/**
* This method is like `_.forOwn` except that it iterates over properties of
@@ -26,7 +26,7 @@ import toFunction from './_toFunction';
* // => logs 'b' then 'a' assuming `_.forOwn` logs 'a' then 'b'
*/
function forOwnRight(object, iteratee) {
return object && baseForOwnRight(object, toFunction(iteratee));
return object && baseForOwnRight(object, baseCastFunction(iteratee));
}
export default forOwnRight;

View File

@@ -1,5 +1,5 @@
/**
* This method returns the first argument provided to it.
* This method returns the first argument given to it.
*
* @static
* @memberOf _

View File

@@ -1,11 +1,11 @@
import arrayMap from './_arrayMap';
import baseCastArrayLikeObject from './_baseCastArrayLikeObject';
import baseIntersection from './_baseIntersection';
import rest from './rest';
import toArrayLikeObject from './_toArrayLikeObject';
/**
* Creates an array of unique values that are included in all of the provided
* arrays using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
* Creates an array of unique values that are included in all given arrays
* using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
* for equality comparisons.
*
* @static
@@ -19,7 +19,7 @@ import toArrayLikeObject from './_toArrayLikeObject';
* // => [2]
*/
var intersection = rest(function(arrays) {
var mapped = arrayMap(arrays, toArrayLikeObject);
var mapped = arrayMap(arrays, baseCastArrayLikeObject);
return (mapped.length && mapped[0] === arrays[0])
? baseIntersection(mapped)
: [];

View File

@@ -1,9 +1,9 @@
import arrayMap from './_arrayMap';
import baseCastArrayLikeObject from './_baseCastArrayLikeObject';
import baseIntersection from './_baseIntersection';
import baseIteratee from './_baseIteratee';
import last from './last';
import rest from './rest';
import toArrayLikeObject from './_toArrayLikeObject';
/**
* This method is like `_.intersection` except that it accepts `iteratee`
@@ -27,7 +27,7 @@ import toArrayLikeObject from './_toArrayLikeObject';
*/
var intersectionBy = rest(function(arrays) {
var iteratee = last(arrays),
mapped = arrayMap(arrays, toArrayLikeObject);
mapped = arrayMap(arrays, baseCastArrayLikeObject);
if (iteratee === last(mapped)) {
iteratee = undefined;

View File

@@ -1,8 +1,8 @@
import arrayMap from './_arrayMap';
import baseCastArrayLikeObject from './_baseCastArrayLikeObject';
import baseIntersection from './_baseIntersection';
import last from './last';
import rest from './rest';
import toArrayLikeObject from './_toArrayLikeObject';
/**
* This method is like `_.intersection` except that it accepts `comparator`
@@ -25,7 +25,7 @@ import toArrayLikeObject from './_toArrayLikeObject';
*/
var intersectionWith = rest(function(arrays) {
var comparator = last(arrays),
mapped = arrayMap(arrays, toArrayLikeObject);
mapped = arrayMap(arrays, baseCastArrayLikeObject);
if (comparator === last(mapped)) {
comparator = undefined;

View File

@@ -3,7 +3,7 @@
*
* @static
* @memberOf _
* @type Function
* @type {Function}
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.

34
isArrayBuffer.js Normal file
View File

@@ -0,0 +1,34 @@
import isObjectLike from './isObjectLike';
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;
/**
* Checks if `value` is classified as an `ArrayBuffer` object.
*
* @static
* @memberOf _
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
* @example
*
* _.isArrayBuffer(new ArrayBuffer(2));
* // => true
*
* _.isArrayBuffer(new Array(2));
* // => false
*/
function isArrayBuffer(value) {
return isObjectLike(value) && objectToString.call(value) == arrayBufferTag;
}
export default isArrayBuffer;

View File

@@ -9,7 +9,6 @@ import isLength from './isLength';
*
* @static
* @memberOf _
* @type Function
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is array-like, else `false`.

View File

@@ -7,7 +7,6 @@ import isObjectLike from './isObjectLike';
*
* @static
* @memberOf _
* @type Function
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is an array-like object, else `false`.

48
isBuffer.js Normal file
View File

@@ -0,0 +1,48 @@
import constant from './constant';
import root from './_root';
/** Used to determine if values are of the language type `Object`. */
var objectTypes = {
'function': true,
'object': true
};
/** Detect free variable `exports`. */
var freeExports = (objectTypes[typeof exports] && exports && !exports.nodeType)
? exports
: undefined;
/** Detect free variable `module`. */
var freeModule = (objectTypes[typeof module] && module && !module.nodeType)
? module
: undefined;
/** Detect the popular CommonJS extension `module.exports`. */
var moduleExports = (freeModule && freeModule.exports === freeExports)
? freeExports
: undefined;
/** Built-in value references. */
var Buffer = moduleExports ? root.Buffer : undefined;
/**
* Checks if `value` is a buffer.
*
* @static
* @memberOf _
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
* @example
*
* _.isBuffer(new Buffer(2));
* // => true
*
* _.isBuffer(new Uint8Array(2));
* // => false
*/
var isBuffer = !Buffer ? constant(false) : function(value) {
return value instanceof Buffer;
};
export default isBuffer;

View File

@@ -39,7 +39,8 @@ var hasOwnProperty = objectProto.hasOwnProperty;
*/
function isEmpty(value) {
if (isArrayLike(value) &&
(isArray(value) || isString(value) || isFunction(value.splice) || isArguments(value))) {
(isArray(value) || isString(value) ||
isFunction(value.splice) || isArguments(value))) {
return !value.length;
}
for (var key in value) {

View File

@@ -1,10 +1,10 @@
import baseIsEqual from './_baseIsEqual';
/**
* This method is like `_.isEqual` except that it accepts `customizer` which is
* invoked to compare values. If `customizer` returns `undefined` comparisons are
* handled by the method instead. The `customizer` is invoked with up to six arguments:
* (objValue, othValue [, index|key, object, other, stack]).
* This method is like `_.isEqual` except that it accepts `customizer` which
* is invoked to compare values. If `customizer` returns `undefined` comparisons
* are handled by the method instead. The `customizer` is invoked with up to
* six arguments: (objValue, othValue [, index|key, object, other, stack]).
*
* @static
* @memberOf _

View File

@@ -30,8 +30,12 @@ var objectToString = objectProto.toString;
* // => false
*/
function isError(value) {
return isObjectLike(value) &&
typeof value.message == 'string' && objectToString.call(value) == errorTag;
if (!isObjectLike(value)) {
return false;
}
var Ctor = value.constructor;
return (objectToString.call(value) == errorTag) ||
(typeof Ctor == 'function' && objectToString.call(Ctor.prototype) == errorTag);
}
export default isError;

View File

@@ -26,7 +26,8 @@ var MAX_SAFE_INTEGER = 9007199254740991;
* // => false
*/
function isLength(value) {
return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
return typeof value == 'number' &&
value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
}
export default isLength;

27
isMap.js Normal file
View File

@@ -0,0 +1,27 @@
import getTag from './_getTag';
import isObjectLike from './isObjectLike';
/** `Object#toString` result references. */
var mapTag = '[object Map]';
/**
* Checks if `value` is classified as a `Map` object.
*
* @static
* @memberOf _
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
* @example
*
* _.isMap(new Map);
* // => true
*
* _.isMap(new WeakMap);
* // => false
*/
function isMap(value) {
return isObjectLike(value) && getTag(value) == mapTag;
}
export default isMap;

View File

@@ -2,8 +2,9 @@ import baseIsMatch from './_baseIsMatch';
import getMatchData from './_getMatchData';
/**
* Performs a deep comparison between `object` and `source` to determine if
* `object` contains equivalent property values.
* Performs a partial deep comparison between `object` and `source` to
* determine if `object` contains equivalent property values. This method is
* equivalent to a `_.matches` function when `source` is partially applied.
*
* **Note:** This method supports comparing the same values as `_.isEqual`.
*

View File

@@ -50,7 +50,8 @@ var getPrototypeOf = Object.getPrototypeOf;
* // => true
*/
function isPlainObject(value) {
if (!isObjectLike(value) || objectToString.call(value) != objectTag || isHostObject(value)) {
if (!isObjectLike(value) ||
objectToString.call(value) != objectTag || isHostObject(value)) {
return false;
}
var proto = objectProto;

27
isSet.js Normal file
View File

@@ -0,0 +1,27 @@
import getTag from './_getTag';
import isObjectLike from './isObjectLike';
/** `Object#toString` result references. */
var setTag = '[object Set]';
/**
* Checks if `value` is classified as a `Set` object.
*
* @static
* @memberOf _
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
* @example
*
* _.isSet(new Set);
* // => true
*
* _.isSet(new WeakSet);
* // => false
*/
function isSet(value) {
return isObjectLike(value) && getTag(value) == setTag;
}
export default isSet;

View File

@@ -68,7 +68,8 @@ var objectToString = objectProto.toString;
* // => false
*/
function isTypedArray(value) {
return isObjectLike(value) && isLength(value.length) && !!typedArrayTags[objectToString.call(value)];
return isObjectLike(value) &&
isLength(value.length) && !!typedArrayTags[objectToString.call(value)];
}
export default isTypedArray;

27
isWeakMap.js Normal file
View File

@@ -0,0 +1,27 @@
import getTag from './_getTag';
import isObjectLike from './isObjectLike';
/** `Object#toString` result references. */
var weakMapTag = '[object WeakMap]';
/**
* Checks if `value` is classified as a `WeakMap` object.
*
* @static
* @memberOf _
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
* @example
*
* _.isWeakMap(new WeakMap);
* // => true
*
* _.isWeakMap(new Map);
* // => false
*/
function isWeakMap(value) {
return isObjectLike(value) && getTag(value) == weakMapTag;
}
export default isWeakMap;

35
isWeakSet.js Normal file
View File

@@ -0,0 +1,35 @@
import isObjectLike from './isObjectLike';
/** `Object#toString` result references. */
var weakSetTag = '[object WeakSet]';
/** 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;
/**
* Checks if `value` is classified as a `WeakSet` object.
*
* @static
* @memberOf _
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
* @example
*
* _.isWeakSet(new WeakSet);
* // => true
*
* _.isWeakSet(new Set);
* // => false
*/
function isWeakSet(value) {
return isObjectLike(value) && objectToString.call(value) == weakSetTag;
}
export default isWeakSet;

View File

@@ -5,7 +5,8 @@ import baseIteratee from './_baseIteratee';
* Creates a function that invokes `func` with the arguments of the created
* function. If `func` is a property name the created callback returns the
* property value for a given element. If `func` is an object the created
* callback returns `true` for elements that contain the equivalent object properties, otherwise it returns `false`.
* callback returns `true` for elements that contain the equivalent object
* properties, otherwise it returns `false`.
*
* @static
* @memberOf _

View File

@@ -1,3 +1,4 @@
import castArray from './castArray';
import clone from './clone';
import cloneDeep from './cloneDeep';
import cloneDeepWith from './cloneDeepWith';
@@ -7,9 +8,11 @@ import gt from './gt';
import gte from './gte';
import isArguments from './isArguments';
import isArray from './isArray';
import isArrayBuffer from './isArrayBuffer';
import isArrayLike from './isArrayLike';
import isArrayLikeObject from './isArrayLikeObject';
import isBoolean from './isBoolean';
import isBuffer from './isBuffer';
import isDate from './isDate';
import isElement from './isElement';
import isEmpty from './isEmpty';
@@ -20,6 +23,7 @@ import isFinite from './isFinite';
import isFunction from './isFunction';
import isInteger from './isInteger';
import isLength from './isLength';
import isMap from './isMap';
import isMatch from './isMatch';
import isMatchWith from './isMatchWith';
import isNaN from './isNaN';
@@ -32,10 +36,13 @@ import isObjectLike from './isObjectLike';
import isPlainObject from './isPlainObject';
import isRegExp from './isRegExp';
import isSafeInteger from './isSafeInteger';
import isSet from './isSet';
import isString from './isString';
import isSymbol from './isSymbol';
import isTypedArray from './isTypedArray';
import isUndefined from './isUndefined';
import isWeakMap from './isWeakMap';
import isWeakSet from './isWeakSet';
import lt from './lt';
import lte from './lte';
import toArray from './toArray';
@@ -47,14 +54,15 @@ import toSafeInteger from './toSafeInteger';
import toString from './toString';
export default {
clone, cloneDeep, cloneDeepWith, cloneWith, eq,
gt, gte, isArguments, isArray, isArrayLike,
isArrayLikeObject, isBoolean, isDate, isElement, isEmpty,
isEqual, isEqualWith, isError, isFinite, isFunction,
isInteger, isLength, isMatch, isMatchWith, isNaN,
isNative, isNil, isNull, isNumber, isObject,
isObjectLike, isPlainObject, isRegExp, isSafeInteger, isString,
isSymbol, isTypedArray, isUndefined, lt, lte,
toArray, toInteger, toLength, toNumber, toPlainObject,
toSafeInteger, toString
castArray, clone, cloneDeep, cloneDeepWith, cloneWith,
eq, gt, gte, isArguments, isArray,
isArrayBuffer, isArrayLike, isArrayLikeObject, isBoolean, isBuffer,
isDate, isElement, isEmpty, isEqual, isEqualWith,
isError, isFinite, isFunction, isInteger, isLength,
isMap, isMatch, isMatchWith, isNaN, isNative,
isNil, isNull, isNumber, isObject, isObjectLike,
isPlainObject, isRegExp, isSafeInteger, isSet, isString,
isSymbol, isTypedArray, isUndefined, isWeakMap, isWeakSet,
lt, lte, toArray, toInteger, toLength,
toNumber, toPlainObject, toSafeInteger, toString
};

View File

@@ -1,3 +1,4 @@
export { default as castArray } from './castArray';
export { default as clone } from './clone';
export { default as cloneDeep } from './cloneDeep';
export { default as cloneDeepWith } from './cloneDeepWith';
@@ -7,9 +8,11 @@ export { default as gt } from './gt';
export { default as gte } from './gte';
export { default as isArguments } from './isArguments';
export { default as isArray } from './isArray';
export { default as isArrayBuffer } from './isArrayBuffer';
export { default as isArrayLike } from './isArrayLike';
export { default as isArrayLikeObject } from './isArrayLikeObject';
export { default as isBoolean } from './isBoolean';
export { default as isBuffer } from './isBuffer';
export { default as isDate } from './isDate';
export { default as isElement } from './isElement';
export { default as isEmpty } from './isEmpty';
@@ -20,6 +23,7 @@ export { default as isFinite } from './isFinite';
export { default as isFunction } from './isFunction';
export { default as isInteger } from './isInteger';
export { default as isLength } from './isLength';
export { default as isMap } from './isMap';
export { default as isMatch } from './isMatch';
export { default as isMatchWith } from './isMatchWith';
export { default as isNaN } from './isNaN';
@@ -32,10 +36,13 @@ export { default as isObjectLike } from './isObjectLike';
export { default as isPlainObject } from './isPlainObject';
export { default as isRegExp } from './isRegExp';
export { default as isSafeInteger } from './isSafeInteger';
export { default as isSet } from './isSet';
export { default as isString } from './isString';
export { default as isSymbol } from './isSymbol';
export { default as isTypedArray } from './isTypedArray';
export { default as isUndefined } from './isUndefined';
export { default as isWeakMap } from './isWeakMap';
export { default as isWeakSet } from './isWeakSet';
export { default as lt } from './lt';
export { default as lte } from './lte';
export { default as toArray } from './toArray';

View File

@@ -1,6 +1,6 @@
/**
* @license
* lodash 4.2.1 (Custom Build) <https://lodash.com/>
* lodash 4.4.0 (Custom Build) <https://lodash.com/>
* Build: `lodash modularize exports="es" -o ./`
* Copyright 2012-2016 The Dojo Foundation <http://dojofoundation.org/>
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
@@ -44,7 +44,7 @@ import toInteger from './toInteger';
import lodash from './wrapperLodash';
/** Used as the semantic version number. */
var VERSION = '4.2.1';
var VERSION = '4.4.0';
/** Used to compose bitmasks for wrapper metadata. */
var BIND_KEY_FLAG = 2;
@@ -100,6 +100,7 @@ lodash.before = func.before;
lodash.bind = func.bind;
lodash.bindAll = util.bindAll;
lodash.bindKey = func.bindKey;
lodash.castArray = lang.castArray;
lodash.chain = seq.chain;
lodash.chunk = array.chunk;
lodash.compact = array.compact;
@@ -128,6 +129,7 @@ lodash.filter = collection.filter;
lodash.flatMap = collection.flatMap;
lodash.flatten = array.flatten;
lodash.flattenDeep = array.flattenDeep;
lodash.flattenDepth = array.flattenDepth;
lodash.flip = func.flip;
lodash.flow = util.flow;
lodash.flowRight = util.flowRight;
@@ -282,9 +284,11 @@ lodash.inRange = number.inRange;
lodash.invoke = object.invoke;
lodash.isArguments = lang.isArguments;
lodash.isArray = isArray;
lodash.isArrayBuffer = lang.isArrayBuffer;
lodash.isArrayLike = lang.isArrayLike;
lodash.isArrayLikeObject = lang.isArrayLikeObject;
lodash.isBoolean = lang.isBoolean;
lodash.isBuffer = lang.isBuffer;
lodash.isDate = lang.isDate;
lodash.isElement = lang.isElement;
lodash.isEmpty = lang.isEmpty;
@@ -295,6 +299,7 @@ lodash.isFinite = lang.isFinite;
lodash.isFunction = lang.isFunction;
lodash.isInteger = lang.isInteger;
lodash.isLength = lang.isLength;
lodash.isMap = lang.isMap;
lodash.isMatch = lang.isMatch;
lodash.isMatchWith = lang.isMatchWith;
lodash.isNaN = lang.isNaN;
@@ -307,10 +312,13 @@ lodash.isObjectLike = lang.isObjectLike;
lodash.isPlainObject = lang.isPlainObject;
lodash.isRegExp = lang.isRegExp;
lodash.isSafeInteger = lang.isSafeInteger;
lodash.isSet = lang.isSet;
lodash.isString = lang.isString;
lodash.isSymbol = lang.isSymbol;
lodash.isTypedArray = lang.isTypedArray;
lodash.isUndefined = lang.isUndefined;
lodash.isWeakMap = lang.isWeakMap;
lodash.isWeakSet = lang.isWeakSet;
lodash.join = array.join;
lodash.kebabCase = string.kebabCase;
lodash.last = last;
@@ -390,7 +398,7 @@ mixin(lodash, (function() {
*
* @static
* @memberOf _
* @type string
* @type {string}
*/
lodash.VERSION = VERSION;
(lodash.templateSettings = string.templateSettings).imports._ = lodash;
@@ -413,7 +421,10 @@ arrayEach(['drop', 'take'], function(methodName, index) {
if (filtered) {
result.__takeCount__ = nativeMin(n, result.__takeCount__);
} else {
result.__views__.push({ 'size': nativeMin(n, MAX_ARRAY_LENGTH), 'type': methodName + (result.__dir__ < 0 ? 'Right' : '') });
result.__views__.push({
'size': nativeMin(n, MAX_ARRAY_LENGTH),
'type': methodName + (result.__dir__ < 0 ? 'Right' : '')
});
}
return result;
};
@@ -430,7 +441,10 @@ arrayEach(['filter', 'map', 'takeWhile'], function(methodName, index) {
LazyWrapper.prototype[methodName] = function(iteratee) {
var result = this.clone();
result.__iteratees__.push({ 'iteratee': baseIteratee(iteratee, 3), 'type': type });
result.__iteratees__.push({
'iteratee': baseIteratee(iteratee, 3),
'type': type
});
result.__filtered__ = result.__filtered__ || isFilter;
return result;
};
@@ -582,7 +596,10 @@ baseForOwn(LazyWrapper.prototype, function(func, methodName) {
}
});
realNames[createHybridWrapper(undefined, BIND_KEY_FLAG).name] = [{ 'name': 'wrapper', 'func': undefined }];
realNames[createHybridWrapper(undefined, BIND_KEY_FLAG).name] = [{
'name': 'wrapper',
'func': undefined
}];
// Add functions to the lazy wrapper.
LazyWrapper.prototype.clone = lazyClone;

View File

@@ -1,6 +1,6 @@
/**
* @license
* lodash 4.2.1 (Custom Build) <https://lodash.com/>
* lodash 4.4.0 (Custom Build) <https://lodash.com/>
* Build: `lodash modularize exports="es" -o ./`
* Copyright 2012-2016 The Dojo Foundation <http://dojofoundation.org/>
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
@@ -22,6 +22,7 @@ export { default as bindAll } from './bindAll';
export { default as bindKey } from './bindKey';
export { default as camelCase } from './camelCase';
export { default as capitalize } from './capitalize';
export { default as castArray } from './castArray';
export { default as ceil } from './ceil';
export { default as chain } from './chain';
export { default as chunk } from './chunk';
@@ -73,6 +74,7 @@ export { default as findLastKey } from './findLastKey';
export { default as flatMap } from './flatMap';
export { default as flatten } from './flatten';
export { default as flattenDeep } from './flattenDeep';
export { default as flattenDepth } from './flattenDepth';
export { default as flip } from './flip';
export { default as floor } from './floor';
export { default as flow } from './flow';
@@ -107,9 +109,11 @@ export { default as invoke } from './invoke';
export { default as invokeMap } from './invokeMap';
export { default as isArguments } from './isArguments';
export { default as isArray } from './isArray';
export { default as isArrayBuffer } from './isArrayBuffer';
export { default as isArrayLike } from './isArrayLike';
export { default as isArrayLikeObject } from './isArrayLikeObject';
export { default as isBoolean } from './isBoolean';
export { default as isBuffer } from './isBuffer';
export { default as isDate } from './isDate';
export { default as isElement } from './isElement';
export { default as isEmpty } from './isEmpty';
@@ -120,6 +124,7 @@ export { default as isFinite } from './isFinite';
export { default as isFunction } from './isFunction';
export { default as isInteger } from './isInteger';
export { default as isLength } from './isLength';
export { default as isMap } from './isMap';
export { default as isMatch } from './isMatch';
export { default as isMatchWith } from './isMatchWith';
export { default as isNaN } from './isNaN';
@@ -132,10 +137,13 @@ export { default as isObjectLike } from './isObjectLike';
export { default as isPlainObject } from './isPlainObject';
export { default as isRegExp } from './isRegExp';
export { default as isSafeInteger } from './isSafeInteger';
export { default as isSet } from './isSet';
export { default as isString } from './isString';
export { default as isSymbol } from './isSymbol';
export { default as isTypedArray } from './isTypedArray';
export { default as isUndefined } from './isUndefined';
export { default as isWeakMap } from './isWeakMap';
export { default as isWeakSet } from './isWeakSet';
export { default as iteratee } from './iteratee';
export { default as join } from './join';
export { default as kebabCase } from './kebabCase';

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