mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-05 01:17:50 +00:00
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e8cff1ef54 | ||
|
|
723c02dbfa |
@@ -1,10 +1,10 @@
|
|||||||
# lodash-es v4.7.0
|
# lodash-es v4.8.2
|
||||||
|
|
||||||
The [lodash](https://lodash.com/) library exported as [ES](http://www.ecma-international.org/ecma-262/6.0/) modules.
|
The [Lodash](https://lodash.com/) library exported as [ES](http://www.ecma-international.org/ecma-262/6.0/) 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
|
||||||
$ lodash modularize exports=es -o ./
|
$ lodash modularize exports=es -o ./
|
||||||
```
|
```
|
||||||
|
|
||||||
See the [package source](https://github.com/lodash/lodash/tree/4.7.0-es) for more details.
|
See the [package source](https://github.com/lodash/lodash/tree/4.8.2-es) for more details.
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
* @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) {
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import baseIsMatch from './_baseIsMatch';
|
import baseIsMatch from './_baseIsMatch';
|
||||||
import getMatchData from './_getMatchData';
|
import getMatchData from './_getMatchData';
|
||||||
|
import matchesStrictComparable from './_matchesStrictComparable';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The base implementation of `_.matches` which doesn't clone `source`.
|
* The base implementation of `_.matches` which doesn't clone `source`.
|
||||||
@@ -11,16 +12,7 @@ import getMatchData from './_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);
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
import baseIsEqual from './_baseIsEqual';
|
import baseIsEqual from './_baseIsEqual';
|
||||||
import get from './get';
|
import get from './get';
|
||||||
import hasIn from './hasIn';
|
import hasIn from './hasIn';
|
||||||
|
import isKey from './_isKey';
|
||||||
|
import isStrictComparable from './_isStrictComparable';
|
||||||
|
import matchesStrictComparable from './_matchesStrictComparable';
|
||||||
|
|
||||||
/** Used to compose bitmasks for comparison styles. */
|
/** Used to compose bitmasks for comparison styles. */
|
||||||
var UNORDERED_COMPARE_FLAG = 1,
|
var UNORDERED_COMPARE_FLAG = 1,
|
||||||
@@ -15,6 +18,9 @@ var UNORDERED_COMPARE_FLAG = 1,
|
|||||||
* @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)
|
||||||
|
|||||||
@@ -11,8 +11,8 @@ import isObject from './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) {
|
||||||
|
|||||||
@@ -6,9 +6,8 @@ import root from './_root';
|
|||||||
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.
|
||||||
|
|||||||
@@ -78,7 +78,8 @@ function equalByTag(object, other, tag, equalFunc, customizer, bitmask, stack) {
|
|||||||
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:
|
||||||
|
|||||||
19
_getTag.js
19
_getTag.js
@@ -3,6 +3,7 @@ import Map from './_Map';
|
|||||||
import Promise from './_Promise';
|
import Promise from './_Promise';
|
||||||
import Set from './_Set';
|
import Set from './_Set';
|
||||||
import WeakMap from './_WeakMap';
|
import WeakMap from './_WeakMap';
|
||||||
|
import toSource from './_toSource';
|
||||||
|
|
||||||
/** `Object#toString` result references. */
|
/** `Object#toString` result references. */
|
||||||
var mapTag = '[object Map]',
|
var mapTag = '[object Map]',
|
||||||
@@ -16,21 +17,19 @@ var dataViewTag = '[object DataView]';
|
|||||||
/** 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`.
|
||||||
@@ -53,7 +52,7 @@ if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||
|
|||||||
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 : null,
|
||||||
ctorString = typeof Ctor == 'function' ? funcToString.call(Ctor) : '';
|
ctorString = toSource(Ctor);
|
||||||
|
|
||||||
if (ctorString) {
|
if (ctorString) {
|
||||||
switch (ctorString) {
|
switch (ctorString) {
|
||||||
|
|||||||
34
_hasPath.js
34
_hasPath.js
@@ -16,29 +16,25 @@ import isString from './isString';
|
|||||||
* @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));
|
||||||
}
|
}
|
||||||
|
|
||||||
export default hasPath;
|
export default hasPath;
|
||||||
|
|||||||
20
_matchesStrictComparable.js
Normal file
20
_matchesStrictComparable.js
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
/**
|
||||||
|
* 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)));
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export default matchesStrictComparable;
|
||||||
23
_toSource.js
Normal file
23
_toSource.js
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
import isFunction from './isFunction';
|
||||||
|
import toString from './toString';
|
||||||
|
|
||||||
|
/** 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 (isFunction(func)) {
|
||||||
|
try {
|
||||||
|
return funcToString.call(func);
|
||||||
|
} catch (e) {}
|
||||||
|
}
|
||||||
|
return toString(func);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default toSource;
|
||||||
4
ary.js
4
ary.js
@@ -4,8 +4,8 @@ import createWrapper from './_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 _
|
||||||
|
|||||||
3
bind.js
3
bind.js
@@ -9,8 +9,7 @@ var BIND_FLAG = 1,
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 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.
|
||||||
|
|||||||
@@ -9,8 +9,8 @@ var BIND_FLAG = 1,
|
|||||||
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
|
||||||
|
|||||||
13
chunk.js
13
chunk.js
@@ -1,4 +1,5 @@
|
|||||||
import baseSlice from './_baseSlice';
|
import baseSlice from './_baseSlice';
|
||||||
|
import isIterateeCall from './_isIterateeCall';
|
||||||
import toInteger from './toInteger';
|
import toInteger from './toInteger';
|
||||||
|
|
||||||
/* 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. */
|
||||||
@@ -15,7 +16,8 @@ var nativeCeil = Math.ceil,
|
|||||||
* @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
|
||||||
*
|
*
|
||||||
@@ -25,9 +27,12 @@ var nativeCeil = Math.ceil,
|
|||||||
* _.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 [];
|
||||||
|
|||||||
@@ -8,9 +8,9 @@ var hasOwnProperty = objectProto.hasOwnProperty;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 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 _
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
import toString from './toString';
|
import toString from './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);
|
||||||
|
|
||||||
|
|||||||
@@ -3,8 +3,8 @@ import map from './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 _
|
||||||
|
|||||||
@@ -8,9 +8,9 @@ var hasOwnProperty = objectProto.hasOwnProperty;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 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 an array of elements responsible for generating the key.
|
* each key is an array of elements responsible for generating the key. The
|
||||||
* The iteratee is invoked with one argument: (value).
|
* iteratee is invoked with one argument: (value).
|
||||||
*
|
*
|
||||||
* @static
|
* @static
|
||||||
* @memberOf _
|
* @memberOf _
|
||||||
|
|||||||
2
has.js
2
has.js
@@ -29,7 +29,7 @@ import hasPath from './_hasPath';
|
|||||||
* // => false
|
* // => false
|
||||||
*/
|
*/
|
||||||
function has(object, path) {
|
function has(object, path) {
|
||||||
return hasPath(object, path, baseHas);
|
return object != null && hasPath(object, path, baseHas);
|
||||||
}
|
}
|
||||||
|
|
||||||
export default has;
|
export default has;
|
||||||
|
|||||||
2
hasIn.js
2
hasIn.js
@@ -28,7 +28,7 @@ import hasPath from './_hasPath';
|
|||||||
* // => false
|
* // => false
|
||||||
*/
|
*/
|
||||||
function hasIn(object, path) {
|
function hasIn(object, path) {
|
||||||
return hasPath(object, path, baseHasIn);
|
return object != null && hasPath(object, path, baseHasIn);
|
||||||
}
|
}
|
||||||
|
|
||||||
export default hasIn;
|
export default hasIn;
|
||||||
|
|||||||
@@ -9,8 +9,8 @@ var hasOwnProperty = objectProto.hasOwnProperty;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 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).
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -10,7 +10,8 @@ var objectProto = Object.prototype;
|
|||||||
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;
|
||||||
|
|||||||
@@ -6,7 +6,8 @@ var arrayBufferTag = '[object ArrayBuffer]';
|
|||||||
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;
|
||||||
|
|||||||
@@ -7,7 +7,8 @@ var boolTag = '[object Boolean]';
|
|||||||
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;
|
||||||
|
|||||||
@@ -7,7 +7,8 @@ var dateTag = '[object Date]';
|
|||||||
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;
|
||||||
|
|||||||
@@ -7,7 +7,8 @@ var errorTag = '[object Error]';
|
|||||||
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;
|
||||||
|
|||||||
@@ -8,7 +8,8 @@ var funcTag = '[object Function]',
|
|||||||
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;
|
||||||
|
|||||||
7
isNaN.js
7
isNaN.js
@@ -3,9 +3,10 @@ import isNumber from './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 _
|
||||||
|
|||||||
17
isNative.js
17
isNative.js
@@ -1,8 +1,12 @@
|
|||||||
import isFunction from './isFunction';
|
import isFunction from './isFunction';
|
||||||
import isHostObject from './_isHostObject';
|
import isHostObject from './_isHostObject';
|
||||||
import isObjectLike from './isObjectLike';
|
import isObject from './isObject';
|
||||||
|
import toSource from './_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). */
|
||||||
@@ -42,14 +46,11 @@ var reIsNative = RegExp('^' +
|
|||||||
* // => 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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export default isNative;
|
export default isNative;
|
||||||
|
|||||||
@@ -7,7 +7,8 @@ var numberTag = '[object Number]';
|
|||||||
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;
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* 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 _
|
||||||
|
|||||||
@@ -18,7 +18,8 @@ var hasOwnProperty = objectProto.hasOwnProperty;
|
|||||||
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;
|
||||||
|
|||||||
@@ -7,7 +7,8 @@ var regexpTag = '[object RegExp]';
|
|||||||
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;
|
||||||
|
|||||||
@@ -8,7 +8,8 @@ var stringTag = '[object String]';
|
|||||||
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;
|
||||||
|
|||||||
@@ -7,7 +7,8 @@ var symbolTag = '[object Symbol]';
|
|||||||
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;
|
||||||
|
|||||||
@@ -48,7 +48,8 @@ typedArrayTags[weakMapTag] = false;
|
|||||||
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;
|
||||||
|
|||||||
@@ -7,7 +7,8 @@ var weakSetTag = '[object WeakSet]';
|
|||||||
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;
|
||||||
|
|||||||
4
keyBy.js
4
keyBy.js
@@ -2,8 +2,8 @@ import createAggregator from './_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
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
* @license
|
* @license
|
||||||
* lodash 4.7.0 (Custom Build) <https://lodash.com/>
|
* lodash 4.8.2 (Custom Build) <https://lodash.com/>
|
||||||
* Build: `lodash modularize exports="es" -o ./`
|
* Build: `lodash modularize exports="es" -o ./`
|
||||||
* Copyright jQuery Foundation and other contributors <https://jquery.org/>
|
* Copyright jQuery Foundation and other contributors <https://jquery.org/>
|
||||||
* Released under MIT license <https://lodash.com/license>
|
* Released under MIT license <https://lodash.com/license>
|
||||||
@@ -44,7 +44,7 @@ import toInteger from './toInteger';
|
|||||||
import lodash from './wrapperLodash';
|
import lodash from './wrapperLodash';
|
||||||
|
|
||||||
/** Used as the semantic version number. */
|
/** Used as the semantic version number. */
|
||||||
var VERSION = '4.7.0';
|
var VERSION = '4.8.2';
|
||||||
|
|
||||||
/** Used to compose bitmasks for wrapper metadata. */
|
/** Used to compose bitmasks for wrapper metadata. */
|
||||||
var BIND_KEY_FLAG = 2;
|
var BIND_KEY_FLAG = 2;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
* @license
|
* @license
|
||||||
* lodash 4.7.0 (Custom Build) <https://lodash.com/>
|
* lodash 4.8.2 (Custom Build) <https://lodash.com/>
|
||||||
* Build: `lodash modularize exports="es" -o ./`
|
* Build: `lodash modularize exports="es" -o ./`
|
||||||
* Copyright jQuery Foundation and other contributors <https://jquery.org/>
|
* Copyright jQuery Foundation and other contributors <https://jquery.org/>
|
||||||
* Released under MIT license <https://lodash.com/license>
|
* Released under MIT license <https://lodash.com/license>
|
||||||
|
|||||||
10
map.js
10
map.js
@@ -4,7 +4,7 @@ import baseMap from './_baseMap';
|
|||||||
import isArray from './isArray';
|
import isArray from './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).
|
||||||
*
|
*
|
||||||
@@ -12,10 +12,10 @@ import isArray from './isArray';
|
|||||||
* `_.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 _
|
||||||
|
|||||||
@@ -4,8 +4,8 @@ import baseIteratee from './_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 _
|
||||||
|
|||||||
@@ -2,8 +2,8 @@ import baseForOwn from './_baseForOwn';
|
|||||||
import baseIteratee from './_baseIteratee';
|
import baseIteratee from './_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).
|
||||||
*
|
*
|
||||||
|
|||||||
4
over.js
4
over.js
@@ -2,8 +2,8 @@ import arrayMap from './_arrayMap';
|
|||||||
import createOver from './_createOver';
|
import createOver from './_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 _
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ var nativeMin = Math.min;
|
|||||||
* @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
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import createOver from './_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 _
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import createOver from './_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 _
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "lodash-es",
|
"name": "lodash-es",
|
||||||
"version": "4.7.0",
|
"version": "4.8.2",
|
||||||
"description": "Lodash exported as ES modules.",
|
"description": "Lodash exported as ES modules.",
|
||||||
"homepage": "https://lodash.com/custom-builds",
|
"homepage": "https://lodash.com/custom-builds",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
"private": true,
|
||||||
"jsnext:main": "lodash.js",
|
"jsnext:main": "lodash.js",
|
||||||
"main": "lodash.js",
|
"main": "lodash.js",
|
||||||
"private": true,
|
|
||||||
"keywords": "es6, modules, stdlib, util",
|
"keywords": "es6, 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": [
|
||||||
|
|||||||
@@ -7,9 +7,9 @@ import rest from './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.
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ var PARTIAL_RIGHT_FLAG = 64;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 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.
|
||||||
|
|||||||
2
rearg.js
2
rearg.js
@@ -7,7 +7,7 @@ var REARG_FLAG = 256;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 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.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import isArray from './isArray';
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 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:
|
||||||
|
|||||||
13
repeat.js
13
repeat.js
@@ -1,4 +1,5 @@
|
|||||||
import baseRepeat from './_baseRepeat';
|
import baseRepeat from './_baseRepeat';
|
||||||
|
import isIterateeCall from './_isIterateeCall';
|
||||||
import toInteger from './toInteger';
|
import toInteger from './toInteger';
|
||||||
import toString from './toString';
|
import toString from './toString';
|
||||||
|
|
||||||
@@ -10,7 +11,8 @@ import toString from './toString';
|
|||||||
* @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
|
||||||
*
|
*
|
||||||
@@ -23,8 +25,13 @@ import toString from './toString';
|
|||||||
* _.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);
|
||||||
}
|
}
|
||||||
|
|
||||||
export default repeat;
|
export default repeat;
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import baseClamp from './_baseClamp';
|
import baseClamp from './_baseClamp';
|
||||||
import baseRandom from './_baseRandom';
|
import baseRandom from './_baseRandom';
|
||||||
|
import isIterateeCall from './_isIterateeCall';
|
||||||
import toArray from './toArray';
|
import toArray from './toArray';
|
||||||
import toInteger from './toInteger';
|
import toInteger from './toInteger';
|
||||||
|
|
||||||
@@ -12,7 +13,8 @@ import toInteger from './toInteger';
|
|||||||
* @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
|
||||||
*
|
*
|
||||||
@@ -22,13 +24,17 @@ import toInteger from './toInteger';
|
|||||||
* _.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];
|
||||||
|
|||||||
2
set.js
2
set.js
@@ -24,7 +24,7 @@ import baseSet from './_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
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import rest from './rest';
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 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).
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ var nativeMax = Math.max;
|
|||||||
/**
|
/**
|
||||||
* 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).
|
||||||
|
|||||||
@@ -15,7 +15,10 @@ var reEmptyStringLeading = /\b__p \+= '';/g,
|
|||||||
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. */
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ function toNumber(value) {
|
|||||||
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);
|
||||||
|
|||||||
10
transform.js
10
transform.js
@@ -10,11 +10,11 @@ import isTypedArray from './isTypedArray';
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 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 _
|
||||||
|
|||||||
2
unset.js
2
unset.js
@@ -21,7 +21,7 @@ import baseUnset from './_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);
|
||||||
|
|||||||
Reference in New Issue
Block a user