diff --git a/README.md b/README.md index 871071331..33a7ef26e 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# lodash v4.2.1 +# lodash v4.3.0 The [lodash](https://lodash.com/) library exported as [Node.js](https://nodejs.org/) modules. @@ -28,7 +28,7 @@ var chunk = require('lodash/chunk'); var extend = require('lodash/fp/extend'); ``` -See the [package source](https://github.com/lodash/lodash/tree/4.2.1-npm) for more details. +See the [package source](https://github.com/lodash/lodash/tree/4.3.0-npm) for more details. **Note:**
Don’t assign values to the [special variable](http://nodejs.org/api/repl.html#repl_repl_features) `_` when in the REPL.
diff --git a/_baseClone.js b/_baseClone.js index d57870f92..42d90a95c 100644 --- a/_baseClone.js +++ b/_baseClone.js @@ -3,6 +3,7 @@ var Stack = require('./_Stack'), assignValue = require('./_assignValue'), baseAssign = require('./_baseAssign'), baseForOwn = require('./_baseForOwn'), + cloneBuffer = require('./_cloneBuffer'), copyArray = require('./_copyArray'), copySymbols = require('./_copySymbols'), getTag = require('./_getTag'), @@ -10,6 +11,7 @@ var Stack = require('./_Stack'), initCloneByTag = require('./_initCloneByTag'), initCloneObject = require('./_initCloneObject'), isArray = require('./isArray'), + isBuffer = require('./isBuffer'), isHostObject = require('./_isHostObject'), isObject = require('./isObject'); @@ -91,6 +93,9 @@ function baseClone(value, isDeep, customizer, key, object, stack) { var tag = getTag(value), isFunc = tag == funcTag || tag == genTag; + if (isBuffer(value)) { + return cloneBuffer(value, isDeep); + } if (tag == objectTag || tag == argsTag || (isFunc && !object)) { if (isHostObject(value)) { return object ? value : {}; diff --git a/_baseDelay.js b/_baseDelay.js index edd83565b..c39756257 100644 --- a/_baseDelay.js +++ b/_baseDelay.js @@ -8,7 +8,7 @@ var FUNC_ERROR_TEXT = 'Expected a function'; * @private * @param {Function} func The function to delay. * @param {number} wait The number of milliseconds to delay invocation. - * @param {Object} args The arguments provide to `func`. + * @param {Object} args The arguments to provide to `func`. * @returns {number} Returns the timer id. */ function baseDelay(func, wait, args) { diff --git a/_baseFunctions.js b/_baseFunctions.js index b3dc8f9c9..6e1090f9c 100644 --- a/_baseFunctions.js +++ b/_baseFunctions.js @@ -3,7 +3,7 @@ var arrayFilter = require('./_arrayFilter'), /** * 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. diff --git a/_cloneArrayBuffer.js b/_cloneArrayBuffer.js new file mode 100644 index 000000000..a7ed50cdd --- /dev/null +++ b/_cloneArrayBuffer.js @@ -0,0 +1,19 @@ +var Uint8Array = require('./_Uint8Array'); + +/** + * Creates a clone of `arrayBuffer`. + * + * @private + * @param {ArrayBuffer} arrayBuffer The array buffer to clone. + * @returns {ArrayBuffer} Returns the cloned array buffer. + */ +function cloneArrayBuffer(arrayBuffer) { + var Ctor = arrayBuffer.constructor, + result = new Ctor(arrayBuffer.byteLength), + view = new Uint8Array(result); + + view.set(new Uint8Array(arrayBuffer)); + return result; +} + +module.exports = cloneArrayBuffer; diff --git a/_cloneBuffer.js b/_cloneBuffer.js index defdb151c..58a4e2bdd 100644 --- a/_cloneBuffer.js +++ b/_cloneBuffer.js @@ -1,18 +1,19 @@ -var Uint8Array = require('./_Uint8Array'); - /** - * Creates a clone of `buffer`. + * Creates a clone of `buffer`. * * @private - * @param {ArrayBuffer} buffer The array buffer to clone. - * @returns {ArrayBuffer} Returns the cloned array buffer. + * @param {Buffer} buffer The buffer to clone. + * @param {boolean} [isDeep] Specify a deep clone. + * @returns {Buffer} Returns the cloned buffer. */ -function cloneBuffer(buffer) { +function cloneBuffer(buffer, isDeep) { + if (isDeep) { + return buffer.slice(); + } var Ctor = buffer.constructor, - result = new Ctor(buffer.byteLength), - view = new Uint8Array(result); + result = new Ctor(buffer.length); - view.set(new Uint8Array(buffer)); + buffer.copy(result); return result; } diff --git a/_cloneTypedArray.js b/_cloneTypedArray.js index b17467de2..8a2d0f7e6 100644 --- a/_cloneTypedArray.js +++ b/_cloneTypedArray.js @@ -1,4 +1,4 @@ -var cloneBuffer = require('./_cloneBuffer'); +var cloneArrayBuffer = require('./_cloneArrayBuffer'); /** * Creates a clone of `typedArray`. @@ -12,7 +12,7 @@ function cloneTypedArray(typedArray, isDeep) { 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); } module.exports = cloneTypedArray; diff --git a/_getTag.js b/_getTag.js index ceacc4fa1..1516eca39 100644 --- a/_getTag.js +++ b/_getTag.js @@ -1,10 +1,12 @@ var Map = require('./_Map'), - Set = require('./_Set'); + Set = require('./_Set'), + WeakMap = require('./_WeakMap'); /** `Object#toString` result references. */ var mapTag = '[object Map]', objectTag = '[object Object]', - setTag = '[object Set]'; + setTag = '[object Set]', + weakMapTag = '[object WeakMap]'; /** Used for built-in method references. */ var objectProto = Object.prototype; @@ -18,9 +20,10 @@ var funcToString = Function.prototype.toString; */ var objectToString = objectProto.toString; -/** Used to detect maps and sets. */ +/** Used to detect maps, sets, and weakmaps. */ var mapCtorString = Map ? funcToString.call(Map) : '', - setCtorString = Set ? funcToString.call(Set) : ''; + setCtorString = Set ? funcToString.call(Set) : '', + weakMapCtorString = WeakMap ? funcToString.call(WeakMap) : ''; /** * Gets the `toStringTag` of `value`. @@ -33,19 +36,20 @@ function getTag(value) { return objectToString.call(value); } -// Fallback for IE 11 providing `toStringTag` values for maps and sets. -if ((Map && getTag(new Map) != mapTag) || (Set && getTag(new Set) != setTag)) { +// Fallback for IE 11 providing `toStringTag` values for maps, sets, and weakmaps. +if ((Map && getTag(new Map) != mapTag) || + (Set && getTag(new Set) != setTag) || + (WeakMap && getTag(new WeakMap) != weakMapTag)) { getTag = function(value) { var result = objectToString.call(value), Ctor = result == objectTag ? value.constructor : null, ctorString = typeof Ctor == 'function' ? funcToString.call(Ctor) : ''; if (ctorString) { - if (ctorString == mapCtorString) { - return mapTag; - } - if (ctorString == setCtorString) { - return setTag; + switch (ctorString) { + case mapCtorString: return mapTag; + case setCtorString: return setTag; + case weakMapCtorString: return weakMapTag; } } return result; diff --git a/_initCloneByTag.js b/_initCloneByTag.js index c326ba908..5d21cda7f 100644 --- a/_initCloneByTag.js +++ b/_initCloneByTag.js @@ -1,4 +1,4 @@ -var cloneBuffer = require('./_cloneBuffer'), +var cloneArrayBuffer = require('./_cloneArrayBuffer'), cloneMap = require('./_cloneMap'), cloneRegExp = require('./_cloneRegExp'), cloneSet = require('./_cloneSet'), @@ -42,7 +42,7 @@ function initCloneByTag(object, tag, isDeep) { var Ctor = object.constructor; switch (tag) { case arrayBufferTag: - return cloneBuffer(object); + return cloneArrayBuffer(object); case boolTag: case dateTag: diff --git a/_isIterateeCall.js b/_isIterateeCall.js index 34afa3ea8..b422b4869 100644 --- a/_isIterateeCall.js +++ b/_isIterateeCall.js @@ -4,7 +4,7 @@ var eq = require('./eq'), isObject = require('./isObject'); /** - * Checks if the provided arguments are from an iteratee call. + * Checks if the given arguments are from an iteratee call. * * @private * @param {*} value The potential iteratee value argument. diff --git a/add.js b/add.js index 3be02f08c..d09785022 100644 --- a/add.js +++ b/add.js @@ -14,6 +14,9 @@ */ function add(augend, addend) { var result; + if (augend === undefined && addend === undefined) { + return 0; + } if (augend !== undefined) { result = augend; } diff --git a/bind.js b/bind.js index 2a50568fb..bd89d1f03 100644 --- a/bind.js +++ b/bind.js @@ -52,4 +52,7 @@ var bind = rest(function(func, thisArg, partials) { return createWrapper(func, bitmask, thisArg, partials, holders); }); +// Assign default placeholders. +bind.placeholder = {}; + module.exports = bind; diff --git a/bindKey.js b/bindKey.js index ba8e1cb29..5cefad3ed 100644 --- a/bindKey.js +++ b/bindKey.js @@ -62,4 +62,7 @@ var bindKey = rest(function(object, key, partials) { return createWrapper(key, bitmask, object, partials, holders); }); +// Assign default placeholders. +bindKey.placeholder = {}; + module.exports = bindKey; diff --git a/core.js b/core.js index 120fdd867..ee2a004e7 100644 --- a/core.js +++ b/core.js @@ -1,6 +1,6 @@ /** * @license - * lodash 4.2.1 (Custom Build) + * lodash 4.3.0 (Custom Build) * Build: `lodash core -o ./dist/lodash.core.js` * Copyright 2012-2016 The Dojo Foundation * Based on Underscore.js 1.8.3 @@ -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, @@ -576,7 +576,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) { @@ -692,7 +692,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. @@ -1924,7 +1924,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). * @@ -3099,7 +3099,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 _ @@ -3407,7 +3407,7 @@ /*------------------------------------------------------------------------*/ /** - * This method returns the first argument provided to it. + * This method returns the first argument given to it. * * @static * @memberOf _ @@ -3592,7 +3592,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 _ diff --git a/create.js b/create.js index 196512358..dddbd29f7 100644 --- a/create.js +++ b/create.js @@ -3,7 +3,7 @@ var baseAssign = require('./_baseAssign'), /** * 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 _ diff --git a/curry.js b/curry.js index 13874ce00..1c5e8a5fb 100644 --- a/curry.js +++ b/curry.js @@ -50,4 +50,7 @@ function curry(func, arity, guard) { return result; } +// Assign default placeholders. +curry.placeholder = {}; + module.exports = curry; diff --git a/curryRight.js b/curryRight.js index f809955b3..8521fdc4f 100644 --- a/curryRight.js +++ b/curryRight.js @@ -47,4 +47,7 @@ function curryRight(func, arity, guard) { return result; } +// Assign default placeholders. +curryRight.placeholder = {}; + module.exports = curryRight; diff --git a/debounce.js b/debounce.js index fadf716ab..fd735e933 100644 --- a/debounce.js +++ b/debounce.js @@ -135,7 +135,7 @@ function debounce(func, wait, options) { if (maxWait === false) { var leadingCall = leading && !timeoutId; } else { - if (!maxTimeoutId && !leading) { + if (!lastCalled && !maxTimeoutId && !leading) { lastCalled = stamp; } var remaining = maxWait - (stamp - lastCalled), diff --git a/difference.js b/difference.js index a1495b357..5036d8ef7 100644 --- a/difference.js +++ b/difference.js @@ -5,7 +5,7 @@ var baseDifference = require('./_baseDifference'), /** * 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 diff --git a/flow.js b/flow.js index a69e914c2..b773405f6 100644 --- a/flow.js +++ b/flow.js @@ -1,9 +1,9 @@ var createFlow = require('./_createFlow'); /** - * Creates a function that returns the result of invoking the provided - * functions with the `this` binding of the created function, where each - * successive invocation is supplied the return value of the previous. + * Creates a function that returns the result of invoking the given functions + * with the `this` binding of the created function, where each successive + * invocation is supplied the return value of the previous. * * @static * @memberOf _ diff --git a/flowRight.js b/flowRight.js index 4164a8b98..e844822bd 100644 --- a/flowRight.js +++ b/flowRight.js @@ -2,7 +2,7 @@ var createFlow = require('./_createFlow'); /** * This method is like `_.flow` except that it creates a function that - * invokes the provided functions from right to left. + * invokes the given functions from right to left. * * @static * @memberOf _ diff --git a/fp/_baseConvert.js b/fp/_baseConvert.js index 2af63a7f0..76cc02ce8 100644 --- a/fp/_baseConvert.js +++ b/fp/_baseConvert.js @@ -9,9 +9,17 @@ var mapping = require('./_mapping'), * @param {Object} util The util object. * @param {string} name The name of the function to wrap. * @param {Function} func The function to wrap. + * @param {Object} [options] The options object. + * @param {boolean} [options.cap=true] Specify capping iteratee arguments. + * @param {boolean} [options.curry=true] Specify currying. + * @param {boolean} [options.fixed=true] Specify fixed arity. + * @param {boolean} [options.immutable=true] Specify immutable operations. + * @param {boolean} [options.rearg=true] Specify rearranging arguments. * @returns {Function|Object} Returns the converted function or object. */ -function baseConvert(util, name, func) { +function baseConvert(util, name, func, options) { + options || (options = {}); + if (typeof func != 'function') { func = name; name = undefined; @@ -19,6 +27,16 @@ function baseConvert(util, name, func) { if (func == null) { throw new TypeError; } + var config = { + 'cap': 'cap' in options ? options.cap : true, + 'curry': 'curry' in options ? options.curry : true, + 'fixed': 'fixed' in options ? options.fixed : true, + 'immutable': 'immutable' in options ? options.immutable : true, + 'rearg': 'rearg' in options ? options.rearg : true + }; + + var forceRearg = ('rearg' in options) && options.rearg; + var isLib = name === undefined && typeof func.VERSION == 'string'; var _ = isLib ? func : { @@ -107,6 +125,9 @@ function baseConvert(util, name, func) { var func = arguments[0], arity = arguments[1]; + if (!config.cap) { + return iteratee(func, arity); + } arity = arity > 2 ? (arity - 2) : 1; func = iteratee(func); var length = func.length; @@ -145,7 +166,7 @@ function baseConvert(util, name, func) { }, 'runInContext': function(runInContext) { return function(context) { - return baseConvert(util, runInContext(context)); + return baseConvert(util, runInContext(context), undefined, options); }; } }; @@ -157,14 +178,16 @@ function baseConvert(util, name, func) { return wrapper(func); } var wrapped = func; - if (mutateMap.array[name]) { - wrapped = immutWrap(func, cloneArray); - } - else if (mutateMap.object[name]) { - wrapped = immutWrap(func, createCloner(func)); - } - else if (mutateMap.set[name]) { - wrapped = immutWrap(func, cloneDeep); + if (config.immutable) { + if (mutateMap.array[name]) { + wrapped = immutWrap(func, cloneArray); + } + else if (mutateMap.object[name]) { + wrapped = immutWrap(func, createCloner(func)); + } + else if (mutateMap.set[name]) { + wrapped = immutWrap(func, cloneDeep); + } } var result; each(mapping.caps, function(cap) { @@ -174,19 +197,22 @@ function baseConvert(util, name, func) { reargIndexes = mapping.iterateeRearg[name], spreadStart = mapping.methodSpread[name]; - result = spreadStart === undefined - ? ary(wrapped, cap) - : spread(wrapped, spreadStart); - - if (cap > 1 && !mapping.skipRearg[name]) { + if (config.fixed) { + result = spreadStart === undefined + ? ary(wrapped, cap) + : spread(wrapped, spreadStart); + } + if (config.rearg && cap > 1 && (forceRearg || !mapping.skipRearg[name])) { result = rearg(result, mapping.methodRearg[name] || mapping.aryRearg[cap]); } - if (reargIndexes) { - result = iterateeRearg(result, reargIndexes); - } else if (aryN) { - result = iterateeAry(result, aryN); + if (config.cap) { + if (reargIndexes) { + result = iterateeRearg(result, reargIndexes); + } else if (aryN) { + result = iterateeAry(result, aryN); + } } - if (cap > 1) { + if (config.curry && cap > 1) { result = curry(result, cap); } return false; diff --git a/fp/_convertBrowser.js b/fp/_convertBrowser.js index b076778a4..0e69e66cd 100644 --- a/fp/_convertBrowser.js +++ b/fp/_convertBrowser.js @@ -4,10 +4,11 @@ var baseConvert = require('./_baseConvert'); * Converts `lodash` to an immutable auto-curried iteratee-first data-last version. * * @param {Function} lodash The lodash function. + * @param {Object} [options] The options object. See `baseConvert` for more details. * @returns {Function} Returns the converted `lodash`. */ -function browserConvert(lodash) { - return baseConvert(lodash, lodash); +function browserConvert(lodash, options) { + return baseConvert(lodash, lodash, undefined, options); } module.exports = browserConvert; diff --git a/fp/_mapping.js b/fp/_mapping.js index 8b8e24b75..75f0babaa 100644 --- a/fp/_mapping.js +++ b/fp/_mapping.js @@ -226,6 +226,10 @@ exports.skipRearg = { 'assignIn': true, 'concat': true, 'difference': true, + 'gt': true, + 'gte': true, + 'lt': true, + 'lte': true, 'matchesProperty': true, 'merge': true, 'partial': true, diff --git a/fp/convert.js b/fp/convert.js index 85f3b7535..a1d266fa6 100644 --- a/fp/convert.js +++ b/fp/convert.js @@ -7,10 +7,11 @@ var baseConvert = require('./_baseConvert'), * * @param {string} name The name of the function to wrap. * @param {Function} [func] The function to wrap. + * @param {Object} [options] The options object. See `baseConvert` for more details. * @returns {Function|Object} Returns the converted function or object. */ -function convert(name, func) { - return baseConvert(util, name, func); +function convert(name, func, options) { + return baseConvert(util, name, func, options); } module.exports = convert; diff --git a/fp/isArrayBuffer.js b/fp/isArrayBuffer.js new file mode 100644 index 000000000..655e85bac --- /dev/null +++ b/fp/isArrayBuffer.js @@ -0,0 +1 @@ +module.exports = require('../isArrayBuffer'); diff --git a/fp/isBuffer.js b/fp/isBuffer.js new file mode 100644 index 000000000..15af9b634 --- /dev/null +++ b/fp/isBuffer.js @@ -0,0 +1 @@ +module.exports = require('../isBuffer'); diff --git a/fp/isMap.js b/fp/isMap.js new file mode 100644 index 000000000..51fb7e2e9 --- /dev/null +++ b/fp/isMap.js @@ -0,0 +1 @@ +module.exports = require('../isMap'); diff --git a/fp/isSet.js b/fp/isSet.js new file mode 100644 index 000000000..f8a0a498c --- /dev/null +++ b/fp/isSet.js @@ -0,0 +1 @@ +module.exports = require('../isSet'); diff --git a/fp/isWeakMap.js b/fp/isWeakMap.js new file mode 100644 index 000000000..dc622014e --- /dev/null +++ b/fp/isWeakMap.js @@ -0,0 +1 @@ +module.exports = require('../isWeakMap'); diff --git a/fp/isWeakSet.js b/fp/isWeakSet.js new file mode 100644 index 000000000..7646ca884 --- /dev/null +++ b/fp/isWeakSet.js @@ -0,0 +1 @@ +module.exports = require('../isWeakSet'); diff --git a/identity.js b/identity.js index fa30e1789..da7dea19c 100644 --- a/identity.js +++ b/identity.js @@ -1,5 +1,5 @@ /** - * This method returns the first argument provided to it. + * This method returns the first argument given to it. * * @static * @memberOf _ diff --git a/intersection.js b/intersection.js index 8e1b8c35d..e97efddb7 100644 --- a/intersection.js +++ b/intersection.js @@ -4,8 +4,8 @@ var arrayMap = require('./_arrayMap'), toArrayLikeObject = require('./_toArrayLikeObject'); /** - * Creates an array of unique values that are included in all of the provided - * arrays using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) + * Creates an array of unique values that are included in all given arrays + * using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) * for equality comparisons. * * @static diff --git a/isArrayBuffer.js b/isArrayBuffer.js new file mode 100644 index 000000000..80b85633f --- /dev/null +++ b/isArrayBuffer.js @@ -0,0 +1,35 @@ +var isObjectLike = require('./isObjectLike'); + +var arrayBufferTag = '[object ArrayBuffer]'; + +/** Used for built-in method references. */ +var objectProto = Object.prototype; + +/** + * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) + * of values. + */ +var objectToString = objectProto.toString; + +/** + * Checks if `value` is classified as an `ArrayBuffer` object. + * + * @static + * @memberOf _ + * @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; +} + +module.exports = isArrayBuffer; diff --git a/isBuffer.js b/isBuffer.js new file mode 100644 index 000000000..1e6b8b6d3 --- /dev/null +++ b/isBuffer.js @@ -0,0 +1,42 @@ +var constant = require('./constant'), + root = require('./_root'); + +/** Used to determine if values are of the language type `Object`. */ +var objectTypes = { + 'function': true, + 'object': true +}; + +/** Detect free variable `exports`. */ +var freeExports = (objectTypes[typeof exports] && exports && !exports.nodeType) ? exports : null; + +/** Detect free variable `module`. */ +var freeModule = (objectTypes[typeof module] && module && !module.nodeType) ? module : null; + +/** Detect the popular CommonJS extension `module.exports`. */ +var moduleExports = (freeModule && freeModule.exports === freeExports) ? freeExports : null; + +/** Built-in value references. */ +var Buffer = moduleExports ? root.Buffer : undefined; + +/** + * Checks if `value` is a buffer. + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a buffer, else `false`. + * @example + * + * _.isBuffer(new Buffer(2)); + * // => true + * + * _.isBuffer(new Uint8Array(2)); + * // => false + */ +var isBuffer = !Buffer ? constant(false) : function(value) { + return value instanceof Buffer; +}; + +module.exports = isBuffer; diff --git a/isMap.js b/isMap.js new file mode 100644 index 000000000..bc92defd8 --- /dev/null +++ b/isMap.js @@ -0,0 +1,27 @@ +var getTag = require('./_getTag'), + isObjectLike = require('./isObjectLike'); + +/** `Object#toString` result references. */ +var mapTag = '[object Map]'; + +/** + * Checks if `value` is classified as a `Map` object. + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. + * @example + * + * _.isMap(new Map); + * // => true + * + * _.isMap(new WeakMap); + * // => false + */ +function isMap(value) { + return isObjectLike(value) && getTag(value) == mapTag; +} + +module.exports = isMap; diff --git a/isSet.js b/isSet.js new file mode 100644 index 000000000..e1d50be90 --- /dev/null +++ b/isSet.js @@ -0,0 +1,27 @@ +var getTag = require('./_getTag'), + isObjectLike = require('./isObjectLike'); + +/** `Object#toString` result references. */ +var setTag = '[object Set]'; + +/** + * Checks if `value` is classified as a `Set` object. + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. + * @example + * + * _.isSet(new Set); + * // => true + * + * _.isSet(new WeakSet); + * // => false + */ +function isSet(value) { + return isObjectLike(value) && getTag(value) == setTag; +} + +module.exports = isSet; diff --git a/isWeakMap.js b/isWeakMap.js new file mode 100644 index 000000000..d934a9f5e --- /dev/null +++ b/isWeakMap.js @@ -0,0 +1,27 @@ +var getTag = require('./_getTag'), + isObjectLike = require('./isObjectLike'); + +/** `Object#toString` result references. */ +var weakMapTag = '[object WeakMap]'; + +/** + * Checks if `value` is classified as a `WeakMap` object. + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. + * @example + * + * _.isWeakMap(new WeakMap); + * // => true + * + * _.isWeakMap(new Map); + * // => false + */ +function isWeakMap(value) { + return isObjectLike(value) && getTag(value) == weakMapTag; +} + +module.exports = isWeakMap; diff --git a/isWeakSet.js b/isWeakSet.js new file mode 100644 index 000000000..40674f480 --- /dev/null +++ b/isWeakSet.js @@ -0,0 +1,35 @@ +var isObjectLike = require('./isObjectLike'); + +/** `Object#toString` result references. */ +var weakSetTag = '[object WeakSet]'; + +/** Used for built-in method references. */ +var objectProto = Object.prototype; + +/** + * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) + * of values. + */ +var objectToString = objectProto.toString; + +/** + * Checks if `value` is classified as a `WeakSet` object. + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. + * @example + * + * _.isWeakSet(new WeakSet); + * // => true + * + * _.isWeakSet(new Set); + * // => false + */ +function isWeakSet(value) { + return isObjectLike(value) && objectToString.call(value) == weakSetTag; +} + +module.exports = isWeakSet; diff --git a/lang.js b/lang.js index f42b140fc..d3be68f06 100644 --- a/lang.js +++ b/lang.js @@ -8,9 +8,11 @@ module.exports = { 'gte': require('./gte'), 'isArguments': require('./isArguments'), 'isArray': require('./isArray'), + 'isArrayBuffer': require('./isArrayBuffer'), 'isArrayLike': require('./isArrayLike'), 'isArrayLikeObject': require('./isArrayLikeObject'), 'isBoolean': require('./isBoolean'), + 'isBuffer': require('./isBuffer'), 'isDate': require('./isDate'), 'isElement': require('./isElement'), 'isEmpty': require('./isEmpty'), @@ -21,6 +23,7 @@ module.exports = { 'isFunction': require('./isFunction'), 'isInteger': require('./isInteger'), 'isLength': require('./isLength'), + 'isMap': require('./isMap'), 'isMatch': require('./isMatch'), 'isMatchWith': require('./isMatchWith'), 'isNaN': require('./isNaN'), @@ -33,10 +36,13 @@ module.exports = { 'isPlainObject': require('./isPlainObject'), 'isRegExp': require('./isRegExp'), 'isSafeInteger': require('./isSafeInteger'), + 'isSet': require('./isSet'), 'isString': require('./isString'), 'isSymbol': require('./isSymbol'), 'isTypedArray': require('./isTypedArray'), 'isUndefined': require('./isUndefined'), + 'isWeakMap': require('./isWeakMap'), + 'isWeakSet': require('./isWeakSet'), 'lt': require('./lt'), 'lte': require('./lte'), 'toArray': require('./toArray'), diff --git a/lodash.js b/lodash.js index 97f4b4afe..d314acd09 100644 --- a/lodash.js +++ b/lodash.js @@ -1,6 +1,6 @@ /** * @license - * lodash 4.2.1 (Custom Build) + * lodash 4.3.0 (Custom Build) * Build: `lodash -d -o ./foo/lodash.js` * Copyright 2012-2016 The Dojo Foundation * Based on Underscore.js 1.8.3 @@ -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; diff --git a/package.json b/package.json index 8fe6b0536..d2d7465b8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "lodash", - "version": "4.2.1", + "version": "4.3.0", "description": "Lodash modular utilities.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", diff --git a/partial.js b/partial.js index e29a593fa..e857ab7d2 100644 --- a/partial.js +++ b/partial.js @@ -44,4 +44,7 @@ var partial = rest(function(func, partials) { return createWrapper(func, PARTIAL_FLAG, undefined, partials, holders); }); +// Assign default placeholders. +partial.placeholder = {}; + module.exports = partial; diff --git a/partialRight.js b/partialRight.js index 502f3a474..4fdb470bc 100644 --- a/partialRight.js +++ b/partialRight.js @@ -43,4 +43,7 @@ var partialRight = rest(function(func, partials) { return createWrapper(func, PARTIAL_RIGHT_FLAG, undefined, partials, holders); }); +// Assign default placeholders. +partialRight.placeholder = {}; + module.exports = partialRight; diff --git a/pull.js b/pull.js index 29099cdb2..c2f6c1e31 100644 --- a/pull.js +++ b/pull.js @@ -2,7 +2,7 @@ var pullAll = require('./pullAll'), rest = require('./rest'); /** - * 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. * diff --git a/reduce.js b/reduce.js index 3f99c43e3..98da3ff0a 100644 --- a/reduce.js +++ b/reduce.js @@ -8,7 +8,7 @@ var arrayReduce = require('./_arrayReduce'), * 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). * diff --git a/subtract.js b/subtract.js index b1836c8ed..9ce53f2a3 100644 --- a/subtract.js +++ b/subtract.js @@ -14,6 +14,9 @@ */ function subtract(minuend, subtrahend) { var result; + if (minuend === undefined && subtrahend === undefined) { + return 0; + } if (minuend !== undefined) { result = minuend; } diff --git a/template.js b/template.js index 14a090d5b..c09fcde87 100644 --- a/template.js +++ b/template.js @@ -29,7 +29,7 @@ var reUnescapedString = /['\n\r\u2028\u2029\\]/g; * 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) diff --git a/union.js b/union.js index 0aabbfba3..fafe1885e 100644 --- a/union.js +++ b/union.js @@ -3,8 +3,8 @@ var baseFlatten = require('./_baseFlatten'), rest = require('./rest'); /** - * 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 diff --git a/uniqueId.js b/uniqueId.js index 872d3305f..a39b2bcbe 100644 --- a/uniqueId.js +++ b/uniqueId.js @@ -4,7 +4,7 @@ var toString = require('./toString'); var idCounter = 0; /** - * 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 _ diff --git a/without.js b/without.js index 8ff1bf22d..b7dea5d5c 100644 --- a/without.js +++ b/without.js @@ -3,7 +3,7 @@ var baseDifference = require('./_baseDifference'), rest = require('./rest'); /** - * 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. * diff --git a/xor.js b/xor.js index 05ae2f18c..e92eee2e0 100644 --- a/xor.js +++ b/xor.js @@ -5,7 +5,7 @@ var arrayFilter = require('./_arrayFilter'), /** * 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 _