mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-01-29 06:27:49 +00:00
Rebuild lodash and docs.
This commit is contained in:
247
dist/lodash.js
vendored
247
dist/lodash.js
vendored
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* @license
|
||||
* lodash 4.2.1 (Custom Build) <https://lodash.com/>
|
||||
* lodash 4.3.0 (Custom Build) <https://lodash.com/>
|
||||
* Build: `lodash -o ./dist/lodash.js`
|
||||
* Copyright 2012-2016 The Dojo Foundation <http://dojofoundation.org/>
|
||||
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
||||
@@ -13,7 +13,7 @@
|
||||
var undefined;
|
||||
|
||||
/** Used as the semantic version number. */
|
||||
var VERSION = '4.2.1';
|
||||
var VERSION = '4.3.0';
|
||||
|
||||
/** Used to compose bitmasks for wrapper metadata. */
|
||||
var BIND_FLAG = 1,
|
||||
@@ -82,7 +82,8 @@
|
||||
setTag = '[object Set]',
|
||||
stringTag = '[object String]',
|
||||
symbolTag = '[object Symbol]',
|
||||
weakMapTag = '[object WeakMap]';
|
||||
weakMapTag = '[object WeakMap]',
|
||||
weakSetTag = '[object WeakSet]';
|
||||
|
||||
var arrayBufferTag = '[object ArrayBuffer]',
|
||||
float32Tag = '[object Float32Array]',
|
||||
@@ -231,8 +232,8 @@
|
||||
|
||||
/** Used to assign default `context` object properties. */
|
||||
var contextProps = [
|
||||
'Array', 'Date', 'Error', 'Float32Array', 'Float64Array', 'Function',
|
||||
'Int8Array', 'Int16Array', 'Int32Array', 'Map', 'Math', 'Object',
|
||||
'Array', 'Buffer', 'Date', 'Error', 'Float32Array', 'Float64Array',
|
||||
'Function', 'Int8Array', 'Int16Array', 'Int32Array', 'Map', 'Math', 'Object',
|
||||
'Reflect', 'RegExp', 'Set', 'String', 'Symbol', 'TypeError', 'Uint8Array',
|
||||
'Uint8ClampedArray', 'Uint16Array', 'Uint32Array', 'WeakMap', '_',
|
||||
'clearTimeout', 'isFinite', 'parseInt', 'setTimeout'
|
||||
@@ -1306,7 +1307,8 @@
|
||||
);
|
||||
|
||||
/** Built-in value references. */
|
||||
var Reflect = context.Reflect,
|
||||
var Buffer = moduleExports ? context.Buffer : undefined,
|
||||
Reflect = context.Reflect,
|
||||
Symbol = context.Symbol,
|
||||
Uint8Array = context.Uint8Array,
|
||||
clearTimeout = context.clearTimeout,
|
||||
@@ -1339,9 +1341,10 @@
|
||||
/** Used to store function metadata. */
|
||||
var metaMap = WeakMap && new WeakMap;
|
||||
|
||||
/** Used to detect maps and sets. */
|
||||
/** Used to detect maps, sets, and weakmaps. */
|
||||
var mapCtorString = Map ? funcToString.call(Map) : '',
|
||||
setCtorString = Set ? funcToString.call(Set) : '';
|
||||
setCtorString = Set ? funcToString.call(Set) : '',
|
||||
weakMapCtorString = WeakMap ? funcToString.call(WeakMap) : '';
|
||||
|
||||
/** Used to convert symbols to primitives and strings. */
|
||||
var symbolProto = Symbol ? Symbol.prototype : undefined,
|
||||
@@ -2251,6 +2254,9 @@
|
||||
var tag = getTag(value),
|
||||
isFunc = tag == funcTag || tag == genTag;
|
||||
|
||||
if (isBuffer(value)) {
|
||||
return cloneBuffer(value, isDeep);
|
||||
}
|
||||
if (tag == objectTag || tag == argsTag || (isFunc && !object)) {
|
||||
if (isHostObject(value)) {
|
||||
return object ? value : {};
|
||||
@@ -2336,7 +2342,7 @@
|
||||
* @private
|
||||
* @param {Function} func The function to delay.
|
||||
* @param {number} wait The number of milliseconds to delay invocation.
|
||||
* @param {Object} args The arguments provide to `func`.
|
||||
* @param {Object} args The arguments to provide to `func`.
|
||||
* @returns {number} Returns the timer id.
|
||||
*/
|
||||
function baseDelay(func, wait, args) {
|
||||
@@ -2581,7 +2587,7 @@
|
||||
|
||||
/**
|
||||
* The base implementation of `_.functions` which creates an array of
|
||||
* `object` function property names filtered from those provided.
|
||||
* `object` function property names filtered from `props`.
|
||||
*
|
||||
* @private
|
||||
* @param {Object} object The object to inspect.
|
||||
@@ -3708,18 +3714,37 @@
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a clone of `buffer`.
|
||||
* Creates a clone of `buffer`.
|
||||
*
|
||||
* @private
|
||||
* @param {ArrayBuffer} buffer The array buffer to clone.
|
||||
* @param {Buffer} buffer The buffer to clone.
|
||||
* @param {boolean} [isDeep] Specify a deep clone.
|
||||
* @returns {Buffer} Returns the cloned buffer.
|
||||
*/
|
||||
function cloneBuffer(buffer, isDeep) {
|
||||
if (isDeep) {
|
||||
return buffer.slice();
|
||||
}
|
||||
var Ctor = buffer.constructor,
|
||||
result = new Ctor(buffer.length);
|
||||
|
||||
buffer.copy(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a clone of `arrayBuffer`.
|
||||
*
|
||||
* @private
|
||||
* @param {ArrayBuffer} arrayBuffer The array buffer to clone.
|
||||
* @returns {ArrayBuffer} Returns the cloned array buffer.
|
||||
*/
|
||||
function cloneBuffer(buffer) {
|
||||
var Ctor = buffer.constructor,
|
||||
result = new Ctor(buffer.byteLength),
|
||||
function cloneArrayBuffer(arrayBuffer) {
|
||||
var Ctor = arrayBuffer.constructor,
|
||||
result = new Ctor(arrayBuffer.byteLength),
|
||||
view = new Uint8Array(result);
|
||||
|
||||
view.set(new Uint8Array(buffer));
|
||||
view.set(new Uint8Array(arrayBuffer));
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -3785,7 +3810,7 @@
|
||||
var buffer = typedArray.buffer,
|
||||
Ctor = typedArray.constructor;
|
||||
|
||||
return new Ctor(isDeep ? cloneBuffer(buffer) : buffer, typedArray.byteOffset, typedArray.length);
|
||||
return new Ctor(isDeep ? cloneArrayBuffer(buffer) : buffer, typedArray.byteOffset, typedArray.length);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -4853,19 +4878,20 @@
|
||||
return objectToString.call(value);
|
||||
}
|
||||
|
||||
// Fallback for IE 11 providing `toStringTag` values for maps and sets.
|
||||
if ((Map && getTag(new Map) != mapTag) || (Set && getTag(new Set) != setTag)) {
|
||||
// Fallback for IE 11 providing `toStringTag` values for maps, sets, and weakmaps.
|
||||
if ((Map && getTag(new Map) != mapTag) ||
|
||||
(Set && getTag(new Set) != setTag) ||
|
||||
(WeakMap && getTag(new WeakMap) != weakMapTag)) {
|
||||
getTag = function(value) {
|
||||
var result = objectToString.call(value),
|
||||
Ctor = result == objectTag ? value.constructor : null,
|
||||
ctorString = typeof Ctor == 'function' ? funcToString.call(Ctor) : '';
|
||||
|
||||
if (ctorString) {
|
||||
if (ctorString == mapCtorString) {
|
||||
return mapTag;
|
||||
}
|
||||
if (ctorString == setCtorString) {
|
||||
return setTag;
|
||||
switch (ctorString) {
|
||||
case mapCtorString: return mapTag;
|
||||
case setCtorString: return setTag;
|
||||
case weakMapCtorString: return weakMapTag;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
@@ -4979,7 +5005,7 @@
|
||||
var Ctor = object.constructor;
|
||||
switch (tag) {
|
||||
case arrayBufferTag:
|
||||
return cloneBuffer(object);
|
||||
return cloneArrayBuffer(object);
|
||||
|
||||
case boolTag:
|
||||
case dateTag:
|
||||
@@ -5026,7 +5052,7 @@
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the provided arguments are from an iteratee call.
|
||||
* Checks if the given arguments are from an iteratee call.
|
||||
*
|
||||
* @private
|
||||
* @param {*} value The potential iteratee value argument.
|
||||
@@ -5434,7 +5460,7 @@
|
||||
|
||||
/**
|
||||
* Creates an array of unique `array` values not included in the other
|
||||
* provided arrays using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
|
||||
* given arrays using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
|
||||
* for equality comparisons.
|
||||
*
|
||||
* @static
|
||||
@@ -5914,8 +5940,8 @@
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an array of unique values that are included in all of the provided
|
||||
* arrays using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
|
||||
* Creates an array of unique values that are included in all given arrays
|
||||
* using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
|
||||
* for equality comparisons.
|
||||
*
|
||||
* @static
|
||||
@@ -6080,7 +6106,7 @@
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes all provided values from `array` using
|
||||
* Removes all given values from `array` using
|
||||
* [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
|
||||
* for equality comparisons.
|
||||
*
|
||||
@@ -6637,8 +6663,8 @@
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an array of unique values, in order, from all of the provided arrays
|
||||
* using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
|
||||
* Creates an array of unique values, in order, from all given arrays using
|
||||
* [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
|
||||
* for equality comparisons.
|
||||
*
|
||||
* @static
|
||||
@@ -6849,7 +6875,7 @@
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an array excluding all provided values using
|
||||
* Creates an array excluding all given values using
|
||||
* [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
|
||||
* for equality comparisons.
|
||||
*
|
||||
@@ -6872,7 +6898,7 @@
|
||||
|
||||
/**
|
||||
* Creates an array of unique values that is the [symmetric difference](https://en.wikipedia.org/wiki/Symmetric_difference)
|
||||
* of the provided arrays.
|
||||
* of the given arrays.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
@@ -7898,7 +7924,7 @@
|
||||
* Reduces `collection` to a value which is the accumulated result of running
|
||||
* each element in `collection` through `iteratee`, where each successive
|
||||
* invocation is supplied the return value of the previous. If `accumulator`
|
||||
* is not provided 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:
|
||||
* (accumulator, value, index|key, collection).
|
||||
*
|
||||
@@ -8627,7 +8653,7 @@
|
||||
if (maxWait === false) {
|
||||
var leadingCall = leading && !timeoutId;
|
||||
} else {
|
||||
if (!maxTimeoutId && !leading) {
|
||||
if (!lastCalled && !maxTimeoutId && !leading) {
|
||||
lastCalled = stamp;
|
||||
}
|
||||
var remaining = maxWait - (stamp - lastCalled),
|
||||
@@ -9426,6 +9452,27 @@
|
||||
*/
|
||||
var isArray = Array.isArray;
|
||||
|
||||
/**
|
||||
* Checks if `value` is classified as an `ArrayBuffer` object.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @type Function
|
||||
* @category Lang
|
||||
* @param {*} value The value to check.
|
||||
* @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
|
||||
* @example
|
||||
*
|
||||
* _.isArrayBuffer(new ArrayBuffer(2));
|
||||
* // => true
|
||||
*
|
||||
* _.isArrayBuffer(new Array(2));
|
||||
* // => false
|
||||
*/
|
||||
function isArrayBuffer(value) {
|
||||
return isObjectLike(value) && objectToString.call(value) == arrayBufferTag;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if `value` is array-like. A value is considered array-like if it's
|
||||
* not a function and has a `value.length` that's an integer greater than or
|
||||
@@ -9505,6 +9552,26 @@
|
||||
(isObjectLike(value) && objectToString.call(value) == boolTag);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if `value` is a buffer.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @category Lang
|
||||
* @param {*} value The value to check.
|
||||
* @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
|
||||
* @example
|
||||
*
|
||||
* _.isBuffer(new Buffer(2));
|
||||
* // => true
|
||||
*
|
||||
* _.isBuffer(new Uint8Array(2));
|
||||
* // => false
|
||||
*/
|
||||
var isBuffer = !Buffer ? constant(false) : function(value) {
|
||||
return value instanceof Buffer;
|
||||
};
|
||||
|
||||
/**
|
||||
* Checks if `value` is classified as a `Date` object.
|
||||
*
|
||||
@@ -9838,6 +9905,26 @@
|
||||
return !!value && typeof value == 'object';
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if `value` is classified as a `Map` object.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @category Lang
|
||||
* @param {*} value The value to check.
|
||||
* @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
|
||||
* @example
|
||||
*
|
||||
* _.isMap(new Map);
|
||||
* // => true
|
||||
*
|
||||
* _.isMap(new WeakMap);
|
||||
* // => false
|
||||
*/
|
||||
function isMap(value) {
|
||||
return isObjectLike(value) && getTag(value) == mapTag;
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs a deep comparison between `object` and `source` to determine if
|
||||
* `object` contains equivalent property values.
|
||||
@@ -10123,6 +10210,26 @@
|
||||
return isInteger(value) && value >= -MAX_SAFE_INTEGER && value <= MAX_SAFE_INTEGER;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if `value` is classified as a `Set` object.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @category Lang
|
||||
* @param {*} value The value to check.
|
||||
* @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
|
||||
* @example
|
||||
*
|
||||
* _.isSet(new Set);
|
||||
* // => true
|
||||
*
|
||||
* _.isSet(new WeakSet);
|
||||
* // => false
|
||||
*/
|
||||
function isSet(value) {
|
||||
return isObjectLike(value) && getTag(value) == setTag;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if `value` is classified as a `String` primitive or object.
|
||||
*
|
||||
@@ -10205,6 +10312,46 @@
|
||||
return value === undefined;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if `value` is classified as a `WeakMap` object.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @category Lang
|
||||
* @param {*} value The value to check.
|
||||
* @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
|
||||
* @example
|
||||
*
|
||||
* _.isWeakMap(new WeakMap);
|
||||
* // => true
|
||||
*
|
||||
* _.isWeakMap(new Map);
|
||||
* // => false
|
||||
*/
|
||||
function isWeakMap(value) {
|
||||
return isObjectLike(value) && getTag(value) == weakMapTag;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if `value` is classified as a `WeakSet` object.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @category Lang
|
||||
* @param {*} value The value to check.
|
||||
* @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
|
||||
* @example
|
||||
*
|
||||
* _.isWeakSet(new WeakSet);
|
||||
* // => true
|
||||
*
|
||||
* _.isWeakSet(new Set);
|
||||
* // => false
|
||||
*/
|
||||
function isWeakSet(value) {
|
||||
return isObjectLike(value) && objectToString.call(value) == weakSetTag;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if `value` is less than `other`.
|
||||
*
|
||||
@@ -10639,7 +10786,7 @@
|
||||
|
||||
/**
|
||||
* Creates an object that inherits from the `prototype` object. If a `properties`
|
||||
* object is provided its own enumerable properties are assigned to the created object.
|
||||
* object is given its own enumerable properties are assigned to the created object.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
@@ -12405,7 +12552,7 @@
|
||||
* in "interpolate" delimiters, HTML-escape interpolated data properties in
|
||||
* "escape" delimiters, and execute JavaScript in "evaluate" delimiters. Data
|
||||
* properties may be accessed as free variables in the template. If a setting
|
||||
* object is provided it takes precedence over `_.templateSettings` values.
|
||||
* object is given it takes precedence over `_.templateSettings` values.
|
||||
*
|
||||
* **Note:** In the development build `_.template` utilizes
|
||||
* [sourceURLs](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl)
|
||||
@@ -13083,9 +13230,9 @@
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a function that returns the result of invoking the provided
|
||||
* functions with the `this` binding of the created function, where each
|
||||
* successive invocation is supplied the return value of the previous.
|
||||
* Creates a function that returns the result of invoking the given functions
|
||||
* with the `this` binding of the created function, where each successive
|
||||
* invocation is supplied the return value of the previous.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
@@ -13106,7 +13253,7 @@
|
||||
|
||||
/**
|
||||
* This method is like `_.flow` except that it creates a function that
|
||||
* invokes the provided functions from right to left.
|
||||
* invokes the given functions from right to left.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
@@ -13126,7 +13273,7 @@
|
||||
var flowRight = createFlow(true);
|
||||
|
||||
/**
|
||||
* This method returns the first argument provided to it.
|
||||
* This method returns the first argument given to it.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
@@ -13678,7 +13825,7 @@
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates a unique ID. If `prefix` is provided the ID is appended to it.
|
||||
* Generates a unique ID. If `prefix` is given the ID is appended to it.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
@@ -13716,6 +13863,9 @@
|
||||
*/
|
||||
function add(augend, addend) {
|
||||
var result;
|
||||
if (augend === undefined && addend === undefined) {
|
||||
return 0;
|
||||
}
|
||||
if (augend !== undefined) {
|
||||
result = augend;
|
||||
}
|
||||
@@ -13926,6 +14076,9 @@
|
||||
*/
|
||||
function subtract(minuend, subtrahend) {
|
||||
var result;
|
||||
if (minuend === undefined && subtrahend === undefined) {
|
||||
return 0;
|
||||
}
|
||||
if (minuend !== undefined) {
|
||||
result = minuend;
|
||||
}
|
||||
@@ -14212,9 +14365,11 @@
|
||||
lodash.invoke = invoke;
|
||||
lodash.isArguments = isArguments;
|
||||
lodash.isArray = isArray;
|
||||
lodash.isArrayBuffer = isArrayBuffer;
|
||||
lodash.isArrayLike = isArrayLike;
|
||||
lodash.isArrayLikeObject = isArrayLikeObject;
|
||||
lodash.isBoolean = isBoolean;
|
||||
lodash.isBuffer = isBuffer;
|
||||
lodash.isDate = isDate;
|
||||
lodash.isElement = isElement;
|
||||
lodash.isEmpty = isEmpty;
|
||||
@@ -14225,6 +14380,7 @@
|
||||
lodash.isFunction = isFunction;
|
||||
lodash.isInteger = isInteger;
|
||||
lodash.isLength = isLength;
|
||||
lodash.isMap = isMap;
|
||||
lodash.isMatch = isMatch;
|
||||
lodash.isMatchWith = isMatchWith;
|
||||
lodash.isNaN = isNaN;
|
||||
@@ -14237,10 +14393,13 @@
|
||||
lodash.isPlainObject = isPlainObject;
|
||||
lodash.isRegExp = isRegExp;
|
||||
lodash.isSafeInteger = isSafeInteger;
|
||||
lodash.isSet = isSet;
|
||||
lodash.isString = isString;
|
||||
lodash.isSymbol = isSymbol;
|
||||
lodash.isTypedArray = isTypedArray;
|
||||
lodash.isUndefined = isUndefined;
|
||||
lodash.isWeakMap = isWeakMap;
|
||||
lodash.isWeakSet = isWeakSet;
|
||||
lodash.join = join;
|
||||
lodash.kebabCase = kebabCase;
|
||||
lodash.last = last;
|
||||
|
||||
Reference in New Issue
Block a user