Compare commits

...

3 Commits

Author SHA1 Message Date
John-David Dalton
57f1942947 Bump to v4.9.0. 2016-04-08 01:30:11 -07:00
John-David Dalton
8349627be6 Bump to v4.8.2. 2016-04-04 13:35:30 -07:00
John-David Dalton
a2438ffc51 Bump to v4.8.0. 2016-04-03 22:48:11 -07:00
97 changed files with 628 additions and 406 deletions

View File

@@ -1,6 +1,6 @@
# lodash-amd v4.7.0 # lodash-amd v4.9.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): Generated using [lodash-cli](https://www.npmjs.com/package/lodash-cli):
```bash ```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.9.0-amd) for more details.

View File

@@ -4,7 +4,7 @@ define(['./_nativeCreate'], function(nativeCreate) {
var objectProto = Object.prototype; var objectProto = Object.prototype;
/** /**
* Creates an hash object. * Creates a hash object.
* *
* @private * @private
* @constructor * @constructor

View File

@@ -7,7 +7,7 @@ define([], function() {
* @private * @private
* @param {Function} func The function to invoke. * @param {Function} func The function to invoke.
* @param {*} thisArg The `this` binding of `func`. * @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`. * @returns {*} Returns the result of `func`.
*/ */
function apply(func, thisArg, args) { function apply(func, thisArg, args) {

View File

@@ -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. * The base implementation of `_.flatten` with support for restricting flattening.
@@ -6,23 +6,24 @@ define(['./_arrayPush', './isArguments', './isArray', './isArrayLikeObject'], fu
* @private * @private
* @param {Array} array The array to flatten. * @param {Array} array The array to flatten.
* @param {number} depth The maximum recursion depth. * @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. * @param {Array} [result=[]] The initial result value.
* @returns {Array} Returns the new flattened array. * @returns {Array} Returns the new flattened array.
*/ */
function baseFlatten(array, depth, isStrict, result) { function baseFlatten(array, depth, predicate, isStrict, result) {
result || (result = []);
var index = -1, var index = -1,
length = array.length; length = array.length;
predicate || (predicate = isFlattenable);
result || (result = []);
while (++index < length) { while (++index < length) {
var value = array[index]; var value = array[index];
if (depth > 0 && isArrayLikeObject(value) && if (depth > 0 && predicate(value)) {
(isStrict || isArray(value) || isArguments(value))) {
if (depth > 1) { if (depth > 1) {
// Recursively flatten arrays (susceptible to call stack limits). // Recursively flatten arrays (susceptible to call stack limits).
baseFlatten(value, depth - 1, isStrict, result); baseFlatten(value, depth - 1, predicate, isStrict, result);
} else { } else {
arrayPush(result, value); arrayPush(result, value);
} }

View File

@@ -1,7 +1,4 @@
define(['./_baseIsMatch', './_getMatchData'], function(baseIsMatch, getMatchData) { define(['./_baseIsMatch', './_getMatchData', './_matchesStrictComparable'], function(baseIsMatch, getMatchData, matchesStrictComparable) {
/** Used as a safe reference for `undefined` in pre-ES5 environments. */
var undefined;
/** /**
* The base implementation of `_.matches` which doesn't clone `source`. * The base implementation of `_.matches` which doesn't clone `source`.
@@ -13,16 +10,7 @@ define(['./_baseIsMatch', './_getMatchData'], function(baseIsMatch, getMatchData
function baseMatches(source) { function baseMatches(source) {
var matchData = getMatchData(source); var matchData = getMatchData(source);
if (matchData.length == 1 && matchData[0][2]) { if (matchData.length == 1 && matchData[0][2]) {
var key = matchData[0][0], return matchesStrictComparable(matchData[0][0], matchData[0][1]);
value = matchData[0][1];
return function(object) {
if (object == null) {
return false;
}
return object[key] === value &&
(value !== undefined || (key in Object(object)));
};
} }
return function(object) { return function(object) {
return object === source || baseIsMatch(object, source, matchData); return object === source || baseIsMatch(object, source, matchData);

View File

@@ -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. */ /** Used as a safe reference for `undefined` in pre-ES5 environments. */
var undefined; var undefined;
@@ -16,6 +16,9 @@ define(['./_baseIsEqual', './get', './hasIn'], function(baseIsEqual, get, hasIn)
* @returns {Function} Returns the new function. * @returns {Function} Returns the new function.
*/ */
function baseMatchesProperty(path, srcValue) { function baseMatchesProperty(path, srcValue) {
if (isKey(path) && isStrictComparable(srcValue)) {
return matchesStrictComparable(path, srcValue);
}
return function(object) { return function(object) {
var objValue = get(object, path); var objValue = get(object, path);
return (objValue === undefined && objValue === srcValue) return (objValue === undefined && objValue === srcValue)

View File

@@ -10,8 +10,8 @@ define(['./_baseCreate', './isObject'], function(baseCreate, isObject) {
*/ */
function createCtorWrapper(Ctor) { function createCtorWrapper(Ctor) {
return function() { return function() {
// Use a `switch` statement to work with class constructors. // Use a `switch` statement to work with class constructors. See
// See http://ecma-international.org/ecma-262/6.0/#sec-ecmascript-function-objects-call-thisargument-argumentslist // http://ecma-international.org/ecma-262/6.0/#sec-ecmascript-function-objects-call-thisargument-argumentslist
// for more details. // for more details.
var args = arguments; var args = arguments;
switch (args.length) { switch (args.length) {

View File

@@ -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`. * Creates a function like `_.over`.
@@ -9,7 +9,7 @@ define(['./_apply', './_arrayMap', './_baseFlatten', './_baseIteratee', './rest'
*/ */
function createOver(arrayFunc) { function createOver(arrayFunc) {
return rest(function(iteratees) { return rest(function(iteratees) {
iteratees = arrayMap(baseFlatten(iteratees, 1), baseIteratee); iteratees = arrayMap(baseFlatten(iteratees, 1, isFlattenableIteratee), baseIteratee);
return rest(function(args) { return rest(function(args) {
var thisArg = this; var thisArg = this;
return arrayFunc(iteratees, function(iteratee) { return arrayFunc(iteratees, function(iteratee) {

View File

@@ -4,9 +4,8 @@ define(['./_apply', './_createCtorWrapper', './_root'], function(apply, createCt
var BIND_FLAG = 1; var BIND_FLAG = 1;
/** /**
* Creates a function that wraps `func` to invoke it with the optional `this` * Creates a function that wraps `func` to invoke it with the `this` binding
* binding of `thisArg` and the `partials` prepended to those provided to * of `thisArg` and `partials` prepended to the arguments it receives.
* the wrapper.
* *
* @private * @private
* @param {Function} func The function to wrap. * @param {Function} func The function to wrap.

View File

@@ -77,7 +77,8 @@ define(['./_Symbol', './_Uint8Array', './_equalArrays', './_mapToArray', './_set
case regexpTag: case regexpTag:
case stringTag: case stringTag:
// Coerce regexes to strings and treat strings, primitives and objects, // 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 + ''); return object == (other + '');
case mapTag: case mapTag:

View File

@@ -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. */ /** `Object#toString` result references. */
var mapTag = '[object Map]', var mapTag = '[object Map]',
@@ -12,21 +15,19 @@ define(['./_DataView', './_Map', './_Promise', './_Set', './_WeakMap'], function
/** Used for built-in method references. */ /** Used for built-in method references. */
var objectProto = Object.prototype; 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. * of values.
*/ */
var objectToString = objectProto.toString; var objectToString = objectProto.toString;
/** Used to detect maps, sets, and weakmaps. */ /** Used to detect maps, sets, and weakmaps. */
var dataViewCtorString = DataView ? (DataView + '') : '', var dataViewCtorString = toSource(DataView),
mapCtorString = Map ? funcToString.call(Map) : '', mapCtorString = toSource(Map),
promiseCtorString = Promise ? funcToString.call(Promise) : '', promiseCtorString = toSource(Promise),
setCtorString = Set ? funcToString.call(Set) : '', setCtorString = toSource(Set),
weakMapCtorString = WeakMap ? funcToString.call(WeakMap) : ''; weakMapCtorString = toSource(WeakMap);
/** /**
* Gets the `toStringTag` of `value`. * Gets the `toStringTag` of `value`.
@@ -48,8 +49,8 @@ define(['./_DataView', './_Map', './_Promise', './_Set', './_WeakMap'], function
(WeakMap && getTag(new WeakMap) != weakMapTag)) { (WeakMap && getTag(new WeakMap) != weakMapTag)) {
getTag = function(value) { getTag = function(value) {
var result = objectToString.call(value), var result = objectToString.call(value),
Ctor = result == objectTag ? value.constructor : null, Ctor = result == objectTag ? value.constructor : undefined,
ctorString = typeof Ctor == 'function' ? funcToString.call(Ctor) : ''; ctorString = Ctor ? toSource(Ctor) : undefined;
if (ctorString) { if (ctorString) {
switch (ctorString) { switch (ctorString) {

View File

@@ -1,8 +1,5 @@
define(['./_baseCastPath', './isArguments', './isArray', './_isIndex', './_isKey', './isLength', './isString'], function(baseCastPath, isArguments, isArray, isIndex, isKey, isLength, isString) { 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;
/** /**
* Checks if `path` exists on `object`. * 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`. * @returns {boolean} Returns `true` if `path` exists, else `false`.
*/ */
function hasPath(object, path, hasFunc) { function hasPath(object, path, hasFunc) {
if (object == null) { path = isKey(path, object) ? [path] : baseCastPath(path);
return false;
}
var result = hasFunc(object, path);
if (!result && !isKey(path)) {
path = baseCastPath(path);
var index = -1, var result,
length = path.length; index = -1,
length = path.length;
while (object != null && ++index < length) { while (++index < length) {
var key = path[index]; var key = path[index];
if (!(result = hasFunc(object, key))) { if (!(result = object != null && hasFunc(object, key))) {
break; break;
}
object = object[key];
} }
object = object[key];
} }
var length = object ? object.length : undefined; if (result) {
return result || ( return result;
!!length && isLength(length) && isIndex(path, length) && }
(isArray(object) || isString(object) || isArguments(object)) var length = object ? object.length : 0;
); return !!length && isLength(length) && isIndex(key, length) &&
(isArray(object) || isString(object) || isArguments(object));
} }
return hasPath; return hasPath;

15
_isFlattenable.js Normal file
View 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
View 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;
});

View 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;
});

26
_toSource.js Normal file
View 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
View File

@@ -7,8 +7,8 @@ define(['./_createWrapper'], function(createWrapper) {
var ARY_FLAG = 128; var ARY_FLAG = 128;
/** /**
* Creates a function that accepts up to `n` arguments, ignoring any * Creates a function that invokes `func`, with up to `n` arguments,
* additional arguments. * ignoring any additional arguments.
* *
* @static * @static
* @memberOf _ * @memberOf _

View File

@@ -3,7 +3,7 @@ define(['./_copyObjectWith', './_createAssigner', './keysIn'], function(copyObje
/** /**
* This method is like `_.assignIn` except that it accepts `customizer` * This method is like `_.assignIn` except that it accepts `customizer`
* which is invoked to produce the assigned values. If `customizer` returns * 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). * is invoked with five arguments: (objValue, srcValue, key, object, source).
* *
* **Note:** This method mutates `object`. * **Note:** This method mutates `object`.

View File

@@ -3,7 +3,7 @@ define(['./_copyObjectWith', './_createAssigner', './keys'], function(copyObject
/** /**
* This method is like `_.assign` except that it accepts `customizer` * This method is like `_.assign` except that it accepts `customizer`
* which is invoked to produce the assigned values. If `customizer` returns * 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). * is invoked with five arguments: (objValue, srcValue, key, object, source).
* *
* **Note:** This method mutates `object`. * **Note:** This method mutates `object`.

View File

@@ -6,8 +6,7 @@ define(['./_createWrapper', './_getPlaceholder', './_replaceHolders', './rest'],
/** /**
* Creates a function that invokes `func` with the `this` binding of `thisArg` * Creates a function that invokes `func` with the `this` binding of `thisArg`
* and prepends any additional `_.bind` arguments to those provided to the * and `partials` prepended to the arguments it receives.
* bound function.
* *
* The `_.bind.placeholder` value, which defaults to `_` in monolithic builds, * The `_.bind.placeholder` value, which defaults to `_` in monolithic builds,
* may be used as a placeholder for partially applied arguments. * may be used as a placeholder for partially applied arguments.

View File

@@ -6,8 +6,8 @@ define(['./_createWrapper', './_getPlaceholder', './_replaceHolders', './rest'],
PARTIAL_FLAG = 32; PARTIAL_FLAG = 32;
/** /**
* Creates a function that invokes the method at `object[key]` and prepends * Creates a function that invokes the method at `object[key]` with `partials`
* any additional `_.bindKey` arguments to those provided to the bound function. * prepended to the arguments it receives.
* *
* This method differs from `_.bind` by allowing bound functions to reference * This method differs from `_.bind` by allowing bound functions to reference
* methods that may be redefined or don't yet exist. See * methods that may be redefined or don't yet exist. See

View File

@@ -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. */ /* Built-in method references for those with the same name as other `lodash` methods. */
var nativeCeil = Math.ceil, var nativeCeil = Math.ceil,
@@ -14,7 +17,8 @@ define(['./_baseSlice', './toInteger'], function(baseSlice, toInteger) {
* @since 3.0.0 * @since 3.0.0
* @category Array * @category Array
* @param {Array} array The array to process. * @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. * @returns {Array} Returns the new array containing chunks.
* @example * @example
* *
@@ -24,9 +28,12 @@ define(['./_baseSlice', './toInteger'], function(baseSlice, toInteger) {
* _.chunk(['a', 'b', 'c', 'd'], 3); * _.chunk(['a', 'b', 'c', 'd'], 3);
* // => [['a', 'b', 'c'], ['d']] * // => [['a', 'b', 'c'], ['d']]
*/ */
function chunk(array, size) { function chunk(array, size, guard) {
size = nativeMax(toInteger(size), 0); if ((guard ? isIterateeCall(array, size, guard) : size === undefined)) {
size = 1;
} else {
size = nativeMax(toInteger(size), 0);
}
var length = array ? array.length : 0; var length = array ? array.length : 0;
if (!length || size < 1) { if (!length || size < 1) {
return []; return [];

View File

@@ -2,7 +2,7 @@ define(['./_baseClone'], function(baseClone) {
/** /**
* This method is like `_.clone` except that it accepts `customizer` which * 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 * cloning is handled by the method instead. The `customizer` is invoked with
* up to four arguments; (value [, index|key, object, stack]). * up to four arguments; (value [, index|key, object, stack]).
* *

View File

@@ -8,9 +8,9 @@ define(['./_createAggregator'], function(createAggregator) {
/** /**
* Creates an object composed of keys generated from the results of running * Creates an object composed of keys generated from the results of running
* each element of `collection` through `iteratee`. The corresponding value * each element of `collection` thru `iteratee`. The corresponding value of
* of each key is the number of times the key was returned by `iteratee`. * each key is the number of times the key was returned by `iteratee`. The
* The iteratee is invoked with one argument: (value). * iteratee is invoked with one argument: (value).
* *
* @static * @static
* @memberOf _ * @memberOf _

View File

@@ -2,7 +2,7 @@ define(['./_baseAssign', './_baseCreate'], function(baseAssign, baseCreate) {
/** /**
* Creates an object that inherits from the `prototype` object. If a * 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. * are assigned to the created object.
* *
* @static * @static

View File

@@ -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 * on the trailing edge of the timeout only if the debounced function is
* invoked more than once during the `wait` timeout. * 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`. * for details over the differences between `_.debounce` and `_.throttle`.
* *
* @static * @static

View File

@@ -20,7 +20,7 @@ define(['./_baseDifference', './_baseFlatten', './isArrayLikeObject', './rest'],
*/ */
var difference = rest(function(array, values) { var difference = rest(function(array, values) {
return isArrayLikeObject(array) return isArrayLikeObject(array)
? baseDifference(array, baseFlatten(values, 1, true)) ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true))
: []; : [];
}); });

View File

@@ -33,7 +33,7 @@ define(['./_baseDifference', './_baseFlatten', './_baseIteratee', './isArrayLike
iteratee = undefined; iteratee = undefined;
} }
return isArrayLikeObject(array) return isArrayLikeObject(array)
? baseDifference(array, baseFlatten(values, 1, true), baseIteratee(iteratee)) ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), baseIteratee(iteratee))
: []; : [];
}); });

View File

@@ -30,7 +30,7 @@ define(['./_baseDifference', './_baseFlatten', './isArrayLikeObject', './last',
comparator = undefined; comparator = undefined;
} }
return isArrayLikeObject(array) return isArrayLikeObject(array)
? baseDifference(array, baseFlatten(values, 1, true), undefined, comparator) ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), undefined, comparator)
: []; : [];
}); });

View File

@@ -1,6 +1,9 @@
define(['./toString'], function(toString) { 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, var reRegExpChar = /[\\^$.*+?()[\]{}|]/g,
reHasRegExpChar = RegExp(reRegExpChar.source); reHasRegExpChar = RegExp(reRegExpChar.source);

View File

@@ -2,8 +2,8 @@ define(['./_baseFlatten', './map'], function(baseFlatten, map) {
/** /**
* Creates a flattened array of values by running each element in `collection` * Creates a flattened array of values by running each element in `collection`
* through `iteratee` and flattening the mapped results. The iteratee is * thru `iteratee` and flattening the mapped results. The iteratee is invoked
* invoked with three arguments: (value, index|key, collection). * with three arguments: (value, index|key, collection).
* *
* @static * @static
* @memberOf _ * @memberOf _

2
get.js
View File

@@ -5,7 +5,7 @@ define(['./_baseGet'], function(baseGet) {
/** /**
* Gets the value at `path` of `object`. If the resolved value is * 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 * @static
* @memberOf _ * @memberOf _

View File

@@ -8,9 +8,10 @@ define(['./_createAggregator'], function(createAggregator) {
/** /**
* Creates an object composed of keys generated from the results of running * Creates an object composed of keys generated from the results of running
* each element of `collection` through `iteratee`. The corresponding value * each element of `collection` thru `iteratee`. The order of grouped values
* of each key is an array of elements responsible for generating the key. * is determined by the order they occur in `collection`. The corresponding
* The iteratee is invoked with one argument: (value). * value of each key is an array of elements responsible for generating the
* key. The iteratee is invoked with one argument: (value).
* *
* @static * @static
* @memberOf _ * @memberOf _

10
has.js
View File

@@ -12,23 +12,23 @@ define(['./_baseHas', './_hasPath'], function(baseHas, hasPath) {
* @returns {boolean} Returns `true` if `path` exists, else `false`. * @returns {boolean} Returns `true` if `path` exists, else `false`.
* @example * @example
* *
* var object = { 'a': { 'b': { 'c': 3 } } }; * var object = { 'a': { 'b': 2 } };
* var other = _.create({ 'a': _.create({ 'b': _.create({ 'c': 3 }) }) }); * var other = _.create({ 'a': _.create({ 'b': 2 }) });
* *
* _.has(object, 'a'); * _.has(object, 'a');
* // => true * // => true
* *
* _.has(object, 'a.b.c'); * _.has(object, 'a.b');
* // => true * // => true
* *
* _.has(object, ['a', 'b', 'c']); * _.has(object, ['a', 'b']);
* // => true * // => true
* *
* _.has(other, 'a'); * _.has(other, 'a');
* // => false * // => false
*/ */
function has(object, path) { function has(object, path) {
return hasPath(object, path, baseHas); return object != null && hasPath(object, path, baseHas);
} }
return has; return has;

View File

@@ -12,22 +12,22 @@ define(['./_baseHasIn', './_hasPath'], function(baseHasIn, hasPath) {
* @returns {boolean} Returns `true` if `path` exists, else `false`. * @returns {boolean} Returns `true` if `path` exists, else `false`.
* @example * @example
* *
* var object = _.create({ 'a': _.create({ 'b': _.create({ 'c': 3 }) }) }); * var object = _.create({ 'a': _.create({ 'b': 2 }) });
* *
* _.hasIn(object, 'a'); * _.hasIn(object, 'a');
* // => true * // => true
* *
* _.hasIn(object, 'a.b.c'); * _.hasIn(object, 'a.b');
* // => true * // => true
* *
* _.hasIn(object, ['a', 'b', 'c']); * _.hasIn(object, ['a', 'b']);
* // => true * // => true
* *
* _.hasIn(object, 'b'); * _.hasIn(object, 'b');
* // => false * // => false
*/ */
function hasIn(object, path) { function hasIn(object, path) {
return hasPath(object, path, baseHasIn); return object != null && hasPath(object, path, baseHasIn);
} }
return hasIn; return hasIn;

View File

@@ -5,7 +5,7 @@ define(['./_baseInRange', './toNumber'], function(baseInRange, toNumber) {
/** /**
* Checks if `n` is between `start` and up to but not including, `end`. If * 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 * If `start` is greater than `end` the params are swapped to support
* negative ranges. * negative ranges.
* *

View File

@@ -4,7 +4,7 @@ define(['./_baseIndexOf', './isArrayLike', './isString', './toInteger', './value
var nativeMax = Math.max; 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 * checked for a substring of `value`, otherwise
* [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) * [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
* is used for equality comparisons. If `fromIndex` is negative, it's used as * is used for equality comparisons. If `fromIndex` is negative, it's used as

View File

@@ -6,8 +6,8 @@ define(['./_baseIndexOf', './toInteger'], function(baseIndexOf, toInteger) {
/** /**
* Gets the index at which the first occurrence of `value` is found in `array` * 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) * 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 * for equality comparisons. If `fromIndex` is negative, it's used as the
* from the end of `array`. * offset from the end of `array`.
* *
* @static * @static
* @memberOf _ * @memberOf _

View File

@@ -8,8 +8,8 @@ define(['./_baseIteratee', './_createInverter'], function(baseIteratee, createIn
/** /**
* This method is like `_.invert` except that the inverted object is generated * This method is like `_.invert` except that the inverted object is generated
* from the results of running each element of `object` through `iteratee`. * from the results of running each element of `object` thru `iteratee`. The
* The corresponding inverted value of each inverted key is an array of keys * corresponding inverted value of each inverted key is an array of keys
* responsible for generating the inverted value. The iteratee is invoked * responsible for generating the inverted value. The iteratee is invoked
* with one argument: (value). * with one argument: (value).
* *

View File

@@ -6,8 +6,8 @@ define(['./_apply', './_baseEach', './_baseInvoke', './isArrayLike', './_isKey',
/** /**
* Invokes the method at `path` of each element in `collection`, returning * Invokes the method at `path` of each element in `collection`, returning
* an array of the results of each invoked method. Any additional arguments * 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 * are provided to each invoked method. If `methodName` is a function, it's
* invoked for, and `this` bound to, each element in `collection`. * invoked for and `this` bound to, each element in `collection`.
* *
* @static * @static
* @memberOf _ * @memberOf _

View File

@@ -10,7 +10,8 @@ define(['./isArrayLikeObject'], function(isArrayLikeObject) {
var hasOwnProperty = objectProto.hasOwnProperty; 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. * of values.
*/ */
var objectToString = objectProto.toString; var objectToString = objectProto.toString;

View File

@@ -6,7 +6,8 @@ define(['./isObjectLike'], function(isObjectLike) {
var objectProto = Object.prototype; 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. * of values.
*/ */
var objectToString = objectProto.toString; var objectToString = objectProto.toString;

View File

@@ -7,7 +7,8 @@ define(['./isObjectLike'], function(isObjectLike) {
var objectProto = Object.prototype; 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. * of values.
*/ */
var objectToString = objectProto.toString; var objectToString = objectProto.toString;

View File

@@ -7,7 +7,8 @@ define(['./isObjectLike'], function(isObjectLike) {
var objectProto = Object.prototype; 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. * of values.
*/ */
var objectToString = objectProto.toString; var objectToString = objectProto.toString;

View File

@@ -5,7 +5,7 @@ define(['./_baseIsEqual'], function(baseIsEqual) {
/** /**
* This method is like `_.isEqual` except that it accepts `customizer` which * 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 * are handled by the method instead. The `customizer` is invoked with up to
* six arguments: (objValue, othValue [, index|key, object, other, stack]). * six arguments: (objValue, othValue [, index|key, object, other, stack]).
* *

View File

@@ -7,7 +7,8 @@ define(['./isObjectLike'], function(isObjectLike) {
var objectProto = Object.prototype; 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. * of values.
*/ */
var objectToString = objectProto.toString; var objectToString = objectProto.toString;

View File

@@ -8,7 +8,8 @@ define(['./isObject'], function(isObject) {
var objectProto = Object.prototype; 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. * of values.
*/ */
var objectToString = objectProto.toString; var objectToString = objectProto.toString;

View File

@@ -5,7 +5,7 @@ define(['./_baseIsMatch', './_getMatchData'], function(baseIsMatch, getMatchData
/** /**
* This method is like `_.isMatch` except that it accepts `customizer` which * 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 * are handled by the method instead. The `customizer` is invoked with five
* arguments: (objValue, srcValue, index|key, object, source). * arguments: (objValue, srcValue, index|key, object, source).
* *

View File

@@ -3,9 +3,10 @@ define(['./isNumber'], function(isNumber) {
/** /**
* Checks if `value` is `NaN`. * Checks if `value` is `NaN`.
* *
* **Note:** This method is not the same as * **Note:** This method is based on
* [`isNaN`](https://es5.github.io/#x15.1.2.4) which returns `true` for * [`Number.isNaN`](https://mdn.io/Number/isNaN) and is not the same as
* `undefined` and other non-numeric values. * global [`isNaN`](https://mdn.io/isNaN) which returns `true` for
* `undefined` and other non-number values.
* *
* @static * @static
* @memberOf _ * @memberOf _

View File

@@ -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; var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
/** Used to detect host constructors (Safari). */ /** Used to detect host constructors (Safari). */
@@ -40,14 +43,11 @@ define(['./isFunction', './_isHostObject', './isObjectLike'], function(isFunctio
* // => false * // => false
*/ */
function isNative(value) { function isNative(value) {
if (value == null) { if (!isObject(value)) {
return false; return false;
} }
if (isFunction(value)) { var pattern = (isFunction(value) || isHostObject(value)) ? reIsNative : reIsHostCtor;
return reIsNative.test(funcToString.call(value)); return pattern.test(toSource(value));
}
return isObjectLike(value) &&
(isHostObject(value) ? reIsNative : reIsHostCtor).test(value);
} }
return isNative; return isNative;

View File

@@ -7,7 +7,8 @@ define(['./isObjectLike'], function(isObjectLike) {
var objectProto = Object.prototype; 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. * of values.
*/ */
var objectToString = objectProto.toString; var objectToString = objectProto.toString;

View File

@@ -1,8 +1,9 @@
define([], function() { define([], function() {
/** /**
* Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`. * Checks if `value` is the
* (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) * [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 * @static
* @memberOf _ * @memberOf _

View File

@@ -16,7 +16,8 @@ define(['./_getPrototype', './_isHostObject', './isObjectLike'], function(getPro
var objectCtorString = funcToString.call(Object); 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. * of values.
*/ */
var objectToString = objectProto.toString; var objectToString = objectProto.toString;

View File

@@ -7,7 +7,8 @@ define(['./isObject'], function(isObject) {
var objectProto = Object.prototype; 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. * of values.
*/ */
var objectToString = objectProto.toString; var objectToString = objectProto.toString;

View File

@@ -7,7 +7,8 @@ define(['./isArray', './isObjectLike'], function(isArray, isObjectLike) {
var objectProto = Object.prototype; 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. * of values.
*/ */
var objectToString = objectProto.toString; var objectToString = objectProto.toString;

View File

@@ -7,7 +7,8 @@ define(['./isObjectLike'], function(isObjectLike) {
var objectProto = Object.prototype; 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. * of values.
*/ */
var objectToString = objectProto.toString; var objectToString = objectProto.toString;

View File

@@ -47,7 +47,8 @@ define(['./isLength', './isObjectLike'], function(isLength, isObjectLike) {
var objectProto = Object.prototype; 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. * of values.
*/ */
var objectToString = objectProto.toString; var objectToString = objectProto.toString;

View File

@@ -7,7 +7,8 @@ define(['./isObjectLike'], function(isObjectLike) {
var objectProto = Object.prototype; 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. * of values.
*/ */
var objectToString = objectProto.toString; var objectToString = objectProto.toString;

View File

@@ -2,8 +2,8 @@ define(['./_baseClone', './_baseIteratee'], function(baseClone, baseIteratee) {
/** /**
* Creates a function that invokes `func` with the arguments of the created * Creates a function that invokes `func` with the arguments of the created
* function. If `func` is a property name the created function returns 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 * property value for a given element. If `func` is an array or object, the
* created function returns `true` for elements that contain the equivalent * created function returns `true` for elements that contain the equivalent
* source properties, otherwise it returns `false`. * source properties, otherwise it returns `false`.
* *

View File

@@ -2,8 +2,8 @@ define(['./_createAggregator'], function(createAggregator) {
/** /**
* Creates an object composed of keys generated from the results of running * Creates an object composed of keys generated from the results of running
* each element of `collection` through `iteratee`. The corresponding value * each element of `collection` thru `iteratee`. The corresponding value of
* of each key is the last element responsible for generating the key. The * each key is the last element responsible for generating the key. The
* iteratee is invoked with one argument: (value). * iteratee is invoked with one argument: (value).
* *
* @static * @static

455
main.js

File diff suppressed because it is too large Load Diff

10
map.js
View File

@@ -1,7 +1,7 @@
define(['./_arrayMap', './_baseIteratee', './_baseMap', './isArray'], function(arrayMap, baseIteratee, baseMap, isArray) { 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: * `iteratee`. The iteratee is invoked with three arguments:
* (value, index|key, collection). * (value, index|key, collection).
* *
@@ -9,10 +9,10 @@ define(['./_arrayMap', './_baseIteratee', './_baseMap', './isArray'], function(a
* `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`. * `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`.
* *
* The guarded methods are: * The guarded methods are:
* `ary`, `curry`, `curryRight`, `drop`, `dropRight`, `every`, `fill`, * `ary`, `chunk`, `curry`, `curryRight`, `drop`, `dropRight`, `every`,
* `invert`, `parseInt`, `random`, `range`, `rangeRight`, `slice`, `some`, * `fill`, `invert`, `parseInt`, `random`, `range`, `rangeRight`, `repeat`,
* `sortBy`, `take`, `takeRight`, `template`, `trim`, `trimEnd`, `trimStart`, * `sampleSize`, `slice`, `some`, `sortBy`, `take`, `takeRight`, `template`,
* and `words` * `trim`, `trimEnd`, `trimStart`, and `words`
* *
* @static * @static
* @memberOf _ * @memberOf _

View File

@@ -3,8 +3,8 @@ define(['./_baseForOwn', './_baseIteratee'], function(baseForOwn, baseIteratee)
/** /**
* The opposite of `_.mapValues`; this method creates an object with the * The opposite of `_.mapValues`; this method creates an object with the
* same values as `object` and keys generated by running each own enumerable * same values as `object` and keys generated by running each own enumerable
* string keyed property of `object` through `iteratee`. The iteratee is * string keyed property of `object` thru `iteratee`. The iteratee is invoked
* invoked with three arguments: (value, key, object). * with three arguments: (value, key, object).
* *
* @static * @static
* @memberOf _ * @memberOf _

View File

@@ -1,8 +1,8 @@
define(['./_baseForOwn', './_baseIteratee'], function(baseForOwn, baseIteratee) { define(['./_baseForOwn', './_baseIteratee'], function(baseForOwn, baseIteratee) {
/** /**
* Creates an object with the same keys as `object` and values generated by * Creates an object with the same keys as `object` and values generated
* running each own enumerable string keyed property of `object` through * by running each own enumerable string keyed property of `object` thru
* `iteratee`. The iteratee is invoked with three arguments: * `iteratee`. The iteratee is invoked with three arguments:
* (value, key, object). * (value, key, object).
* *

2
max.js
View File

@@ -4,7 +4,7 @@ define(['./_baseExtremum', './gt', './identity'], function(baseExtremum, gt, ide
var undefined; 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. * `undefined` is returned.
* *
* @static * @static

View File

@@ -5,7 +5,7 @@ define(['./_MapCache'], function(MapCache) {
/** /**
* Creates a function that memoizes the result of `func`. If `resolver` is * 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 * 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` * provided to the memoized function is used as the map cache key. The `func`
* is invoked with the `this` binding of the memoized function. * is invoked with the `this` binding of the memoized function.

View File

@@ -3,7 +3,7 @@ define(['./_baseMerge', './_createAssigner'], function(baseMerge, createAssigner
/** /**
* This method is like `_.merge` except that it accepts `customizer` which * This method is like `_.merge` except that it accepts `customizer` which
* is invoked to produce the merged values of the destination and source * 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: * method instead. The `customizer` is invoked with seven arguments:
* (objValue, srcValue, key, object, source, stack). * (objValue, srcValue, key, object, source, stack).
* *

View File

@@ -14,14 +14,14 @@ define(['./_baseInvoke', './rest'], function(baseInvoke, rest) {
* @example * @example
* *
* var objects = [ * var objects = [
* { 'a': { 'b': { 'c': _.constant(2) } } }, * { 'a': { 'b': _.constant(2) } },
* { 'a': { 'b': { 'c': _.constant(1) } } } * { 'a': { 'b': _.constant(1) } }
* ]; * ];
* *
* _.map(objects, _.method('a.b.c')); * _.map(objects, _.method('a.b'));
* // => [2, 1] * // => [2, 1]
* *
* _.map(objects, _.method(['a', 'b', 'c'])); * _.map(objects, _.method(['a', 'b']));
* // => [2, 1] * // => [2, 1]
*/ */
var method = rest(function(path, args) { var method = rest(function(path, args) {

2
min.js
View File

@@ -4,7 +4,7 @@ define(['./_baseExtremum', './identity', './lt'], function(baseExtremum, identit
var undefined; 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. * `undefined` is returned.
* *
* @static * @static

View File

@@ -2,7 +2,7 @@ define(['./_arrayEach', './_arrayPush', './_baseFunctions', './_copyArray', './i
/** /**
* Adds all own enumerable string keyed function properties of a source * 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. * are added to its prototype as well.
* *
* **Note:** Use `_.runInContext` to create a pristine `lodash` function to * **Note:** Use `_.runInContext` to create a pristine `lodash` function to

View File

@@ -1,8 +1,8 @@
define(['./_arrayMap', './_createOver'], function(arrayMap, createOver) { define(['./_arrayMap', './_createOver'], function(arrayMap, createOver) {
/** /**
* Creates a function that invokes `iteratees` with the arguments provided * Creates a function that invokes `iteratees` with the arguments it receives
* to the created function and returns their results. * and returns their results.
* *
* @static * @static
* @memberOf _ * @memberOf _

View File

@@ -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. */ /* Built-in method references for those with the same name as other `lodash` methods. */
var nativeMin = Math.min; var nativeMin = Math.min;
@@ -12,7 +12,7 @@ define(['./_apply', './_arrayMap', './_baseFlatten', './_baseIteratee', './rest'
* @memberOf _ * @memberOf _
* @category Function * @category Function
* @param {Function} func The function to wrap. * @param {Function} func The function to wrap.
* @param {...(Function|Function[])} [transforms] The functions to transform * @param {...(Function|Function[])} [transforms] The functions to transform.
* arguments, specified individually or in arrays. * arguments, specified individually or in arrays.
* @returns {Function} Returns the new function. * @returns {Function} Returns the new function.
* @example * @example
@@ -36,8 +36,7 @@ define(['./_apply', './_arrayMap', './_baseFlatten', './_baseIteratee', './rest'
* // => [100, 10] * // => [100, 10]
*/ */
var overArgs = rest(function(func, transforms) { var overArgs = rest(function(func, transforms) {
transforms = arrayMap(baseFlatten(transforms, 1), baseIteratee); transforms = arrayMap(baseFlatten(transforms, 1, isFlattenableIteratee), baseIteratee);
var funcsLength = transforms.length; var funcsLength = transforms.length;
return rest(function(args) { return rest(function(args) {
var index = -1, var index = -1,

View File

@@ -2,7 +2,7 @@ define(['./_arrayEvery', './_createOver'], function(arrayEvery, createOver) {
/** /**
* Creates a function that checks if **all** of the `predicates` return * 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 * @static
* @memberOf _ * @memberOf _

View File

@@ -2,7 +2,7 @@ define(['./_arraySome', './_createOver'], function(arraySome, createOver) {
/** /**
* Creates a function that checks if **any** of the `predicates` return * 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 * @static
* @memberOf _ * @memberOf _

View File

@@ -1,11 +1,11 @@
{ {
"name": "lodash-amd", "name": "lodash-amd",
"version": "4.7.0", "version": "4.9.0",
"description": "Lodash exported as AMD modules.", "description": "Lodash exported as AMD modules.",
"homepage": "https://lodash.com/custom-builds", "homepage": "https://lodash.com/custom-builds",
"license": "MIT", "license": "MIT",
"main": "main.js",
"private": true, "private": true,
"main": "main.js",
"keywords": "amd, modules, stdlib, util", "keywords": "amd, modules, stdlib, util",
"author": "John-David Dalton <john.david.dalton@gmail.com> (http://allyoucanleet.com/)", "author": "John-David Dalton <john.david.dalton@gmail.com> (http://allyoucanleet.com/)",
"contributors": [ "contributors": [

View File

@@ -7,9 +7,9 @@ define(['./_createWrapper', './_getPlaceholder', './_replaceHolders', './rest'],
var PARTIAL_FLAG = 32; var PARTIAL_FLAG = 32;
/** /**
* Creates a function that invokes `func` with `partial` arguments prepended * Creates a function that invokes `func` with `partials` prepended to the
* to those provided to the new function. This method is like `_.bind` except * arguments it receives. This method is like `_.bind` except it does **not**
* it does **not** alter the `this` binding. * alter the `this` binding.
* *
* The `_.partial.placeholder` value, which defaults to `_` in monolithic * The `_.partial.placeholder` value, which defaults to `_` in monolithic
* builds, may be used as a placeholder for partially applied arguments. * builds, may be used as a placeholder for partially applied arguments.

View File

@@ -8,7 +8,7 @@ define(['./_createWrapper', './_getPlaceholder', './_replaceHolders', './rest'],
/** /**
* This method is like `_.partial` except that partially applied arguments * This method is like `_.partial` except that partially applied arguments
* are appended to those provided to the new function. * are appended to the arguments it receives.
* *
* The `_.partialRight.placeholder` value, which defaults to `_` in monolithic * The `_.partialRight.placeholder` value, which defaults to `_` in monolithic
* builds, may be used as a placeholder for partially applied arguments. * builds, may be used as a placeholder for partially applied arguments.

View File

@@ -12,14 +12,14 @@ define(['./_baseProperty', './_basePropertyDeep', './_isKey'], function(baseProp
* @example * @example
* *
* var objects = [ * var objects = [
* { 'a': { 'b': { 'c': 2 } } }, * { 'a': { 'b': 2 } },
* { 'a': { 'b': { 'c': 1 } } } * { 'a': { 'b': 1 } }
* ]; * ];
* *
* _.map(objects, _.property('a.b.c')); * _.map(objects, _.property('a.b'));
* // => [2, 1] * // => [2, 1]
* *
* _.map(_.sortBy(objects, _.property(['a', 'b', 'c'])), 'a.b.c'); * _.map(_.sortBy(objects, _.property(['a', 'b'])), 'a.b');
* // => [1, 2] * // => [1, 2]
*/ */
function property(path) { function property(path) {

View File

@@ -3,7 +3,7 @@ define(['./_createRange'], function(createRange) {
/** /**
* Creates an array of numbers (positive and/or negative) progressing from * Creates an array of numbers (positive and/or negative) progressing from
* `start` up to, but not including, `end`. A step of `-1` is used if a negative * `start` up to, but not including, `end`. A step of `-1` is used if a negative
* `start` is specified without an `end` or `step`. If `end` is not specified * `start` is specified without an `end` or `step`. If `end` is not specified,
* it's set to `start` with `start` then set to `0`. * it's set to `start` with `start` then set to `0`.
* *
* **Note:** JavaScript follows the IEEE-754 standard for resolving * **Note:** JavaScript follows the IEEE-754 standard for resolving

View File

@@ -8,7 +8,7 @@ define(['./_baseFlatten', './_createWrapper', './rest'], function(baseFlatten, c
/** /**
* Creates a function that invokes `func` with arguments arranged according * Creates a function that invokes `func` with arguments arranged according
* to the specified indexes where the argument value at the first index is * to the specified `indexes` where the argument value at the first index is
* provided as the first argument, the argument value at the second index is * provided as the first argument, the argument value at the second index is
* provided as the second argument, and so on. * provided as the second argument, and so on.
* *

View File

@@ -2,9 +2,9 @@ define(['./_arrayReduce', './_baseEach', './_baseIteratee', './_baseReduce', './
/** /**
* Reduces `collection` to a value which is the accumulated result of running * Reduces `collection` to a value which is the accumulated result of running
* each element in `collection` through `iteratee`, where each successive * each element in `collection` thru `iteratee`, where each successive
* invocation is supplied the return value of the previous. If `accumulator` * invocation is supplied the return value of the previous. If `accumulator`
* is not given the first element of `collection` is used as the initial * is not given, the first element of `collection` is used as the initial
* value. The iteratee is invoked with four arguments: * value. The iteratee is invoked with four arguments:
* (accumulator, value, index|key, collection). * (accumulator, value, index|key, collection).
* *

View File

@@ -1,4 +1,7 @@
define(['./_baseRepeat', './toInteger', './toString'], function(baseRepeat, toInteger, toString) { define(['./_baseRepeat', './_isIterateeCall', './toInteger', './toString'], function(baseRepeat, isIterateeCall, toInteger, toString) {
/** Used as a safe reference for `undefined` in pre-ES5 environments. */
var undefined;
/** /**
* Repeats the given string `n` times. * Repeats the given string `n` times.
@@ -8,7 +11,8 @@ define(['./_baseRepeat', './toInteger', './toString'], function(baseRepeat, toIn
* @since 3.0.0 * @since 3.0.0
* @category String * @category String
* @param {string} [string=''] The string to repeat. * @param {string} [string=''] The string to repeat.
* @param {number} [n=0] The number of times to repeat the string. * @param {number} [n=1] The number of times to repeat the string.
* @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
* @returns {string} Returns the repeated string. * @returns {string} Returns the repeated string.
* @example * @example
* *
@@ -21,8 +25,13 @@ define(['./_baseRepeat', './toInteger', './toString'], function(baseRepeat, toIn
* _.repeat('abc', 0); * _.repeat('abc', 0);
* // => '' * // => ''
*/ */
function repeat(string, n) { function repeat(string, n, guard) {
return baseRepeat(toString(string), toInteger(n)); if ((guard ? isIterateeCall(string, n, guard) : n === undefined)) {
n = 1;
} else {
n = toInteger(n);
}
return baseRepeat(toString(string), n);
} }
return repeat; return repeat;

View File

@@ -1,4 +1,7 @@
define(['./_baseClamp', './_baseRandom', './toArray', './toInteger'], function(baseClamp, baseRandom, toArray, toInteger) { define(['./_baseClamp', './_baseRandom', './_isIterateeCall', './toArray', './toInteger'], function(baseClamp, baseRandom, isIterateeCall, toArray, toInteger) {
/** Used as a safe reference for `undefined` in pre-ES5 environments. */
var undefined;
/** /**
* Gets `n` random elements at unique keys from `collection` up to the * Gets `n` random elements at unique keys from `collection` up to the
@@ -9,7 +12,8 @@ define(['./_baseClamp', './_baseRandom', './toArray', './toInteger'], function(b
* @since 4.0.0 * @since 4.0.0
* @category Collection * @category Collection
* @param {Array|Object} collection The collection to sample. * @param {Array|Object} collection The collection to sample.
* @param {number} [n=0] The number of elements to sample. * @param {number} [n=1] The number of elements to sample.
* @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
* @returns {Array} Returns the random elements. * @returns {Array} Returns the random elements.
* @example * @example
* *
@@ -19,13 +23,17 @@ define(['./_baseClamp', './_baseRandom', './toArray', './toInteger'], function(b
* _.sampleSize([1, 2, 3], 4); * _.sampleSize([1, 2, 3], 4);
* // => [2, 3, 1] * // => [2, 3, 1]
*/ */
function sampleSize(collection, n) { function sampleSize(collection, n, guard) {
var index = -1, var index = -1,
result = toArray(collection), result = toArray(collection),
length = result.length, length = result.length,
lastIndex = length - 1; lastIndex = length - 1;
n = baseClamp(toInteger(n), 0, length); if ((guard ? isIterateeCall(collection, n, guard) : n === undefined)) {
n = 1;
} else {
n = baseClamp(toInteger(n), 0, length);
}
while (++index < n) { while (++index < n) {
var rand = baseRandom(index, lastIndex), var rand = baseRandom(index, lastIndex),
value = result[rand]; value = result[rand];

4
set.js
View File

@@ -1,7 +1,7 @@
define(['./_baseSet'], function(baseSet) { define(['./_baseSet'], function(baseSet) {
/** /**
* Sets the value at `path` of `object`. If a portion of `path` doesn't exist * Sets the value at `path` of `object`. If a portion of `path` doesn't exist,
* it's created. Arrays are created for missing index properties while objects * it's created. Arrays are created for missing index properties while objects
* are created for all other missing properties. Use `_.setWith` to customize * are created for all other missing properties. Use `_.setWith` to customize
* `path` creation. * `path` creation.
@@ -24,7 +24,7 @@ define(['./_baseSet'], function(baseSet) {
* console.log(object.a[0].b.c); * console.log(object.a[0].b.c);
* // => 4 * // => 4
* *
* _.set(object, 'x[0].y.z', 5); * _.set(object, ['x', '0', 'y', 'z'], 5);
* console.log(object.x[0].y.z); * console.log(object.x[0].y.z);
* // => 5 * // => 5
*/ */

View File

@@ -2,7 +2,7 @@ define(['./_baseFlatten', './_baseOrderBy', './_isIterateeCall', './rest'], func
/** /**
* Creates an array of elements, sorted in ascending order by the results of * Creates an array of elements, sorted in ascending order by the results of
* running each element in a collection through each iteratee. This method * running each element in a collection thru each iteratee. This method
* performs a stable sort, that is, it preserves the original sort order of * performs a stable sort, that is, it preserves the original sort order of
* equal elements. The iteratees are invoked with one argument: (value). * equal elements. The iteratees are invoked with one argument: (value).
* *

View File

@@ -1,4 +1,19 @@
define(['./toString'], function(toString) { define(['./isRegExp', './_stringToArray', './toString'], function(isRegExp, 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 + ']');
/** /**
* Splits `string` by `separator`. * Splits `string` by `separator`.
@@ -20,7 +35,18 @@ define(['./toString'], function(toString) {
* // => ['a', 'b'] * // => ['a', 'b']
*/ */
function split(string, separator, limit) { function split(string, separator, limit) {
return toString(string).split(separator, limit); string = toString(string);
if (string && (
typeof separator == 'string' ||
(separator != null && !isRegExp(separator))
)) {
separator += '';
if (separator == '' && reHasComplexSymbol.test(string)) {
var strSymbols = stringToArray(string);
return limit === undefined ? strSymbols : strSymbols.slice(0, limit < 0 ? 0 : limit);
}
}
return string.split(separator, limit);
} }
return split; return split;

View File

@@ -12,7 +12,7 @@ define(['./_apply', './_arrayPush', './rest', './toInteger'], function(apply, ar
/** /**
* Creates a function that invokes `func` with the `this` binding of the * Creates a function that invokes `func` with the `this` binding of the
* create function and an array of arguments much like * create function and an array of arguments much like
* [`Function#apply`](https://es5.github.io/#x15.3.4.3). * [`Function#apply`](http://www.ecma-international.org/ecma-262/6.0/#sec-function.prototype.apply).
* *
* **Note:** This method is based on the * **Note:** This method is based on the
* [spread operator](https://mdn.io/spread_operator). * [spread operator](https://mdn.io/spread_operator).

View File

@@ -8,7 +8,10 @@ define(['./_assignInDefaults', './assignInWith', './attempt', './_baseValues', '
reEmptyStringMiddle = /\b(__p \+=) '' \+/g, reEmptyStringMiddle = /\b(__p \+=) '' \+/g,
reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g; reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g;
/** Used to match [ES template delimiters](http://ecma-international.org/ecma-262/6.0/#sec-template-literal-lexical-components). */ /**
* Used to match
* [ES template delimiters](http://ecma-international.org/ecma-262/6.0/#sec-template-literal-lexical-components).
*/
var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g; var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g;
/** Used to ensure capturing order of template delimiters. */ /** Used to ensure capturing order of template delimiters. */
@@ -22,7 +25,7 @@ define(['./_assignInDefaults', './assignInWith', './attempt', './_baseValues', '
* in "interpolate" delimiters, HTML-escape interpolated data properties in * in "interpolate" delimiters, HTML-escape interpolated data properties in
* "escape" delimiters, and execute JavaScript in "evaluate" delimiters. Data * "escape" delimiters, and execute JavaScript in "evaluate" delimiters. Data
* properties may be accessed as free variables in the template. If a setting * properties may be accessed as free variables in the template. If a setting
* object is given it takes precedence over `_.templateSettings` values. * object is given, it takes precedence over `_.templateSettings` values.
* *
* **Note:** In the development build `_.template` utilizes * **Note:** In the development build `_.template` utilizes
* [sourceURLs](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl) * [sourceURLs](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl)

View File

@@ -17,7 +17,7 @@ define(['./debounce', './isObject'], function(debounce, isObject) {
* invoked on the trailing edge of the timeout only if the throttled function * invoked on the trailing edge of the timeout only if the throttled function
* is invoked more than once during the `wait` timeout. * 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 `_.throttle` and `_.debounce`. * for details over the differences between `_.throttle` and `_.debounce`.
* *
* @static * @static

View File

@@ -53,7 +53,7 @@ define(['./isFunction', './isObject', './isSymbol'], function(isFunction, isObje
value = isObject(other) ? (other + '') : other; value = isObject(other) ? (other + '') : other;
} }
if (typeof value != 'string') { if (typeof value != 'string') {
return value === 0 ? value : +value; return value === 0 ? value : +value;
} }
value = value.replace(reTrim, ''); value = value.replace(reTrim, '');
var isBinary = reIsBinary.test(value); var isBinary = reIsBinary.test(value);

View File

@@ -2,11 +2,11 @@ define(['./_arrayEach', './_baseCreate', './_baseForOwn', './_baseIteratee', './
/** /**
* An alternative to `_.reduce`; this method transforms `object` to a new * An alternative to `_.reduce`; this method transforms `object` to a new
* `accumulator` object which is the result of running each of its own enumerable * `accumulator` object which is the result of running each of its own
* string keyed properties through `iteratee`, with each invocation potentially * enumerable string keyed properties thru `iteratee`, with each invocation
* mutating the `accumulator` object. The iteratee is invoked with four arguments: * potentially mutating the `accumulator` object. The iteratee is invoked
* (accumulator, value, key, object). Iteratee functions may exit iteration * with four arguments: (accumulator, value, key, object). Iteratee functions
* early by explicitly returning `false`. * may exit iteration early by explicitly returning `false`.
* *
* @static * @static
* @memberOf _ * @memberOf _

View File

@@ -1,4 +1,4 @@
define(['./_baseFlatten', './_baseUniq', './rest'], function(baseFlatten, baseUniq, rest) { define(['./_baseFlatten', './_baseUniq', './isArrayLikeObject', './rest'], function(baseFlatten, baseUniq, isArrayLikeObject, rest) {
/** /**
* Creates an array of unique values, in order, from all given arrays using * Creates an array of unique values, in order, from all given arrays using
@@ -17,7 +17,7 @@ define(['./_baseFlatten', './_baseUniq', './rest'], function(baseFlatten, baseUn
* // => [2, 1, 4] * // => [2, 1, 4]
*/ */
var union = rest(function(arrays) { var union = rest(function(arrays) {
return baseUniq(baseFlatten(arrays, 1, true)); return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true));
}); });
return union; return union;

View File

@@ -31,7 +31,7 @@ define(['./_baseFlatten', './_baseIteratee', './_baseUniq', './isArrayLikeObject
if (isArrayLikeObject(iteratee)) { if (isArrayLikeObject(iteratee)) {
iteratee = undefined; iteratee = undefined;
} }
return baseUniq(baseFlatten(arrays, 1, true), baseIteratee(iteratee)); return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), baseIteratee(iteratee));
}); });
return unionBy; return unionBy;

View File

@@ -28,7 +28,7 @@ define(['./_baseFlatten', './_baseUniq', './isArrayLikeObject', './last', './res
if (isArrayLikeObject(comparator)) { if (isArrayLikeObject(comparator)) {
comparator = undefined; comparator = undefined;
} }
return baseUniq(baseFlatten(arrays, 1, true), undefined, comparator); return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), undefined, comparator);
}); });
return unionWith; return unionWith;

View File

@@ -4,7 +4,7 @@ define(['./toString'], function(toString) {
var idCounter = 0; var idCounter = 0;
/** /**
* Generates a unique ID. If `prefix` is given the ID is appended to it. * Generates a unique ID. If `prefix` is given, the ID is appended to it.
* *
* @static * @static
* @since 0.1.0 * @since 0.1.0

View File

@@ -21,7 +21,7 @@ define(['./_baseUnset'], function(baseUnset) {
* console.log(object); * console.log(object);
* // => { 'a': [{ 'b': {} }] }; * // => { 'a': [{ 'b': {} }] };
* *
* _.unset(object, 'a[0].b.c'); * _.unset(object, ['a', '0', 'b', 'c']);
* // => true * // => true
* *
* console.log(object); * console.log(object);

View File

@@ -24,9 +24,9 @@ define(['./_LazyWrapper', './_LodashWrapper', './_baseLodash', './isArray', './i
* Shortcut fusion is an optimization to merge iteratee calls; this avoids * Shortcut fusion is an optimization to merge iteratee calls; this avoids
* the creation of intermediate arrays and can greatly reduce the number of * the creation of intermediate arrays and can greatly reduce the number of
* iteratee executions. Sections of a chain sequence qualify for shortcut * iteratee executions. Sections of a chain sequence qualify for shortcut
* fusion if the section is applied to an array of at least two hundred * fusion if the section is applied to an array of at least `200` elements
* elements and any iteratees accept only one argument. The heuristic for * and any iteratees accept only one argument. The heuristic for whether a
* whether a section qualifies for shortcut fusion is subject to change. * section qualifies for shortcut fusion is subject to change.
* *
* Chaining is supported in custom builds as long as the `_#value` method is * Chaining is supported in custom builds as long as the `_#value` method is
* directly or indirectly included in the build. * directly or indirectly included in the build.