mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-01-29 14:37:49 +00:00
Compare commits
4 Commits
4.7.0-amd
...
4.10.0-amd
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
76b289fe6e | ||
|
|
57f1942947 | ||
|
|
8349627be6 | ||
|
|
a2438ffc51 |
@@ -1,6 +1,6 @@
|
||||
# lodash-amd v4.7.0
|
||||
# lodash-amd v4.10.0
|
||||
|
||||
The [lodash](https://lodash.com/) library exported as [AMD](https://github.com/amdjs/amdjs-api/wiki/AMD) modules.
|
||||
The [Lodash](https://lodash.com/) library exported as [AMD](https://github.com/amdjs/amdjs-api/wiki/AMD) modules.
|
||||
|
||||
Generated using [lodash-cli](https://www.npmjs.com/package/lodash-cli):
|
||||
```bash
|
||||
@@ -27,4 +27,4 @@ require({
|
||||
});
|
||||
```
|
||||
|
||||
See the [package source](https://github.com/lodash/lodash/tree/4.7.0-amd) for more details.
|
||||
See the [package source](https://github.com/lodash/lodash/tree/4.10.0-amd) for more details.
|
||||
|
||||
2
_Hash.js
2
_Hash.js
@@ -4,7 +4,7 @@ define(['./_nativeCreate'], function(nativeCreate) {
|
||||
var objectProto = Object.prototype;
|
||||
|
||||
/**
|
||||
* Creates an hash object.
|
||||
* Creates a hash object.
|
||||
*
|
||||
* @private
|
||||
* @constructor
|
||||
|
||||
@@ -7,7 +7,7 @@ define([], function() {
|
||||
* @private
|
||||
* @param {Function} func The function to invoke.
|
||||
* @param {*} thisArg The `this` binding of `func`.
|
||||
* @param {...*} args The arguments to invoke `func` with.
|
||||
* @param {Array} args The arguments to invoke `func` with.
|
||||
* @returns {*} Returns the result of `func`.
|
||||
*/
|
||||
function apply(func, thisArg, args) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
define(['./_arrayPush', './isArguments', './isArray', './isArrayLikeObject'], function(arrayPush, isArguments, isArray, isArrayLikeObject) {
|
||||
define(['./_arrayPush', './_isFlattenable'], function(arrayPush, isFlattenable) {
|
||||
|
||||
/**
|
||||
* The base implementation of `_.flatten` with support for restricting flattening.
|
||||
@@ -6,23 +6,24 @@ define(['./_arrayPush', './isArguments', './isArray', './isArrayLikeObject'], fu
|
||||
* @private
|
||||
* @param {Array} array The array to flatten.
|
||||
* @param {number} depth The maximum recursion depth.
|
||||
* @param {boolean} [isStrict] Restrict flattening to arrays-like objects.
|
||||
* @param {boolean} [predicate=isFlattenable] The function invoked per iteration.
|
||||
* @param {boolean} [isStrict] Restrict to values that pass `predicate` checks.
|
||||
* @param {Array} [result=[]] The initial result value.
|
||||
* @returns {Array} Returns the new flattened array.
|
||||
*/
|
||||
function baseFlatten(array, depth, isStrict, result) {
|
||||
result || (result = []);
|
||||
|
||||
function baseFlatten(array, depth, predicate, isStrict, result) {
|
||||
var index = -1,
|
||||
length = array.length;
|
||||
|
||||
predicate || (predicate = isFlattenable);
|
||||
result || (result = []);
|
||||
|
||||
while (++index < length) {
|
||||
var value = array[index];
|
||||
if (depth > 0 && isArrayLikeObject(value) &&
|
||||
(isStrict || isArray(value) || isArguments(value))) {
|
||||
if (depth > 0 && predicate(value)) {
|
||||
if (depth > 1) {
|
||||
// Recursively flatten arrays (susceptible to call stack limits).
|
||||
baseFlatten(value, depth - 1, isStrict, result);
|
||||
baseFlatten(value, depth - 1, predicate, isStrict, result);
|
||||
} else {
|
||||
arrayPush(result, value);
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ define(['./_createBaseFor'], function(createBaseFor) {
|
||||
|
||||
/**
|
||||
* The base implementation of `baseForOwn` which iterates over `object`
|
||||
* properties returned by `keysFunc` invoking `iteratee` for each property.
|
||||
* properties returned by `keysFunc` and invokes `iteratee` for each property.
|
||||
* Iteratee functions may exit iteration early by explicitly returning `false`.
|
||||
*
|
||||
* @private
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
define(['./_baseCastPath', './_isKey'], function(baseCastPath, isKey) {
|
||||
define(['./_castPath', './_isKey'], function(castPath, isKey) {
|
||||
|
||||
/** Used as a safe reference for `undefined` in pre-ES5 environments. */
|
||||
var undefined;
|
||||
@@ -12,7 +12,7 @@ define(['./_baseCastPath', './_isKey'], function(baseCastPath, isKey) {
|
||||
* @returns {*} Returns the resolved value.
|
||||
*/
|
||||
function baseGet(object, path) {
|
||||
path = isKey(path, object) ? [path] : baseCastPath(path);
|
||||
path = isKey(path, object) ? [path] : castPath(path);
|
||||
|
||||
var index = 0,
|
||||
length = path.length;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
define(['./_apply', './_baseCastPath', './_isKey', './last', './_parent'], function(apply, baseCastPath, isKey, last, parent) {
|
||||
define(['./_apply', './_castPath', './_isKey', './last', './_parent'], function(apply, castPath, isKey, last, parent) {
|
||||
|
||||
/** Used as a safe reference for `undefined` in pre-ES5 environments. */
|
||||
var undefined;
|
||||
@@ -15,7 +15,7 @@ define(['./_apply', './_baseCastPath', './_isKey', './last', './_parent'], funct
|
||||
*/
|
||||
function baseInvoke(object, path, args) {
|
||||
if (!isKey(path, object)) {
|
||||
path = baseCastPath(path);
|
||||
path = castPath(path);
|
||||
object = parent(object, path);
|
||||
path = last(path);
|
||||
}
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
define(['./_baseIsMatch', './_getMatchData'], function(baseIsMatch, getMatchData) {
|
||||
|
||||
/** Used as a safe reference for `undefined` in pre-ES5 environments. */
|
||||
var undefined;
|
||||
define(['./_baseIsMatch', './_getMatchData', './_matchesStrictComparable'], function(baseIsMatch, getMatchData, matchesStrictComparable) {
|
||||
|
||||
/**
|
||||
* The base implementation of `_.matches` which doesn't clone `source`.
|
||||
@@ -13,16 +10,7 @@ define(['./_baseIsMatch', './_getMatchData'], function(baseIsMatch, getMatchData
|
||||
function baseMatches(source) {
|
||||
var matchData = getMatchData(source);
|
||||
if (matchData.length == 1 && matchData[0][2]) {
|
||||
var key = matchData[0][0],
|
||||
value = matchData[0][1];
|
||||
|
||||
return function(object) {
|
||||
if (object == null) {
|
||||
return false;
|
||||
}
|
||||
return object[key] === value &&
|
||||
(value !== undefined || (key in Object(object)));
|
||||
};
|
||||
return matchesStrictComparable(matchData[0][0], matchData[0][1]);
|
||||
}
|
||||
return function(object) {
|
||||
return object === source || baseIsMatch(object, source, matchData);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
define(['./_baseIsEqual', './get', './hasIn'], function(baseIsEqual, get, hasIn) {
|
||||
define(['./_baseIsEqual', './get', './hasIn', './_isKey', './_isStrictComparable', './_matchesStrictComparable'], function(baseIsEqual, get, hasIn, isKey, isStrictComparable, matchesStrictComparable) {
|
||||
|
||||
/** Used as a safe reference for `undefined` in pre-ES5 environments. */
|
||||
var undefined;
|
||||
@@ -16,6 +16,9 @@ define(['./_baseIsEqual', './get', './hasIn'], function(baseIsEqual, get, hasIn)
|
||||
* @returns {Function} Returns the new function.
|
||||
*/
|
||||
function baseMatchesProperty(path, srcValue) {
|
||||
if (isKey(path) && isStrictComparable(srcValue)) {
|
||||
return matchesStrictComparable(path, srcValue);
|
||||
}
|
||||
return function(object) {
|
||||
var objValue = get(object, path);
|
||||
return (objValue === undefined && objValue === srcValue)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
define(['./_baseCastPath', './_isIndex', './_isKey', './last', './_parent'], function(baseCastPath, isIndex, isKey, last, parent) {
|
||||
define(['./_castPath', './_isIndex', './_isKey', './last', './_parent'], function(castPath, isIndex, isKey, last, parent) {
|
||||
|
||||
/** Used for built-in method references. */
|
||||
var arrayProto = Array.prototype;
|
||||
@@ -27,7 +27,7 @@ define(['./_baseCastPath', './_isIndex', './_isKey', './last', './_parent'], fun
|
||||
splice.call(array, index, 1);
|
||||
}
|
||||
else if (!isKey(index, array)) {
|
||||
var path = baseCastPath(index),
|
||||
var path = castPath(index),
|
||||
object = parent(array, path);
|
||||
|
||||
if (object != null) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
define(['./_assignValue', './_baseCastPath', './_isIndex', './_isKey', './isObject'], function(assignValue, baseCastPath, isIndex, isKey, isObject) {
|
||||
define(['./_assignValue', './_castPath', './_isIndex', './_isKey', './isObject'], function(assignValue, castPath, isIndex, isKey, isObject) {
|
||||
|
||||
/** Used as a safe reference for `undefined` in pre-ES5 environments. */
|
||||
var undefined;
|
||||
@@ -14,7 +14,7 @@ define(['./_assignValue', './_baseCastPath', './_isIndex', './_isKey', './isObje
|
||||
* @returns {Object} Returns `object`.
|
||||
*/
|
||||
function baseSet(object, path, value, customizer) {
|
||||
path = isKey(path, object) ? [path] : baseCastPath(path);
|
||||
path = isKey(path, object) ? [path] : castPath(path);
|
||||
|
||||
var index = -1,
|
||||
length = path.length,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
define(['./_baseCastPath', './has', './_isKey', './last', './_parent'], function(baseCastPath, has, isKey, last, parent) {
|
||||
define(['./_castPath', './has', './_isKey', './last', './_parent'], function(castPath, has, isKey, last, parent) {
|
||||
|
||||
/**
|
||||
* The base implementation of `_.unset`.
|
||||
@@ -9,7 +9,7 @@ define(['./_baseCastPath', './has', './_isKey', './last', './_parent'], function
|
||||
* @returns {boolean} Returns `true` if the property is deleted, else `false`.
|
||||
*/
|
||||
function baseUnset(object, path) {
|
||||
path = isKey(path, object) ? [path] : baseCastPath(path);
|
||||
path = isKey(path, object) ? [path] : castPath(path);
|
||||
object = parent(object, path);
|
||||
var key = last(path);
|
||||
return (object != null && has(object, key)) ? delete object[key] : true;
|
||||
|
||||
@@ -7,9 +7,9 @@ define(['./isArrayLikeObject'], function(isArrayLikeObject) {
|
||||
* @param {*} value The value to inspect.
|
||||
* @returns {Array|Object} Returns the cast array-like object.
|
||||
*/
|
||||
function baseCastArrayLikeObject(value) {
|
||||
function castArrayLikeObject(value) {
|
||||
return isArrayLikeObject(value) ? value : [];
|
||||
}
|
||||
|
||||
return baseCastArrayLikeObject;
|
||||
return castArrayLikeObject;
|
||||
});
|
||||
@@ -7,9 +7,9 @@ define(['./identity'], function(identity) {
|
||||
* @param {*} value The value to inspect.
|
||||
* @returns {Function} Returns cast function.
|
||||
*/
|
||||
function baseCastFunction(value) {
|
||||
function castFunction(value) {
|
||||
return typeof value == 'function' ? value : identity;
|
||||
}
|
||||
|
||||
return baseCastFunction;
|
||||
return castFunction;
|
||||
});
|
||||
@@ -7,9 +7,9 @@ define(['./isArray', './_stringToPath'], function(isArray, stringToPath) {
|
||||
* @param {*} value The value to inspect.
|
||||
* @returns {Array} Returns the cast property path array.
|
||||
*/
|
||||
function baseCastPath(value) {
|
||||
function castPath(value) {
|
||||
return isArray(value) ? value : stringToPath(value);
|
||||
}
|
||||
|
||||
return baseCastPath;
|
||||
return castPath;
|
||||
});
|
||||
22
_castSlice.js
Normal file
22
_castSlice.js
Normal file
@@ -0,0 +1,22 @@
|
||||
define(['./_baseSlice'], function(baseSlice) {
|
||||
|
||||
/** Used as a safe reference for `undefined` in pre-ES5 environments. */
|
||||
var undefined;
|
||||
|
||||
/**
|
||||
* Casts `array` to a slice if it's needed.
|
||||
*
|
||||
* @private
|
||||
* @param {Array} array The array to inspect.
|
||||
* @param {number} start The start position.
|
||||
* @param {number} [end=array.length] The end position.
|
||||
* @returns {Array} Returns the cast slice.
|
||||
*/
|
||||
function castSlice(array, start, end) {
|
||||
var length = array.length;
|
||||
end = end === undefined ? length : end;
|
||||
return (!start && end >= length) ? array : baseSlice(array, start, end);
|
||||
}
|
||||
|
||||
return castSlice;
|
||||
});
|
||||
@@ -1,20 +1,8 @@
|
||||
define(['./_stringToArray', './toString'], function(stringToArray, toString) {
|
||||
define(['./_castSlice', './_reHasComplexSymbol', './_stringToArray', './toString'], function(castSlice, reHasComplexSymbol, stringToArray, toString) {
|
||||
|
||||
/** Used as a safe reference for `undefined` in pre-ES5 environments. */
|
||||
var undefined;
|
||||
|
||||
/** Used to compose unicode character classes. */
|
||||
var rsAstralRange = '\\ud800-\\udfff',
|
||||
rsComboMarksRange = '\\u0300-\\u036f\\ufe20-\\ufe23',
|
||||
rsComboSymbolsRange = '\\u20d0-\\u20f0',
|
||||
rsVarRange = '\\ufe0e\\ufe0f';
|
||||
|
||||
/** Used to compose unicode capture groups. */
|
||||
var rsZWJ = '\\u200d';
|
||||
|
||||
/** Used to detect strings with [zero-width joiners or code points from the astral planes](http://eev.ee/blog/2015/09/12/dark-corners-of-unicode/). */
|
||||
var reHasComplexSymbol = RegExp('[' + rsZWJ + rsAstralRange + rsComboMarksRange + rsComboSymbolsRange + rsVarRange + ']');
|
||||
|
||||
/**
|
||||
* Creates a function like `_.lowerFirst`.
|
||||
*
|
||||
@@ -30,8 +18,13 @@ define(['./_stringToArray', './toString'], function(stringToArray, toString) {
|
||||
? stringToArray(string)
|
||||
: undefined;
|
||||
|
||||
var chr = strSymbols ? strSymbols[0] : string.charAt(0),
|
||||
trailing = strSymbols ? strSymbols.slice(1).join('') : string.slice(1);
|
||||
var chr = strSymbols
|
||||
? strSymbols[0]
|
||||
: string.charAt(0);
|
||||
|
||||
var trailing = strSymbols
|
||||
? castSlice(strSymbols, 1).join('')
|
||||
: string.slice(1);
|
||||
|
||||
return chr[methodName]() + trailing;
|
||||
};
|
||||
|
||||
@@ -10,8 +10,8 @@ define(['./_baseCreate', './isObject'], function(baseCreate, isObject) {
|
||||
*/
|
||||
function createCtorWrapper(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
|
||||
// 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
|
||||
// for more details.
|
||||
var args = arguments;
|
||||
switch (args.length) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
define(['./_apply', './_arrayMap', './_baseFlatten', './_baseIteratee', './rest'], function(apply, arrayMap, baseFlatten, baseIteratee, rest) {
|
||||
define(['./_apply', './_arrayMap', './_baseFlatten', './_baseIteratee', './_isFlattenableIteratee', './rest'], function(apply, arrayMap, baseFlatten, baseIteratee, isFlattenableIteratee, rest) {
|
||||
|
||||
/**
|
||||
* Creates a function like `_.over`.
|
||||
@@ -9,7 +9,7 @@ define(['./_apply', './_arrayMap', './_baseFlatten', './_baseIteratee', './rest'
|
||||
*/
|
||||
function createOver(arrayFunc) {
|
||||
return rest(function(iteratees) {
|
||||
iteratees = arrayMap(baseFlatten(iteratees, 1), baseIteratee);
|
||||
iteratees = arrayMap(baseFlatten(iteratees, 1, isFlattenableIteratee), baseIteratee);
|
||||
return rest(function(args) {
|
||||
var thisArg = this;
|
||||
return arrayFunc(iteratees, function(iteratee) {
|
||||
|
||||
@@ -1,20 +1,8 @@
|
||||
define(['./_baseRepeat', './_stringSize', './_stringToArray'], function(baseRepeat, stringSize, stringToArray) {
|
||||
define(['./_baseRepeat', './_castSlice', './_reHasComplexSymbol', './_stringSize', './_stringToArray'], function(baseRepeat, castSlice, reHasComplexSymbol, stringSize, stringToArray) {
|
||||
|
||||
/** Used as a safe reference for `undefined` in pre-ES5 environments. */
|
||||
var undefined;
|
||||
|
||||
/** Used to compose unicode character classes. */
|
||||
var rsAstralRange = '\\ud800-\\udfff',
|
||||
rsComboMarksRange = '\\u0300-\\u036f\\ufe20-\\ufe23',
|
||||
rsComboSymbolsRange = '\\u20d0-\\u20f0',
|
||||
rsVarRange = '\\ufe0e\\ufe0f';
|
||||
|
||||
/** Used to compose unicode capture groups. */
|
||||
var rsZWJ = '\\u200d';
|
||||
|
||||
/** Used to detect strings with [zero-width joiners or code points from the astral planes](http://eev.ee/blog/2015/09/12/dark-corners-of-unicode/). */
|
||||
var reHasComplexSymbol = RegExp('[' + rsZWJ + rsAstralRange + rsComboMarksRange + rsComboSymbolsRange + rsVarRange + ']');
|
||||
|
||||
/* Built-in method references for those with the same name as other `lodash` methods. */
|
||||
var nativeCeil = Math.ceil;
|
||||
|
||||
@@ -36,7 +24,7 @@ define(['./_baseRepeat', './_stringSize', './_stringToArray'], function(baseRepe
|
||||
}
|
||||
var result = baseRepeat(chars, nativeCeil(length / stringSize(chars)));
|
||||
return reHasComplexSymbol.test(chars)
|
||||
? stringToArray(result).slice(0, length).join('')
|
||||
? castSlice(stringToArray(result), 0, length).join('')
|
||||
: result.slice(0, length);
|
||||
}
|
||||
|
||||
|
||||
@@ -4,9 +4,8 @@ define(['./_apply', './_createCtorWrapper', './_root'], function(apply, createCt
|
||||
var BIND_FLAG = 1;
|
||||
|
||||
/**
|
||||
* Creates a function that wraps `func` to invoke it with the optional `this`
|
||||
* binding of `thisArg` and the `partials` prepended to those provided to
|
||||
* the wrapper.
|
||||
* Creates a function that wraps `func` to invoke it with the `this` binding
|
||||
* of `thisArg` and `partials` prepended to the arguments it receives.
|
||||
*
|
||||
* @private
|
||||
* @param {Function} func The function to wrap.
|
||||
|
||||
@@ -77,7 +77,8 @@ define(['./_Symbol', './_Uint8Array', './_equalArrays', './_mapToArray', './_set
|
||||
case regexpTag:
|
||||
case stringTag:
|
||||
// Coerce regexes to strings and treat strings, primitives and objects,
|
||||
// as equal. See https://es5.github.io/#x15.10.6.4 for more details.
|
||||
// as equal. See http://www.ecma-international.org/ecma-262/6.0/#sec-regexp.prototype.tostring
|
||||
// for more details.
|
||||
return object == (other + '');
|
||||
|
||||
case mapTag:
|
||||
|
||||
25
_getTag.js
25
_getTag.js
@@ -1,4 +1,7 @@
|
||||
define(['./_DataView', './_Map', './_Promise', './_Set', './_WeakMap'], function(DataView, Map, Promise, Set, WeakMap) {
|
||||
define(['./_DataView', './_Map', './_Promise', './_Set', './_WeakMap', './_toSource'], function(DataView, Map, Promise, Set, WeakMap, toSource) {
|
||||
|
||||
/** Used as a safe reference for `undefined` in pre-ES5 environments. */
|
||||
var undefined;
|
||||
|
||||
/** `Object#toString` result references. */
|
||||
var mapTag = '[object Map]',
|
||||
@@ -12,21 +15,19 @@ define(['./_DataView', './_Map', './_Promise', './_Set', './_WeakMap'], function
|
||||
/** Used for built-in method references. */
|
||||
var objectProto = Object.prototype;
|
||||
|
||||
/** Used to resolve the decompiled source of functions. */
|
||||
var funcToString = Function.prototype.toString;
|
||||
|
||||
/**
|
||||
* Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
|
||||
* Used to resolve the
|
||||
* [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
|
||||
* of values.
|
||||
*/
|
||||
var objectToString = objectProto.toString;
|
||||
|
||||
/** Used to detect maps, sets, and weakmaps. */
|
||||
var dataViewCtorString = DataView ? (DataView + '') : '',
|
||||
mapCtorString = Map ? funcToString.call(Map) : '',
|
||||
promiseCtorString = Promise ? funcToString.call(Promise) : '',
|
||||
setCtorString = Set ? funcToString.call(Set) : '',
|
||||
weakMapCtorString = WeakMap ? funcToString.call(WeakMap) : '';
|
||||
var dataViewCtorString = toSource(DataView),
|
||||
mapCtorString = toSource(Map),
|
||||
promiseCtorString = toSource(Promise),
|
||||
setCtorString = toSource(Set),
|
||||
weakMapCtorString = toSource(WeakMap);
|
||||
|
||||
/**
|
||||
* Gets the `toStringTag` of `value`.
|
||||
@@ -48,8 +49,8 @@ define(['./_DataView', './_Map', './_Promise', './_Set', './_WeakMap'], function
|
||||
(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) : '';
|
||||
Ctor = result == objectTag ? value.constructor : undefined,
|
||||
ctorString = Ctor ? toSource(Ctor) : undefined;
|
||||
|
||||
if (ctorString) {
|
||||
switch (ctorString) {
|
||||
|
||||
39
_hasPath.js
39
_hasPath.js
@@ -1,7 +1,4 @@
|
||||
define(['./_baseCastPath', './isArguments', './isArray', './_isIndex', './_isKey', './isLength', './isString'], function(baseCastPath, isArguments, isArray, isIndex, isKey, isLength, isString) {
|
||||
|
||||
/** Used as a safe reference for `undefined` in pre-ES5 environments. */
|
||||
var undefined;
|
||||
define(['./_castPath', './isArguments', './isArray', './_isIndex', './_isKey', './isLength', './isString'], function(castPath, isArguments, isArray, isIndex, isKey, isLength, isString) {
|
||||
|
||||
/**
|
||||
* Checks if `path` exists on `object`.
|
||||
@@ -13,29 +10,25 @@ define(['./_baseCastPath', './isArguments', './isArray', './_isIndex', './_isKey
|
||||
* @returns {boolean} Returns `true` if `path` exists, else `false`.
|
||||
*/
|
||||
function hasPath(object, path, hasFunc) {
|
||||
if (object == null) {
|
||||
return false;
|
||||
}
|
||||
var result = hasFunc(object, path);
|
||||
if (!result && !isKey(path)) {
|
||||
path = baseCastPath(path);
|
||||
path = isKey(path, object) ? [path] : castPath(path);
|
||||
|
||||
var index = -1,
|
||||
length = path.length;
|
||||
var result,
|
||||
index = -1,
|
||||
length = path.length;
|
||||
|
||||
while (object != null && ++index < length) {
|
||||
var key = path[index];
|
||||
if (!(result = hasFunc(object, key))) {
|
||||
break;
|
||||
}
|
||||
object = object[key];
|
||||
while (++index < length) {
|
||||
var key = path[index];
|
||||
if (!(result = object != null && hasFunc(object, key))) {
|
||||
break;
|
||||
}
|
||||
object = object[key];
|
||||
}
|
||||
var length = object ? object.length : undefined;
|
||||
return result || (
|
||||
!!length && isLength(length) && isIndex(path, length) &&
|
||||
(isArray(object) || isString(object) || isArguments(object))
|
||||
);
|
||||
if (result) {
|
||||
return result;
|
||||
}
|
||||
var length = object ? object.length : 0;
|
||||
return !!length && isLength(length) && isIndex(key, length) &&
|
||||
(isArray(object) || isString(object) || isArguments(object));
|
||||
}
|
||||
|
||||
return hasPath;
|
||||
|
||||
15
_isFlattenable.js
Normal file
15
_isFlattenable.js
Normal file
@@ -0,0 +1,15 @@
|
||||
define(['./isArguments', './isArray', './isArrayLikeObject'], function(isArguments, isArray, isArrayLikeObject) {
|
||||
|
||||
/**
|
||||
* Checks if `value` is a flattenable `arguments` object or array.
|
||||
*
|
||||
* @private
|
||||
* @param {*} value The value to check.
|
||||
* @returns {boolean} Returns `true` if `value` is flattenable, else `false`.
|
||||
*/
|
||||
function isFlattenable(value) {
|
||||
return isArrayLikeObject(value) && (isArray(value) || isArguments(value));
|
||||
}
|
||||
|
||||
return isFlattenable;
|
||||
});
|
||||
16
_isFlattenableIteratee.js
Normal file
16
_isFlattenableIteratee.js
Normal file
@@ -0,0 +1,16 @@
|
||||
define(['./isArray', './isFunction'], function(isArray, isFunction) {
|
||||
|
||||
/**
|
||||
* 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]));
|
||||
}
|
||||
|
||||
return isFlattenableIteratee;
|
||||
});
|
||||
26
_matchesStrictComparable.js
Normal file
26
_matchesStrictComparable.js
Normal file
@@ -0,0 +1,26 @@
|
||||
define([], function() {
|
||||
|
||||
/** Used as a safe reference for `undefined` in pre-ES5 environments. */
|
||||
var undefined;
|
||||
|
||||
/**
|
||||
* A specialized version of `matchesProperty` for source values suitable
|
||||
* for strict equality comparisons, i.e. `===`.
|
||||
*
|
||||
* @private
|
||||
* @param {string} key The key of the property to get.
|
||||
* @param {*} srcValue The value to match.
|
||||
* @returns {Function} Returns the new function.
|
||||
*/
|
||||
function matchesStrictComparable(key, srcValue) {
|
||||
return function(object) {
|
||||
if (object == null) {
|
||||
return false;
|
||||
}
|
||||
return object[key] === srcValue &&
|
||||
(srcValue !== undefined || (key in Object(object)));
|
||||
};
|
||||
}
|
||||
|
||||
return matchesStrictComparable;
|
||||
});
|
||||
16
_reHasComplexSymbol.js
Normal file
16
_reHasComplexSymbol.js
Normal file
@@ -0,0 +1,16 @@
|
||||
define([], function() {
|
||||
|
||||
/** Used to compose unicode character classes. */
|
||||
var rsAstralRange = '\\ud800-\\udfff',
|
||||
rsComboMarksRange = '\\u0300-\\u036f\\ufe20-\\ufe23',
|
||||
rsComboSymbolsRange = '\\u20d0-\\u20f0',
|
||||
rsVarRange = '\\ufe0e\\ufe0f';
|
||||
|
||||
/** Used to compose unicode capture groups. */
|
||||
var rsZWJ = '\\u200d';
|
||||
|
||||
/** Used to detect strings with [zero-width joiners or code points from the astral planes](http://eev.ee/blog/2015/09/12/dark-corners-of-unicode/). */
|
||||
var reHasComplexSymbol = RegExp('[' + rsZWJ + rsAstralRange + rsComboMarksRange + rsComboSymbolsRange + rsVarRange + ']');
|
||||
|
||||
return reHasComplexSymbol;
|
||||
});
|
||||
@@ -1,4 +1,4 @@
|
||||
define([], function() {
|
||||
define(['./_reHasComplexSymbol'], function(reHasComplexSymbol) {
|
||||
|
||||
/** Used to compose unicode character classes. */
|
||||
var rsAstralRange = '\\ud800-\\udfff',
|
||||
@@ -26,9 +26,6 @@ define([], function() {
|
||||
/** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */
|
||||
var reComplexSymbol = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g');
|
||||
|
||||
/** Used to detect strings with [zero-width joiners or code points from the astral planes](http://eev.ee/blog/2015/09/12/dark-corners-of-unicode/). */
|
||||
var reHasComplexSymbol = RegExp('[' + rsZWJ + rsAstralRange + rsComboMarksRange + rsComboSymbolsRange + rsVarRange + ']');
|
||||
|
||||
/**
|
||||
* Gets the number of symbols in `string`.
|
||||
*
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
define(['./isSymbol'], function(isSymbol) {
|
||||
|
||||
/**
|
||||
* Casts `value` to a string if it's not a string or symbol.
|
||||
* Converts `value` to a string key if it's not a string or symbol.
|
||||
*
|
||||
* @private
|
||||
* @param {*} value The value to inspect.
|
||||
* @returns {string|symbol} Returns the cast key.
|
||||
* @returns {string|symbol} Returns the key.
|
||||
*/
|
||||
function baseCastKey(key) {
|
||||
function toKey(key) {
|
||||
return (typeof key == 'string' || isSymbol(key)) ? key : (key + '');
|
||||
}
|
||||
|
||||
return baseCastKey;
|
||||
return toKey;
|
||||
});
|
||||
26
_toSource.js
Normal file
26
_toSource.js
Normal file
@@ -0,0 +1,26 @@
|
||||
define([], function() {
|
||||
|
||||
/** Used to resolve the decompiled source of functions. */
|
||||
var funcToString = Function.prototype.toString;
|
||||
|
||||
/**
|
||||
* Converts `func` to its source code.
|
||||
*
|
||||
* @private
|
||||
* @param {Function} func The function to process.
|
||||
* @returns {string} Returns the source code.
|
||||
*/
|
||||
function toSource(func) {
|
||||
if (func != null) {
|
||||
try {
|
||||
return funcToString.call(func);
|
||||
} catch (e) {}
|
||||
try {
|
||||
return (func + '');
|
||||
} catch (e) {}
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
return toSource;
|
||||
});
|
||||
4
ary.js
4
ary.js
@@ -7,8 +7,8 @@ define(['./_createWrapper'], function(createWrapper) {
|
||||
var ARY_FLAG = 128;
|
||||
|
||||
/**
|
||||
* Creates a function that accepts up to `n` arguments, ignoring any
|
||||
* additional arguments.
|
||||
* Creates a function that invokes `func`, with up to `n` arguments,
|
||||
* ignoring any additional arguments.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
|
||||
@@ -3,7 +3,7 @@ define(['./_copyObjectWith', './_createAssigner', './keysIn'], function(copyObje
|
||||
/**
|
||||
* This method is like `_.assignIn` except that it accepts `customizer`
|
||||
* which is invoked to produce the assigned values. If `customizer` returns
|
||||
* `undefined` assignment is handled by the method instead. The `customizer`
|
||||
* `undefined`, assignment is handled by the method instead. The `customizer`
|
||||
* is invoked with five arguments: (objValue, srcValue, key, object, source).
|
||||
*
|
||||
* **Note:** This method mutates `object`.
|
||||
|
||||
@@ -3,7 +3,7 @@ define(['./_copyObjectWith', './_createAssigner', './keys'], function(copyObject
|
||||
/**
|
||||
* This method is like `_.assign` except that it accepts `customizer`
|
||||
* which is invoked to produce the assigned values. If `customizer` returns
|
||||
* `undefined` assignment is handled by the method instead. The `customizer`
|
||||
* `undefined`, assignment is handled by the method instead. The `customizer`
|
||||
* is invoked with five arguments: (objValue, srcValue, key, object, source).
|
||||
*
|
||||
* **Note:** This method mutates `object`.
|
||||
|
||||
3
at.js
3
at.js
@@ -8,8 +8,7 @@ define(['./_baseAt', './_baseFlatten', './rest'], function(baseAt, baseFlatten,
|
||||
* @since 1.0.0
|
||||
* @category Object
|
||||
* @param {Object} object The object to iterate over.
|
||||
* @param {...(string|string[])} [paths] The property paths of elements to pick,
|
||||
* specified individually or in arrays.
|
||||
* @param {...(string|string[])} [paths] The property paths of elements to pick.
|
||||
* @returns {Array} Returns the new array of picked elements.
|
||||
* @example
|
||||
*
|
||||
|
||||
3
bind.js
3
bind.js
@@ -6,8 +6,7 @@ define(['./_createWrapper', './_getPlaceholder', './_replaceHolders', './rest'],
|
||||
|
||||
/**
|
||||
* Creates a function that invokes `func` with the `this` binding of `thisArg`
|
||||
* and prepends any additional `_.bind` arguments to those provided to the
|
||||
* bound function.
|
||||
* and `partials` prepended to the arguments it receives.
|
||||
*
|
||||
* The `_.bind.placeholder` value, which defaults to `_` in monolithic builds,
|
||||
* may be used as a placeholder for partially applied arguments.
|
||||
|
||||
@@ -11,8 +11,7 @@ define(['./_arrayEach', './_baseFlatten', './bind', './rest'], function(arrayEac
|
||||
* @memberOf _
|
||||
* @category Util
|
||||
* @param {Object} object The object to bind and assign the bound methods to.
|
||||
* @param {...(string|string[])} methodNames The object method names to bind,
|
||||
* specified individually or in arrays.
|
||||
* @param {...(string|string[])} methodNames The object method names to bind.
|
||||
* @returns {Object} Returns `object`.
|
||||
* @example
|
||||
*
|
||||
|
||||
@@ -6,8 +6,8 @@ define(['./_createWrapper', './_getPlaceholder', './_replaceHolders', './rest'],
|
||||
PARTIAL_FLAG = 32;
|
||||
|
||||
/**
|
||||
* Creates a function that invokes the method at `object[key]` and prepends
|
||||
* any additional `_.bindKey` arguments to those provided to the bound function.
|
||||
* Creates a function that invokes the method at `object[key]` with `partials`
|
||||
* prepended to the arguments it receives.
|
||||
*
|
||||
* This method differs from `_.bind` by allowing bound functions to reference
|
||||
* methods that may be redefined or don't yet exist. See
|
||||
|
||||
17
chunk.js
17
chunk.js
@@ -1,4 +1,7 @@
|
||||
define(['./_baseSlice', './toInteger'], function(baseSlice, toInteger) {
|
||||
define(['./_baseSlice', './_isIterateeCall', './toInteger'], function(baseSlice, isIterateeCall, toInteger) {
|
||||
|
||||
/** Used as a safe reference for `undefined` in pre-ES5 environments. */
|
||||
var undefined;
|
||||
|
||||
/* Built-in method references for those with the same name as other `lodash` methods. */
|
||||
var nativeCeil = Math.ceil,
|
||||
@@ -14,7 +17,8 @@ define(['./_baseSlice', './toInteger'], function(baseSlice, toInteger) {
|
||||
* @since 3.0.0
|
||||
* @category Array
|
||||
* @param {Array} array The array to process.
|
||||
* @param {number} [size=0] The length of each chunk.
|
||||
* @param {number} [size=1] The length of each chunk
|
||||
* @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
|
||||
* @returns {Array} Returns the new array containing chunks.
|
||||
* @example
|
||||
*
|
||||
@@ -24,9 +28,12 @@ define(['./_baseSlice', './toInteger'], function(baseSlice, toInteger) {
|
||||
* _.chunk(['a', 'b', 'c', 'd'], 3);
|
||||
* // => [['a', 'b', 'c'], ['d']]
|
||||
*/
|
||||
function chunk(array, size) {
|
||||
size = nativeMax(toInteger(size), 0);
|
||||
|
||||
function chunk(array, size, guard) {
|
||||
if ((guard ? isIterateeCall(array, size, guard) : size === undefined)) {
|
||||
size = 1;
|
||||
} else {
|
||||
size = nativeMax(toInteger(size), 0);
|
||||
}
|
||||
var length = array ? array.length : 0;
|
||||
if (!length || size < 1) {
|
||||
return [];
|
||||
|
||||
@@ -2,7 +2,7 @@ define(['./_baseClone'], function(baseClone) {
|
||||
|
||||
/**
|
||||
* This method is like `_.clone` except that it accepts `customizer` which
|
||||
* is invoked to produce the cloned value. If `customizer` returns `undefined`
|
||||
* is invoked to produce the cloned value. If `customizer` returns `undefined`,
|
||||
* cloning is handled by the method instead. The `customizer` is invoked with
|
||||
* up to four arguments; (value [, index|key, object, stack]).
|
||||
*
|
||||
|
||||
2
cond.js
2
cond.js
@@ -4,7 +4,7 @@ define(['./_apply', './_arrayMap', './_baseIteratee', './rest'], function(apply,
|
||||
var FUNC_ERROR_TEXT = 'Expected a function';
|
||||
|
||||
/**
|
||||
* Creates a function that iterates over `pairs` invoking the corresponding
|
||||
* Creates a function that iterates over `pairs` and invokes the corresponding
|
||||
* function of the first predicate to return truthy. The predicate-function
|
||||
* pairs are invoked with the `this` binding and arguments of the created
|
||||
* function.
|
||||
|
||||
@@ -8,9 +8,9 @@ define(['./_createAggregator'], function(createAggregator) {
|
||||
|
||||
/**
|
||||
* Creates an object composed of keys generated from the results of running
|
||||
* each element of `collection` through `iteratee`. The corresponding value
|
||||
* of each key is the number of times the key was returned by `iteratee`.
|
||||
* The iteratee is invoked with one argument: (value).
|
||||
* each element of `collection` thru `iteratee`. The corresponding value of
|
||||
* each key is the number of times the key was returned by `iteratee`. The
|
||||
* iteratee is invoked with one argument: (value).
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
|
||||
@@ -2,7 +2,7 @@ define(['./_baseAssign', './_baseCreate'], function(baseAssign, baseCreate) {
|
||||
|
||||
/**
|
||||
* Creates an object that inherits from the `prototype` object. If a
|
||||
* `properties` object is given its own enumerable string keyed properties
|
||||
* `properties` object is given, its own enumerable string keyed properties
|
||||
* are assigned to the created object.
|
||||
*
|
||||
* @static
|
||||
|
||||
@@ -24,7 +24,7 @@ define(['./isObject', './now', './toNumber'], function(isObject, now, toNumber)
|
||||
* on the trailing edge of the timeout only if the debounced function is
|
||||
* invoked more than once during the `wait` timeout.
|
||||
*
|
||||
* See [David Corbacho's article](http://drupalmotion.com/article/debounce-and-throttle-visual-explanation)
|
||||
* See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
|
||||
* for details over the differences between `_.debounce` and `_.throttle`.
|
||||
*
|
||||
* @static
|
||||
@@ -170,6 +170,9 @@ define(['./isObject', './now', './toNumber'], function(isObject, now, toNumber)
|
||||
timerId = setTimeout(timerExpired, wait);
|
||||
return invokeFunc(lastCallTime);
|
||||
}
|
||||
if (timerId === undefined) {
|
||||
timerId = setTimeout(timerExpired, wait);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
debounced.cancel = cancel;
|
||||
|
||||
@@ -20,7 +20,7 @@ define(['./_baseDifference', './_baseFlatten', './isArrayLikeObject', './rest'],
|
||||
*/
|
||||
var difference = rest(function(array, values) {
|
||||
return isArrayLikeObject(array)
|
||||
? baseDifference(array, baseFlatten(values, 1, true))
|
||||
? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true))
|
||||
: [];
|
||||
});
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ define(['./_baseDifference', './_baseFlatten', './_baseIteratee', './isArrayLike
|
||||
iteratee = undefined;
|
||||
}
|
||||
return isArrayLikeObject(array)
|
||||
? baseDifference(array, baseFlatten(values, 1, true), baseIteratee(iteratee))
|
||||
? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), baseIteratee(iteratee))
|
||||
: [];
|
||||
});
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ define(['./_baseDifference', './_baseFlatten', './isArrayLikeObject', './last',
|
||||
comparator = undefined;
|
||||
}
|
||||
return isArrayLikeObject(array)
|
||||
? baseDifference(array, baseFlatten(values, 1, true), undefined, comparator)
|
||||
? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), undefined, comparator)
|
||||
: [];
|
||||
});
|
||||
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
define(['./toString'], function(toString) {
|
||||
|
||||
/** Used to match `RegExp` [syntax characters](http://ecma-international.org/ecma-262/6.0/#sec-patterns). */
|
||||
/**
|
||||
* Used to match `RegExp`
|
||||
* [syntax characters](http://ecma-international.org/ecma-262/6.0/#sec-patterns).
|
||||
*/
|
||||
var reRegExpChar = /[\\^$.*+?()[\]{}|]/g,
|
||||
reHasRegExpChar = RegExp(reRegExpChar.source);
|
||||
|
||||
|
||||
@@ -2,8 +2,8 @@ define(['./_baseFlatten', './map'], function(baseFlatten, map) {
|
||||
|
||||
/**
|
||||
* Creates a flattened array of values by running each element in `collection`
|
||||
* through `iteratee` and flattening the mapped results. The iteratee is
|
||||
* invoked with three arguments: (value, index|key, collection).
|
||||
* thru `iteratee` and flattening the mapped results. The iteratee is invoked
|
||||
* with three arguments: (value, index|key, collection).
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
define(['./_arrayEach', './_baseEach', './_baseIteratee', './isArray'], function(arrayEach, baseEach, baseIteratee, isArray) {
|
||||
|
||||
/**
|
||||
* Iterates over elements of `collection` invoking `iteratee` for each element.
|
||||
* Iterates over elements of `collection` and invokes `iteratee` for each element.
|
||||
* The iteratee is invoked with three arguments: (value, index|key, collection).
|
||||
* Iteratee functions may exit iteration early by explicitly returning `false`.
|
||||
*
|
||||
|
||||
6
forIn.js
6
forIn.js
@@ -2,9 +2,9 @@ define(['./_baseFor', './_baseIteratee', './keysIn'], function(baseFor, baseIter
|
||||
|
||||
/**
|
||||
* Iterates over own and inherited enumerable string keyed properties of an
|
||||
* object invoking `iteratee` for each property. The iteratee is invoked with
|
||||
* three arguments: (value, key, object). Iteratee functions may exit iteration
|
||||
* early by explicitly returning `false`.
|
||||
* object and invokes `iteratee` for each property. The iteratee is invoked
|
||||
* with three arguments: (value, key, object). Iteratee functions may exit
|
||||
* iteration early by explicitly returning `false`.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
define(['./_baseForOwn', './_baseIteratee'], function(baseForOwn, baseIteratee) {
|
||||
|
||||
/**
|
||||
* Iterates over own enumerable string keyed properties of an object invoking
|
||||
* `iteratee` for each property. The iteratee is invoked with three arguments:
|
||||
* (value, key, object). Iteratee functions may exit iteration early by
|
||||
* explicitly returning `false`.
|
||||
* Iterates over own enumerable string keyed properties of an object and
|
||||
* invokes `iteratee` for each property. The iteratee is invoked with three
|
||||
* arguments: (value, key, object). Iteratee functions may exit iteration
|
||||
* early by explicitly returning `false`.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
|
||||
2
get.js
2
get.js
@@ -5,7 +5,7 @@ define(['./_baseGet'], function(baseGet) {
|
||||
|
||||
/**
|
||||
* Gets the value at `path` of `object`. If the resolved value is
|
||||
* `undefined` the `defaultValue` is used in its place.
|
||||
* `undefined`, the `defaultValue` is used in its place.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
|
||||
@@ -8,9 +8,10 @@ define(['./_createAggregator'], function(createAggregator) {
|
||||
|
||||
/**
|
||||
* Creates an object composed of keys generated from the results of running
|
||||
* each element of `collection` through `iteratee`. The corresponding value
|
||||
* of each key is an array of elements responsible for generating the key.
|
||||
* The iteratee is invoked with one argument: (value).
|
||||
* each element of `collection` thru `iteratee`. The order of grouped values
|
||||
* is determined by the order they occur in `collection`. The corresponding
|
||||
* value of each key is an array of elements responsible for generating the
|
||||
* key. The iteratee is invoked with one argument: (value).
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
|
||||
10
has.js
10
has.js
@@ -12,23 +12,23 @@ define(['./_baseHas', './_hasPath'], function(baseHas, hasPath) {
|
||||
* @returns {boolean} Returns `true` if `path` exists, else `false`.
|
||||
* @example
|
||||
*
|
||||
* var object = { 'a': { 'b': { 'c': 3 } } };
|
||||
* var other = _.create({ 'a': _.create({ 'b': _.create({ 'c': 3 }) }) });
|
||||
* var object = { 'a': { 'b': 2 } };
|
||||
* var other = _.create({ 'a': _.create({ 'b': 2 }) });
|
||||
*
|
||||
* _.has(object, 'a');
|
||||
* // => true
|
||||
*
|
||||
* _.has(object, 'a.b.c');
|
||||
* _.has(object, 'a.b');
|
||||
* // => true
|
||||
*
|
||||
* _.has(object, ['a', 'b', 'c']);
|
||||
* _.has(object, ['a', 'b']);
|
||||
* // => true
|
||||
*
|
||||
* _.has(other, 'a');
|
||||
* // => false
|
||||
*/
|
||||
function has(object, path) {
|
||||
return hasPath(object, path, baseHas);
|
||||
return object != null && hasPath(object, path, baseHas);
|
||||
}
|
||||
|
||||
return has;
|
||||
|
||||
8
hasIn.js
8
hasIn.js
@@ -12,22 +12,22 @@ define(['./_baseHasIn', './_hasPath'], function(baseHasIn, hasPath) {
|
||||
* @returns {boolean} Returns `true` if `path` exists, else `false`.
|
||||
* @example
|
||||
*
|
||||
* var object = _.create({ 'a': _.create({ 'b': _.create({ 'c': 3 }) }) });
|
||||
* var object = _.create({ 'a': _.create({ 'b': 2 }) });
|
||||
*
|
||||
* _.hasIn(object, 'a');
|
||||
* // => true
|
||||
*
|
||||
* _.hasIn(object, 'a.b.c');
|
||||
* _.hasIn(object, 'a.b');
|
||||
* // => true
|
||||
*
|
||||
* _.hasIn(object, ['a', 'b', 'c']);
|
||||
* _.hasIn(object, ['a', 'b']);
|
||||
* // => true
|
||||
*
|
||||
* _.hasIn(object, 'b');
|
||||
* // => false
|
||||
*/
|
||||
function hasIn(object, path) {
|
||||
return hasPath(object, path, baseHasIn);
|
||||
return object != null && hasPath(object, path, baseHasIn);
|
||||
}
|
||||
|
||||
return hasIn;
|
||||
|
||||
@@ -5,7 +5,7 @@ define(['./_baseInRange', './toNumber'], function(baseInRange, toNumber) {
|
||||
|
||||
/**
|
||||
* Checks if `n` is between `start` and up to but not including, `end`. If
|
||||
* `end` is not specified it's set to `start` with `start` then set to `0`.
|
||||
* `end` is not specified, it's set to `start` with `start` then set to `0`.
|
||||
* If `start` is greater than `end` the params are swapped to support
|
||||
* negative ranges.
|
||||
*
|
||||
|
||||
@@ -4,7 +4,7 @@ define(['./_baseIndexOf', './isArrayLike', './isString', './toInteger', './value
|
||||
var nativeMax = Math.max;
|
||||
|
||||
/**
|
||||
* Checks if `value` is in `collection`. If `collection` is a string it's
|
||||
* Checks if `value` is in `collection`. If `collection` is a string, it's
|
||||
* checked for a substring of `value`, otherwise
|
||||
* [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
|
||||
* is used for equality comparisons. If `fromIndex` is negative, it's used as
|
||||
|
||||
@@ -6,8 +6,8 @@ define(['./_baseIndexOf', './toInteger'], function(baseIndexOf, toInteger) {
|
||||
/**
|
||||
* Gets the index at which the first occurrence of `value` is found in `array`
|
||||
* using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
|
||||
* for equality comparisons. If `fromIndex` is negative, it's used as the offset
|
||||
* from the end of `array`.
|
||||
* for equality comparisons. If `fromIndex` is negative, it's used as the
|
||||
* offset from the end of `array`.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
define(['./_arrayMap', './_baseCastArrayLikeObject', './_baseIntersection', './rest'], function(arrayMap, baseCastArrayLikeObject, baseIntersection, rest) {
|
||||
define(['./_arrayMap', './_baseIntersection', './_castArrayLikeObject', './rest'], function(arrayMap, baseIntersection, castArrayLikeObject, rest) {
|
||||
|
||||
/**
|
||||
* Creates an array of unique values that are included in all given arrays
|
||||
@@ -18,7 +18,7 @@ define(['./_arrayMap', './_baseCastArrayLikeObject', './_baseIntersection', './r
|
||||
* // => [2]
|
||||
*/
|
||||
var intersection = rest(function(arrays) {
|
||||
var mapped = arrayMap(arrays, baseCastArrayLikeObject);
|
||||
var mapped = arrayMap(arrays, castArrayLikeObject);
|
||||
return (mapped.length && mapped[0] === arrays[0])
|
||||
? baseIntersection(mapped)
|
||||
: [];
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
define(['./_arrayMap', './_baseCastArrayLikeObject', './_baseIntersection', './_baseIteratee', './last', './rest'], function(arrayMap, baseCastArrayLikeObject, baseIntersection, baseIteratee, last, rest) {
|
||||
define(['./_arrayMap', './_baseIntersection', './_baseIteratee', './_castArrayLikeObject', './last', './rest'], function(arrayMap, baseIntersection, baseIteratee, castArrayLikeObject, last, rest) {
|
||||
|
||||
/** Used as a safe reference for `undefined` in pre-ES5 environments. */
|
||||
var undefined;
|
||||
@@ -28,7 +28,7 @@ define(['./_arrayMap', './_baseCastArrayLikeObject', './_baseIntersection', './_
|
||||
*/
|
||||
var intersectionBy = rest(function(arrays) {
|
||||
var iteratee = last(arrays),
|
||||
mapped = arrayMap(arrays, baseCastArrayLikeObject);
|
||||
mapped = arrayMap(arrays, castArrayLikeObject);
|
||||
|
||||
if (iteratee === last(mapped)) {
|
||||
iteratee = undefined;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
define(['./_arrayMap', './_baseCastArrayLikeObject', './_baseIntersection', './last', './rest'], function(arrayMap, baseCastArrayLikeObject, baseIntersection, last, rest) {
|
||||
define(['./_arrayMap', './_baseIntersection', './_castArrayLikeObject', './last', './rest'], function(arrayMap, baseIntersection, castArrayLikeObject, last, rest) {
|
||||
|
||||
/** Used as a safe reference for `undefined` in pre-ES5 environments. */
|
||||
var undefined;
|
||||
@@ -26,7 +26,7 @@ define(['./_arrayMap', './_baseCastArrayLikeObject', './_baseIntersection', './l
|
||||
*/
|
||||
var intersectionWith = rest(function(arrays) {
|
||||
var comparator = last(arrays),
|
||||
mapped = arrayMap(arrays, baseCastArrayLikeObject);
|
||||
mapped = arrayMap(arrays, castArrayLikeObject);
|
||||
|
||||
if (comparator === last(mapped)) {
|
||||
comparator = undefined;
|
||||
|
||||
@@ -8,8 +8,8 @@ define(['./_baseIteratee', './_createInverter'], function(baseIteratee, createIn
|
||||
|
||||
/**
|
||||
* This method is like `_.invert` except that the inverted object is generated
|
||||
* from the results of running each element of `object` through `iteratee`.
|
||||
* The corresponding inverted value of each inverted key is an array of keys
|
||||
* from the results of running each element of `object` thru `iteratee`. The
|
||||
* corresponding inverted value of each inverted key is an array of keys
|
||||
* responsible for generating the inverted value. The iteratee is invoked
|
||||
* with one argument: (value).
|
||||
*
|
||||
|
||||
@@ -6,8 +6,8 @@ define(['./_apply', './_baseEach', './_baseInvoke', './isArrayLike', './_isKey',
|
||||
/**
|
||||
* Invokes the method at `path` of each element in `collection`, returning
|
||||
* an array of the results of each invoked method. Any additional arguments
|
||||
* are provided to each invoked method. If `methodName` is a function it's
|
||||
* invoked for, and `this` bound to, each element in `collection`.
|
||||
* are provided to each invoked method. If `methodName` is a function, it's
|
||||
* invoked for and `this` bound to, each element in `collection`.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
|
||||
@@ -10,7 +10,8 @@ define(['./isArrayLikeObject'], function(isArrayLikeObject) {
|
||||
var hasOwnProperty = objectProto.hasOwnProperty;
|
||||
|
||||
/**
|
||||
* Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
|
||||
* Used to resolve the
|
||||
* [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
|
||||
* of values.
|
||||
*/
|
||||
var objectToString = objectProto.toString;
|
||||
|
||||
@@ -6,7 +6,8 @@ define(['./isObjectLike'], function(isObjectLike) {
|
||||
var objectProto = Object.prototype;
|
||||
|
||||
/**
|
||||
* Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
|
||||
* Used to resolve the
|
||||
* [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
|
||||
* of values.
|
||||
*/
|
||||
var objectToString = objectProto.toString;
|
||||
|
||||
@@ -7,7 +7,8 @@ define(['./isObjectLike'], function(isObjectLike) {
|
||||
var objectProto = Object.prototype;
|
||||
|
||||
/**
|
||||
* Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
|
||||
* Used to resolve the
|
||||
* [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
|
||||
* of values.
|
||||
*/
|
||||
var objectToString = objectProto.toString;
|
||||
|
||||
@@ -7,7 +7,8 @@ define(['./isObjectLike'], function(isObjectLike) {
|
||||
var objectProto = Object.prototype;
|
||||
|
||||
/**
|
||||
* Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
|
||||
* Used to resolve the
|
||||
* [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
|
||||
* of values.
|
||||
*/
|
||||
var objectToString = objectProto.toString;
|
||||
|
||||
@@ -5,7 +5,7 @@ define(['./_baseIsEqual'], function(baseIsEqual) {
|
||||
|
||||
/**
|
||||
* This method is like `_.isEqual` except that it accepts `customizer` which
|
||||
* is invoked to compare values. If `customizer` returns `undefined` comparisons
|
||||
* 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]).
|
||||
*
|
||||
|
||||
@@ -7,7 +7,8 @@ define(['./isObjectLike'], function(isObjectLike) {
|
||||
var objectProto = Object.prototype;
|
||||
|
||||
/**
|
||||
* Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
|
||||
* Used to resolve the
|
||||
* [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
|
||||
* of values.
|
||||
*/
|
||||
var objectToString = objectProto.toString;
|
||||
|
||||
@@ -8,7 +8,8 @@ define(['./isObject'], function(isObject) {
|
||||
var objectProto = Object.prototype;
|
||||
|
||||
/**
|
||||
* Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
|
||||
* Used to resolve the
|
||||
* [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
|
||||
* of values.
|
||||
*/
|
||||
var objectToString = objectProto.toString;
|
||||
|
||||
@@ -5,7 +5,7 @@ define(['./_baseIsMatch', './_getMatchData'], function(baseIsMatch, getMatchData
|
||||
|
||||
/**
|
||||
* This method is like `_.isMatch` except that it accepts `customizer` which
|
||||
* is invoked to compare values. If `customizer` returns `undefined` comparisons
|
||||
* is invoked to compare values. If `customizer` returns `undefined`, comparisons
|
||||
* are handled by the method instead. The `customizer` is invoked with five
|
||||
* arguments: (objValue, srcValue, index|key, object, source).
|
||||
*
|
||||
|
||||
7
isNaN.js
7
isNaN.js
@@ -3,9 +3,10 @@ define(['./isNumber'], function(isNumber) {
|
||||
/**
|
||||
* Checks if `value` is `NaN`.
|
||||
*
|
||||
* **Note:** This method is not the same as
|
||||
* [`isNaN`](https://es5.github.io/#x15.1.2.4) which returns `true` for
|
||||
* `undefined` and other non-numeric values.
|
||||
* **Note:** This method is based on
|
||||
* [`Number.isNaN`](https://mdn.io/Number/isNaN) and is not the same as
|
||||
* global [`isNaN`](https://mdn.io/isNaN) which returns `true` for
|
||||
* `undefined` and other non-number values.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
|
||||
16
isNative.js
16
isNative.js
@@ -1,6 +1,9 @@
|
||||
define(['./isFunction', './_isHostObject', './isObjectLike'], function(isFunction, isHostObject, isObjectLike) {
|
||||
define(['./isFunction', './_isHostObject', './isObject', './_toSource'], function(isFunction, isHostObject, isObject, toSource) {
|
||||
|
||||
/** Used to match `RegExp` [syntax characters](http://ecma-international.org/ecma-262/6.0/#sec-patterns). */
|
||||
/**
|
||||
* Used to match `RegExp`
|
||||
* [syntax characters](http://ecma-international.org/ecma-262/6.0/#sec-patterns).
|
||||
*/
|
||||
var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
|
||||
|
||||
/** Used to detect host constructors (Safari). */
|
||||
@@ -40,14 +43,11 @@ define(['./isFunction', './_isHostObject', './isObjectLike'], function(isFunctio
|
||||
* // => false
|
||||
*/
|
||||
function isNative(value) {
|
||||
if (value == null) {
|
||||
if (!isObject(value)) {
|
||||
return false;
|
||||
}
|
||||
if (isFunction(value)) {
|
||||
return reIsNative.test(funcToString.call(value));
|
||||
}
|
||||
return isObjectLike(value) &&
|
||||
(isHostObject(value) ? reIsNative : reIsHostCtor).test(value);
|
||||
var pattern = (isFunction(value) || isHostObject(value)) ? reIsNative : reIsHostCtor;
|
||||
return pattern.test(toSource(value));
|
||||
}
|
||||
|
||||
return isNative;
|
||||
|
||||
@@ -7,7 +7,8 @@ define(['./isObjectLike'], function(isObjectLike) {
|
||||
var objectProto = Object.prototype;
|
||||
|
||||
/**
|
||||
* Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
|
||||
* Used to resolve the
|
||||
* [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
|
||||
* of values.
|
||||
*/
|
||||
var objectToString = objectProto.toString;
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
define([], function() {
|
||||
|
||||
/**
|
||||
* Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`.
|
||||
* (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
|
||||
* Checks if `value` is the
|
||||
* [language type](http://www.ecma-international.org/ecma-262/6.0/#sec-ecmascript-language-types)
|
||||
* of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
|
||||
@@ -16,7 +16,8 @@ define(['./_getPrototype', './_isHostObject', './isObjectLike'], function(getPro
|
||||
var objectCtorString = funcToString.call(Object);
|
||||
|
||||
/**
|
||||
* Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
|
||||
* Used to resolve the
|
||||
* [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
|
||||
* of values.
|
||||
*/
|
||||
var objectToString = objectProto.toString;
|
||||
|
||||
@@ -7,7 +7,8 @@ define(['./isObject'], function(isObject) {
|
||||
var objectProto = Object.prototype;
|
||||
|
||||
/**
|
||||
* Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
|
||||
* Used to resolve the
|
||||
* [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
|
||||
* of values.
|
||||
*/
|
||||
var objectToString = objectProto.toString;
|
||||
|
||||
@@ -7,7 +7,8 @@ define(['./isArray', './isObjectLike'], function(isArray, isObjectLike) {
|
||||
var objectProto = Object.prototype;
|
||||
|
||||
/**
|
||||
* Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
|
||||
* Used to resolve the
|
||||
* [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
|
||||
* of values.
|
||||
*/
|
||||
var objectToString = objectProto.toString;
|
||||
|
||||
@@ -7,7 +7,8 @@ define(['./isObjectLike'], function(isObjectLike) {
|
||||
var objectProto = Object.prototype;
|
||||
|
||||
/**
|
||||
* Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
|
||||
* Used to resolve the
|
||||
* [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
|
||||
* of values.
|
||||
*/
|
||||
var objectToString = objectProto.toString;
|
||||
|
||||
@@ -47,7 +47,8 @@ define(['./isLength', './isObjectLike'], function(isLength, isObjectLike) {
|
||||
var objectProto = Object.prototype;
|
||||
|
||||
/**
|
||||
* Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
|
||||
* Used to resolve the
|
||||
* [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
|
||||
* of values.
|
||||
*/
|
||||
var objectToString = objectProto.toString;
|
||||
|
||||
@@ -7,7 +7,8 @@ define(['./isObjectLike'], function(isObjectLike) {
|
||||
var objectProto = Object.prototype;
|
||||
|
||||
/**
|
||||
* Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
|
||||
* Used to resolve the
|
||||
* [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
|
||||
* of values.
|
||||
*/
|
||||
var objectToString = objectProto.toString;
|
||||
|
||||
@@ -2,8 +2,8 @@ define(['./_baseClone', './_baseIteratee'], function(baseClone, baseIteratee) {
|
||||
|
||||
/**
|
||||
* Creates a function that invokes `func` with the arguments of the created
|
||||
* function. If `func` is a property name the created function returns the
|
||||
* property value for a given element. If `func` is an array or object the
|
||||
* function. If `func` is a property name, the created function returns the
|
||||
* property value for a given element. If `func` is an array or object, the
|
||||
* created function returns `true` for elements that contain the equivalent
|
||||
* source properties, otherwise it returns `false`.
|
||||
*
|
||||
|
||||
4
keyBy.js
4
keyBy.js
@@ -2,8 +2,8 @@ define(['./_createAggregator'], function(createAggregator) {
|
||||
|
||||
/**
|
||||
* Creates an object composed of keys generated from the results of running
|
||||
* each element of `collection` through `iteratee`. The corresponding value
|
||||
* of each key is the last element responsible for generating the key. The
|
||||
* each element of `collection` thru `iteratee`. The corresponding value of
|
||||
* each key is the last element responsible for generating the key. The
|
||||
* iteratee is invoked with one argument: (value).
|
||||
*
|
||||
* @static
|
||||
|
||||
10
map.js
10
map.js
@@ -1,7 +1,7 @@
|
||||
define(['./_arrayMap', './_baseIteratee', './_baseMap', './isArray'], function(arrayMap, baseIteratee, baseMap, isArray) {
|
||||
|
||||
/**
|
||||
* Creates an array of values by running each element in `collection` through
|
||||
* Creates an array of values by running each element in `collection` thru
|
||||
* `iteratee`. The iteratee is invoked with three arguments:
|
||||
* (value, index|key, collection).
|
||||
*
|
||||
@@ -9,10 +9,10 @@ define(['./_arrayMap', './_baseIteratee', './_baseMap', './isArray'], function(a
|
||||
* `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`.
|
||||
*
|
||||
* The guarded methods are:
|
||||
* `ary`, `curry`, `curryRight`, `drop`, `dropRight`, `every`, `fill`,
|
||||
* `invert`, `parseInt`, `random`, `range`, `rangeRight`, `slice`, `some`,
|
||||
* `sortBy`, `take`, `takeRight`, `template`, `trim`, `trimEnd`, `trimStart`,
|
||||
* and `words`
|
||||
* `ary`, `chunk`, `curry`, `curryRight`, `drop`, `dropRight`, `every`,
|
||||
* `fill`, `invert`, `parseInt`, `random`, `range`, `rangeRight`, `repeat`,
|
||||
* `sampleSize`, `slice`, `some`, `sortBy`, `split`, `take`, `takeRight`,
|
||||
* `template`, `trim`, `trimEnd`, `trimStart`, and `words`
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
|
||||
@@ -3,8 +3,8 @@ define(['./_baseForOwn', './_baseIteratee'], function(baseForOwn, baseIteratee)
|
||||
/**
|
||||
* The opposite of `_.mapValues`; this method creates an object with the
|
||||
* same values as `object` and keys generated by running each own enumerable
|
||||
* string keyed property of `object` through `iteratee`. The iteratee is
|
||||
* invoked with three arguments: (value, key, object).
|
||||
* string keyed property of `object` thru `iteratee`. The iteratee is invoked
|
||||
* with three arguments: (value, key, object).
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
define(['./_baseForOwn', './_baseIteratee'], function(baseForOwn, baseIteratee) {
|
||||
|
||||
/**
|
||||
* Creates an object with the same keys as `object` and values generated by
|
||||
* running each own enumerable string keyed property of `object` through
|
||||
* Creates an object with the same keys as `object` and values generated
|
||||
* by running each own enumerable string keyed property of `object` thru
|
||||
* `iteratee`. The iteratee is invoked with three arguments:
|
||||
* (value, key, object).
|
||||
*
|
||||
|
||||
2
max.js
2
max.js
@@ -4,7 +4,7 @@ define(['./_baseExtremum', './gt', './identity'], function(baseExtremum, gt, ide
|
||||
var undefined;
|
||||
|
||||
/**
|
||||
* Computes the maximum value of `array`. If `array` is empty or falsey
|
||||
* Computes the maximum value of `array`. If `array` is empty or falsey,
|
||||
* `undefined` is returned.
|
||||
*
|
||||
* @static
|
||||
|
||||
@@ -5,7 +5,7 @@ define(['./_MapCache'], function(MapCache) {
|
||||
|
||||
/**
|
||||
* Creates a function that memoizes the result of `func`. If `resolver` is
|
||||
* provided it determines the cache key for storing the result based on the
|
||||
* provided, it determines the cache key for storing the result based on the
|
||||
* arguments provided to the memoized function. By default, the first argument
|
||||
* provided to the memoized function is used as the map cache key. The `func`
|
||||
* is invoked with the `this` binding of the memoized function.
|
||||
|
||||
@@ -3,7 +3,7 @@ define(['./_baseMerge', './_createAssigner'], function(baseMerge, createAssigner
|
||||
/**
|
||||
* This method is like `_.merge` except that it accepts `customizer` which
|
||||
* is invoked to produce the merged values of the destination and source
|
||||
* properties. If `customizer` returns `undefined` merging is handled by the
|
||||
* properties. If `customizer` returns `undefined`, merging is handled by the
|
||||
* method instead. The `customizer` is invoked with seven arguments:
|
||||
* (objValue, srcValue, key, object, source, stack).
|
||||
*
|
||||
|
||||
@@ -14,14 +14,14 @@ define(['./_baseInvoke', './rest'], function(baseInvoke, rest) {
|
||||
* @example
|
||||
*
|
||||
* var objects = [
|
||||
* { 'a': { 'b': { 'c': _.constant(2) } } },
|
||||
* { 'a': { 'b': { 'c': _.constant(1) } } }
|
||||
* { 'a': { 'b': _.constant(2) } },
|
||||
* { 'a': { 'b': _.constant(1) } }
|
||||
* ];
|
||||
*
|
||||
* _.map(objects, _.method('a.b.c'));
|
||||
* _.map(objects, _.method('a.b'));
|
||||
* // => [2, 1]
|
||||
*
|
||||
* _.map(objects, _.method(['a', 'b', 'c']));
|
||||
* _.map(objects, _.method(['a', 'b']));
|
||||
* // => [2, 1]
|
||||
*/
|
||||
var method = rest(function(path, args) {
|
||||
|
||||
2
min.js
2
min.js
@@ -4,7 +4,7 @@ define(['./_baseExtremum', './identity', './lt'], function(baseExtremum, identit
|
||||
var undefined;
|
||||
|
||||
/**
|
||||
* Computes the minimum value of `array`. If `array` is empty or falsey
|
||||
* Computes the minimum value of `array`. If `array` is empty or falsey,
|
||||
* `undefined` is returned.
|
||||
*
|
||||
* @static
|
||||
|
||||
2
mixin.js
2
mixin.js
@@ -2,7 +2,7 @@ define(['./_arrayEach', './_arrayPush', './_baseFunctions', './_copyArray', './i
|
||||
|
||||
/**
|
||||
* Adds all own enumerable string keyed function properties of a source
|
||||
* object to the destination object. If `object` is a function then methods
|
||||
* object to the destination object. If `object` is a function, then methods
|
||||
* are added to its prototype as well.
|
||||
*
|
||||
* **Note:** Use `_.runInContext` to create a pristine `lodash` function to
|
||||
|
||||
7
omit.js
7
omit.js
@@ -1,4 +1,4 @@
|
||||
define(['./_arrayMap', './_baseCastKey', './_baseDifference', './_baseFlatten', './_basePick', './_getAllKeysIn', './rest'], function(arrayMap, baseCastKey, baseDifference, baseFlatten, basePick, getAllKeysIn, rest) {
|
||||
define(['./_arrayMap', './_baseDifference', './_baseFlatten', './_basePick', './_getAllKeysIn', './rest', './_toKey'], function(arrayMap, baseDifference, baseFlatten, basePick, getAllKeysIn, rest, toKey) {
|
||||
|
||||
/**
|
||||
* The opposite of `_.pick`; this method creates an object composed of the
|
||||
@@ -10,8 +10,7 @@ define(['./_arrayMap', './_baseCastKey', './_baseDifference', './_baseFlatten',
|
||||
* @memberOf _
|
||||
* @category Object
|
||||
* @param {Object} object The source object.
|
||||
* @param {...(string|string[])} [props] The property identifiers to omit,
|
||||
* specified individually or in arrays.
|
||||
* @param {...(string|string[])} [props] The property identifiers to omit.
|
||||
* @returns {Object} Returns the new object.
|
||||
* @example
|
||||
*
|
||||
@@ -24,7 +23,7 @@ define(['./_arrayMap', './_baseCastKey', './_baseDifference', './_baseFlatten',
|
||||
if (object == null) {
|
||||
return {};
|
||||
}
|
||||
props = arrayMap(baseFlatten(props, 1), baseCastKey);
|
||||
props = arrayMap(baseFlatten(props, 1), toKey);
|
||||
return basePick(object, baseDifference(getAllKeysIn(object), props));
|
||||
});
|
||||
|
||||
|
||||
7
over.js
7
over.js
@@ -1,14 +1,15 @@
|
||||
define(['./_arrayMap', './_createOver'], function(arrayMap, createOver) {
|
||||
|
||||
/**
|
||||
* Creates a function that invokes `iteratees` with the arguments provided
|
||||
* to the created function and returns their results.
|
||||
* Creates a function that invokes `iteratees` with the arguments it receives
|
||||
* and returns their results.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @since 4.0.0
|
||||
* @category Util
|
||||
* @param {...(Function|Function[])} iteratees The iteratees to invoke.
|
||||
* @param {...(Array|Array[]|Function|Function[]|Object|Object[]|string|string[])}
|
||||
* [iteratees=[_.identity]] The iteratees to invoke.
|
||||
* @returns {Function} Returns the new function.
|
||||
* @example
|
||||
*
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
define(['./_apply', './_arrayMap', './_baseFlatten', './_baseIteratee', './rest'], function(apply, arrayMap, baseFlatten, baseIteratee, rest) {
|
||||
define(['./_apply', './_arrayMap', './_baseFlatten', './_baseIteratee', './_isFlattenableIteratee', './rest'], function(apply, arrayMap, baseFlatten, baseIteratee, isFlattenableIteratee, rest) {
|
||||
|
||||
/* Built-in method references for those with the same name as other `lodash` methods. */
|
||||
var nativeMin = Math.min;
|
||||
@@ -12,8 +12,8 @@ define(['./_apply', './_arrayMap', './_baseFlatten', './_baseIteratee', './rest'
|
||||
* @memberOf _
|
||||
* @category Function
|
||||
* @param {Function} func The function to wrap.
|
||||
* @param {...(Function|Function[])} [transforms] The functions to transform
|
||||
* arguments, specified individually or in arrays.
|
||||
* @param {...(Array|Array[]|Function|Function[]|Object|Object[]|string|string[])}
|
||||
* [transforms[_.identity]] The functions to transform.
|
||||
* @returns {Function} Returns the new function.
|
||||
* @example
|
||||
*
|
||||
@@ -36,8 +36,7 @@ define(['./_apply', './_arrayMap', './_baseFlatten', './_baseIteratee', './rest'
|
||||
* // => [100, 10]
|
||||
*/
|
||||
var overArgs = rest(function(func, transforms) {
|
||||
transforms = arrayMap(baseFlatten(transforms, 1), baseIteratee);
|
||||
|
||||
transforms = arrayMap(baseFlatten(transforms, 1, isFlattenableIteratee), baseIteratee);
|
||||
var funcsLength = transforms.length;
|
||||
return rest(function(args) {
|
||||
var index = -1,
|
||||
|
||||
@@ -2,13 +2,14 @@ define(['./_arrayEvery', './_createOver'], function(arrayEvery, createOver) {
|
||||
|
||||
/**
|
||||
* Creates a function that checks if **all** of the `predicates` return
|
||||
* truthy when invoked with the arguments provided to the created function.
|
||||
* truthy when invoked with the arguments it receives.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @since 4.0.0
|
||||
* @category Util
|
||||
* @param {...(Function|Function[])} predicates The predicates to check.
|
||||
* @param {...(Array|Array[]|Function|Function[]|Object|Object[]|string|string[])}
|
||||
* [predicates=[_.identity]] The predicates to check.
|
||||
* @returns {Function} Returns the new function.
|
||||
* @example
|
||||
*
|
||||
|
||||
@@ -2,13 +2,14 @@ define(['./_arraySome', './_createOver'], function(arraySome, createOver) {
|
||||
|
||||
/**
|
||||
* Creates a function that checks if **any** of the `predicates` return
|
||||
* truthy when invoked with the arguments provided to the created function.
|
||||
* truthy when invoked with the arguments it receives.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @since 4.0.0
|
||||
* @category Util
|
||||
* @param {...(Function|Function[])} predicates The predicates to check.
|
||||
* @param {...(Array|Array[]|Function|Function[]|Object|Object[]|string|string[])}
|
||||
* [predicates=[_.identity]] The predicates to check.
|
||||
* @returns {Function} Returns the new function.
|
||||
* @example
|
||||
*
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
{
|
||||
"name": "lodash-amd",
|
||||
"version": "4.7.0",
|
||||
"version": "4.10.0",
|
||||
"description": "Lodash exported as AMD modules.",
|
||||
"homepage": "https://lodash.com/custom-builds",
|
||||
"license": "MIT",
|
||||
"main": "main.js",
|
||||
"private": true,
|
||||
"main": "main.js",
|
||||
"keywords": "amd, modules, stdlib, util",
|
||||
"author": "John-David Dalton <john.david.dalton@gmail.com> (http://allyoucanleet.com/)",
|
||||
"contributors": [
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user