diff --git a/README.md b/README.md index 49decd8b1..647465d2a 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# lodash v3.1.2 +# lodash v3.1.3 The [lodash](https://lodash.com/) library exported as [npm packages](https://www.npmjs.com/browse/keyword/lodash-modularized) per method. diff --git a/lodash._basecallback/LICENSE.txt b/lodash._basecallback/LICENSE.txt index 17764328c..9cd87e5dc 100644 --- a/lodash._basecallback/LICENSE.txt +++ b/lodash._basecallback/LICENSE.txt @@ -1,5 +1,5 @@ Copyright 2012-2015 The Dojo Foundation -Based on Underscore.js 1.7.0, copyright 2009-2015 Jeremy Ashkenas, +Based on Underscore.js, copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors Permission is hereby granted, free of charge, to any person obtaining diff --git a/lodash._basecallback/README.md b/lodash._basecallback/README.md index 48d9cfdec..665919808 100644 --- a/lodash._basecallback/README.md +++ b/lodash._basecallback/README.md @@ -1,4 +1,4 @@ -# lodash._basecallback v3.1.2 +# lodash._basecallback v3.1.3 The [modern build](https://github.com/lodash/lodash/wiki/Build-Differences) of [lodash’s](https://lodash.com/) internal `baseCallback` exported as a [Node.js](http://nodejs.org/)/[io.js](https://iojs.org/) module. @@ -17,4 +17,4 @@ In Node.js/io.js: var baseCallback = require('lodash._basecallback'); ``` -See the [package source](https://github.com/lodash/lodash/blob/3.1.2-npm-packages/lodash._basecallback) for more details. +See the [package source](https://github.com/lodash/lodash/blob/3.1.3-npm-packages/lodash._basecallback) for more details. diff --git a/lodash._basecallback/index.js b/lodash._basecallback/index.js index a34c780d1..77da0f99c 100644 --- a/lodash._basecallback/index.js +++ b/lodash._basecallback/index.js @@ -1,8 +1,8 @@ /** - * lodash 3.1.2 (Custom Build) + * lodash 3.1.3 (Custom Build) * Build: `lodash modern modularize exports="npm" -o ./` * Copyright 2012-2015 The Dojo Foundation - * Based on Underscore.js 1.7.0 + * Based on Underscore.js 1.8.2 * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors * Available under MIT license */ @@ -10,12 +10,6 @@ var baseIsEqual = require('lodash._baseisequal'), bindCallback = require('lodash._bindcallback'), keys = require('lodash.keys'); -/** Used for native method references. */ -var objectProto = Object.prototype; - -/** Used to check objects for own properties. */ -var hasOwnProperty = objectProto.hasOwnProperty; - /** * The base implementation of `_.callback` which supports specifying the * number of arguments to provide to `func`. @@ -29,9 +23,9 @@ var hasOwnProperty = objectProto.hasOwnProperty; function baseCallback(func, thisArg, argCount) { var type = typeof func; if (type == 'function') { - return (typeof thisArg != 'undefined') - ? bindCallback(func, thisArg, argCount) - : func; + return typeof thisArg == 'undefined' + ? func + : bindCallback(func, thisArg, argCount); } if (func == null) { return identity; @@ -46,7 +40,7 @@ function baseCallback(func, thisArg, argCount) { /** * The base implementation of `_.isMatch` without support for callback - * shorthands or `this` binding. + * shorthands and `this` binding. * * @private * @param {Object} object The object to inspect. @@ -57,30 +51,27 @@ function baseCallback(func, thisArg, argCount) { * @returns {boolean} Returns `true` if `object` is a match, else `false`. */ function baseIsMatch(object, props, values, strictCompareFlags, customizer) { - var length = props.length; - if (object == null) { - return !length; - } var index = -1, + length = props.length, noCustomizer = !customizer; while (++index < length) { if ((noCustomizer && strictCompareFlags[index]) ? values[index] !== object[props[index]] - : !hasOwnProperty.call(object, props[index]) + : !(props[index] in object) ) { return false; } } index = -1; while (++index < length) { - var key = props[index]; - if (noCustomizer && strictCompareFlags[index]) { - var result = hasOwnProperty.call(object, key); - } else { - var objValue = object[key], - srcValue = values[index]; + var key = props[index], + objValue = object[key], + srcValue = values[index]; + if (noCustomizer && strictCompareFlags[index]) { + var result = typeof objValue != 'undefined' || (key in object); + } else { result = customizer ? customizer(objValue, srcValue, key) : undefined; if (typeof result == 'undefined') { result = baseIsEqual(srcValue, objValue, customizer, true); @@ -104,13 +95,17 @@ function baseMatches(source) { var props = keys(source), length = props.length; + if (!length) { + return constant(true); + } if (length == 1) { var key = props[0], value = source[key]; if (isStrictComparable(value)) { return function(object) { - return object != null && object[key] === value && hasOwnProperty.call(object, key); + return object != null && object[key] === value && + (typeof value != 'undefined' || (key in toObject(object))); }; } } @@ -123,7 +118,7 @@ function baseMatches(source) { strictCompareFlags[length] = isStrictComparable(value); } return function(object) { - return baseIsMatch(object, props, values, strictCompareFlags); + return object != null && baseIsMatch(toObject(object), props, values, strictCompareFlags); }; } @@ -139,7 +134,8 @@ function baseMatches(source) { function baseMatchesProperty(key, value) { if (isStrictComparable(value)) { return function(object) { - return object != null && object[key] === value; + return object != null && object[key] === value && + (typeof value != 'undefined' || (key in toObject(object))); }; } return function(object) { @@ -173,10 +169,19 @@ function isStrictComparable(value) { } /** - * Checks if `value` is the language type of `Object`. - * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) + * Converts `value` to an object if it is not one. * - * **Note:** See the [ES5 spec](https://es5.github.io/#x8) for more details. + * @private + * @param {*} value The value to process. + * @returns {Object} Returns the object. + */ +function toObject(value) { + return isObject(value) ? value : Object(value); +} + +/** + * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`. + * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) * * @static * @memberOf _ @@ -198,7 +203,29 @@ function isObject(value) { // Avoid a V8 JIT bug in Chrome 19-20. // See https://code.google.com/p/v8/issues/detail?id=2291 for more details. var type = typeof value; - return type == 'function' || (value && type == 'object') || false; + return type == 'function' || (!!value && type == 'object'); +} + +/** + * Creates a function that returns `value`. + * + * @static + * @memberOf _ + * @category Utility + * @param {*} value The value to return from the new function. + * @returns {Function} Returns the new function. + * @example + * + * var object = { 'user': 'fred' }; + * var getter = _.constant(object); + * + * getter() === object; + * // => true + */ +function constant(value) { + return function() { + return value; + }; } /** diff --git a/lodash._basecallback/package.json b/lodash._basecallback/package.json index d39db988f..5ca503c6e 100644 --- a/lodash._basecallback/package.json +++ b/lodash._basecallback/package.json @@ -1,6 +1,6 @@ { "name": "lodash._basecallback", - "version": "3.1.2", + "version": "3.1.3", "description": "The modern build of lodash’s internal `baseCallback` as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", diff --git a/lodash._baseflatten/README.md b/lodash._baseflatten/README.md index 4da7b70df..643061a8a 100644 --- a/lodash._baseflatten/README.md +++ b/lodash._baseflatten/README.md @@ -1,4 +1,4 @@ -# lodash._baseflatten v3.1.1 +# lodash._baseflatten v3.1.3 The [modern build](https://github.com/lodash/lodash/wiki/Build-Differences) of [lodash’s](https://lodash.com/) internal `baseFlatten` exported as a [Node.js](http://nodejs.org/)/[io.js](https://iojs.org/) module. @@ -17,4 +17,4 @@ In Node.js/io.js: var baseFlatten = require('lodash._baseflatten'); ``` -See the [package source](https://github.com/lodash/lodash/blob/3.1.1-npm-packages/lodash._baseflatten) for more details. +See the [package source](https://github.com/lodash/lodash/blob/3.1.3-npm-packages/lodash._baseflatten) for more details. diff --git a/lodash._baseflatten/index.js b/lodash._baseflatten/index.js index 9177b1ef6..6cac0b3ea 100644 --- a/lodash._baseflatten/index.js +++ b/lodash._baseflatten/index.js @@ -1,8 +1,8 @@ /** - * lodash 3.1.1 (Custom Build) + * lodash 3.1.3 (Custom Build) * Build: `lodash modern modularize exports="npm" -o ./` * Copyright 2012-2015 The Dojo Foundation - * Based on Underscore.js 1.8.2 + * Based on Underscore.js 1.8.3 * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors * Available under MIT license */ @@ -24,7 +24,7 @@ function isObjectLike(value) { * Used as the [maximum length](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-number.max_safe_integer) * of an array-like value. */ -var MAX_SAFE_INTEGER = Math.pow(2, 53) - 1; +var MAX_SAFE_INTEGER = 9007199254740991; /** * The base implementation of `_.flatten` with added support for restricting @@ -32,8 +32,8 @@ var MAX_SAFE_INTEGER = Math.pow(2, 53) - 1; * * @private * @param {Array} array The array to flatten. - * @param {boolean} isDeep Specify a deep flatten. - * @param {boolean} isStrict Restrict flattening to arrays and `arguments` objects. + * @param {boolean} [isDeep] Specify a deep flatten. + * @param {boolean} [isStrict] Restrict flattening to arrays-like objects. * @returns {Array} Returns the new flattened array. */ function baseFlatten(array, isDeep, isStrict) { @@ -44,8 +44,8 @@ function baseFlatten(array, isDeep, isStrict) { while (++index < length) { var value = array[index]; - - if (isObjectLike(value) && isLength(value.length) && (isArray(value) || isArguments(value))) { + if (isObjectLike(value) && isArrayLike(value) && + (isStrict || isArray(value) || isArguments(value))) { if (isDeep) { // Recursively flatten arrays (susceptible to call stack limits). value = baseFlatten(value, isDeep, isStrict); @@ -53,7 +53,6 @@ function baseFlatten(array, isDeep, isStrict) { var valIndex = -1, valLength = value.length; - result.length += valLength; while (++valIndex < valLength) { result[++resIndex] = value[valIndex]; } @@ -64,6 +63,42 @@ function baseFlatten(array, isDeep, isStrict) { return result; } +/** + * The base implementation of `_.property` without support for deep paths. + * + * @private + * @param {string} key The key of the property to get. + * @returns {Function} Returns the new function. + */ +function baseProperty(key) { + return function(object) { + return object == null ? undefined : object[key]; + }; +} + +/** + * Gets the "length" property value of `object`. + * + * **Note:** This function is used to avoid a [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792) + * that affects Safari on at least iOS 8.1-8.3 ARM64. + * + * @private + * @param {Object} object The object to query. + * @returns {*} Returns the "length" value. + */ +var getLength = baseProperty('length'); + +/** + * Checks if `value` is array-like. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is array-like, else `false`. + */ +function isArrayLike(value) { + return value != null && isLength(getLength(value)); +} + /** * Checks if `value` is a valid array-like length. * diff --git a/lodash._baseflatten/package.json b/lodash._baseflatten/package.json index 74f03f55c..66f62e257 100644 --- a/lodash._baseflatten/package.json +++ b/lodash._baseflatten/package.json @@ -1,6 +1,6 @@ { "name": "lodash._baseflatten", - "version": "3.1.1", + "version": "3.1.3", "description": "The modern build of lodash’s internal `baseFlatten` as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", diff --git a/lodash._baseismatch/README.md b/lodash._baseismatch/README.md index fed2cbd97..d07f186e9 100644 --- a/lodash._baseismatch/README.md +++ b/lodash._baseismatch/README.md @@ -1,4 +1,4 @@ -# lodash._baseismatch v3.1.2 +# lodash._baseismatch v3.1.3 The [modern build](https://github.com/lodash/lodash/wiki/Build-Differences) of [lodash’s](https://lodash.com/) internal `baseIsMatch` exported as a [Node.js](http://nodejs.org/)/[io.js](https://iojs.org/) module. @@ -17,4 +17,4 @@ In Node.js/io.js: var baseIsMatch = require('lodash._baseismatch'); ``` -See the [package source](https://github.com/lodash/lodash/blob/3.1.2-npm-packages/lodash._baseismatch) for more details. +See the [package source](https://github.com/lodash/lodash/blob/3.1.3-npm-packages/lodash._baseismatch) for more details. diff --git a/lodash._baseismatch/index.js b/lodash._baseismatch/index.js index dc9d12899..fcb754e90 100644 --- a/lodash._baseismatch/index.js +++ b/lodash._baseismatch/index.js @@ -1,5 +1,5 @@ /** - * lodash 3.1.2 (Custom Build) + * lodash 3.1.3 (Custom Build) * Build: `lodash modern modularize exports="npm" -o ./` * Copyright 2012-2015 The Dojo Foundation * Based on Underscore.js 1.8.3 @@ -14,44 +14,84 @@ var baseIsEqual = require('lodash._baseisequal'); * * @private * @param {Object} object The object to inspect. - * @param {Array} props The source property names to match. - * @param {Array} values The source values to match. - * @param {Array} strictCompareFlags Strict comparison flags for source values. + * @param {Array} matchData The propery names, values, and compare flags to match. * @param {Function} [customizer] The function to customize comparing objects. * @returns {boolean} Returns `true` if `object` is a match, else `false`. */ -function baseIsMatch(object, props, values, strictCompareFlags, customizer) { - var index = -1, - length = props.length, +function baseIsMatch(object, matchData, customizer) { + var index = matchData.length, + length = index, noCustomizer = !customizer; - while (++index < length) { - if ((noCustomizer && strictCompareFlags[index]) - ? values[index] !== object[props[index]] - : !(props[index] in object) + if (object == null) { + return !length; + } + object = toObject(object); + while (index--) { + var data = matchData[index]; + if ((noCustomizer && data[2]) + ? data[1] !== object[data[0]] + : !(data[0] in object) ) { return false; } } - index = -1; while (++index < length) { - var key = props[index], + data = matchData[index]; + var key = data[0], objValue = object[key], - srcValue = values[index]; + srcValue = data[1]; - if (noCustomizer && strictCompareFlags[index]) { - var result = objValue !== undefined || (key in object); - } else { - result = customizer ? customizer(objValue, srcValue, key) : undefined; - if (result === undefined) { - result = baseIsEqual(srcValue, objValue, customizer, true); + if (noCustomizer && data[2]) { + if (objValue === undefined && !(key in object)) { + return false; + } + } else { + var result = customizer ? customizer(objValue, srcValue, key) : undefined; + if (!(result === undefined ? baseIsEqual(srcValue, objValue, customizer, true) : result)) { + return false; } - } - if (!result) { - return false; } } return true; } +/** + * Converts `value` to an object if it's not one. + * + * @private + * @param {*} value The value to process. + * @returns {Object} Returns the object. + */ +function toObject(value) { + return isObject(value) ? value : Object(value); +} + +/** + * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`. + * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an object, else `false`. + * @example + * + * _.isObject({}); + * // => true + * + * _.isObject([1, 2, 3]); + * // => true + * + * _.isObject(1); + * // => false + */ +function isObject(value) { + // Avoid a V8 JIT bug in Chrome 19-20. + // See https://code.google.com/p/v8/issues/detail?id=2291 for more details. + var type = typeof value; + return !!value && (type == 'object' || type == 'function'); +} + module.exports = baseIsMatch; diff --git a/lodash._baseismatch/package.json b/lodash._baseismatch/package.json index df04d55e0..a702d7baf 100644 --- a/lodash._baseismatch/package.json +++ b/lodash._baseismatch/package.json @@ -1,6 +1,6 @@ { "name": "lodash._baseismatch", - "version": "3.1.2", + "version": "3.1.3", "description": "The modern build of lodash’s internal `baseIsMatch` as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", diff --git a/lodash._basematches/LICENSE.txt b/lodash._basematches/LICENSE.txt index 17764328c..9cd87e5dc 100644 --- a/lodash._basematches/LICENSE.txt +++ b/lodash._basematches/LICENSE.txt @@ -1,5 +1,5 @@ Copyright 2012-2015 The Dojo Foundation -Based on Underscore.js 1.7.0, copyright 2009-2015 Jeremy Ashkenas, +Based on Underscore.js, copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors Permission is hereby granted, free of charge, to any person obtaining diff --git a/lodash._basematches/README.md b/lodash._basematches/README.md index 3e812c631..d80f98f6b 100644 --- a/lodash._basematches/README.md +++ b/lodash._basematches/README.md @@ -1,4 +1,4 @@ -# lodash._basematches v3.1.2 +# lodash._basematches v3.1.3 The [modern build](https://github.com/lodash/lodash/wiki/Build-Differences) of [lodash’s](https://lodash.com/) internal `baseMatches` exported as a [Node.js](http://nodejs.org/)/[io.js](https://iojs.org/) module. @@ -17,4 +17,4 @@ In Node.js/io.js: var baseMatches = require('lodash._basematches'); ``` -See the [package source](https://github.com/lodash/lodash/blob/3.1.2-npm-packages/lodash._basematches) for more details. +See the [package source](https://github.com/lodash/lodash/blob/3.1.3-npm-packages/lodash._basematches) for more details. diff --git a/lodash._basematches/index.js b/lodash._basematches/index.js index bdadd1dc6..751aba06f 100644 --- a/lodash._basematches/index.js +++ b/lodash._basematches/index.js @@ -1,20 +1,14 @@ /** - * lodash 3.1.2 (Custom Build) + * lodash 3.1.3 (Custom Build) * Build: `lodash modern modularize exports="npm" -o ./` * Copyright 2012-2015 The Dojo Foundation - * Based on Underscore.js 1.7.0 + * Based on Underscore.js 1.8.2 * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors * Available under MIT license */ var baseIsMatch = require('lodash._baseismatch'), keys = require('lodash.keys'); -/** Used for native method references. */ -var objectProto = Object.prototype; - -/** Used to check objects for own properties. */ -var hasOwnProperty = objectProto.hasOwnProperty; - /** * The base implementation of `_.matches` which does not clone `source`. * @@ -26,13 +20,17 @@ function baseMatches(source) { var props = keys(source), length = props.length; + if (!length) { + return constant(true); + } if (length == 1) { var key = props[0], value = source[key]; if (isStrictComparable(value)) { return function(object) { - return object != null && object[key] === value && hasOwnProperty.call(object, key); + return object != null && object[key] === value && + (typeof value != 'undefined' || (key in toObject(object))); }; } } @@ -45,7 +43,7 @@ function baseMatches(source) { strictCompareFlags[length] = isStrictComparable(value); } return function(object) { - return baseIsMatch(object, props, values, strictCompareFlags); + return object != null && baseIsMatch(toObject(object), props, values, strictCompareFlags); }; } @@ -62,10 +60,19 @@ function isStrictComparable(value) { } /** - * Checks if `value` is the language type of `Object`. - * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) + * Converts `value` to an object if it is not one. * - * **Note:** See the [ES5 spec](https://es5.github.io/#x8) for more details. + * @private + * @param {*} value The value to process. + * @returns {Object} Returns the object. + */ +function toObject(value) { + return isObject(value) ? value : Object(value); +} + +/** + * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`. + * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) * * @static * @memberOf _ @@ -87,7 +94,29 @@ function isObject(value) { // Avoid a V8 JIT bug in Chrome 19-20. // See https://code.google.com/p/v8/issues/detail?id=2291 for more details. var type = typeof value; - return type == 'function' || (value && type == 'object') || false; + return type == 'function' || (!!value && type == 'object'); +} + +/** + * Creates a function that returns `value`. + * + * @static + * @memberOf _ + * @category Utility + * @param {*} value The value to return from the new function. + * @returns {Function} Returns the new function. + * @example + * + * var object = { 'user': 'fred' }; + * var getter = _.constant(object); + * + * getter() === object; + * // => true + */ +function constant(value) { + return function() { + return value; + }; } module.exports = baseMatches; diff --git a/lodash._basematches/package.json b/lodash._basematches/package.json index ecf5389fb..5f5e85897 100644 --- a/lodash._basematches/package.json +++ b/lodash._basematches/package.json @@ -1,6 +1,6 @@ { "name": "lodash._basematches", - "version": "3.1.2", + "version": "3.1.3", "description": "The modern build of lodash’s internal `baseMatches` as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", diff --git a/lodash.includes/LICENSE.txt b/lodash.includes/LICENSE similarity index 100% rename from lodash.includes/LICENSE.txt rename to lodash.includes/LICENSE diff --git a/lodash.includes/README.md b/lodash.includes/README.md index 069dd2a4b..05d80cae6 100644 --- a/lodash.includes/README.md +++ b/lodash.includes/README.md @@ -1,4 +1,4 @@ -# lodash.includes v3.1.2 +# lodash.includes v3.1.3 The [modern build](https://github.com/lodash/lodash/wiki/Build-Differences) of [lodash’s](https://lodash.com/) `_.includes` exported as a [Node.js](http://nodejs.org/)/[io.js](https://iojs.org/) module. @@ -17,4 +17,4 @@ In Node.js/io.js: var includes = require('lodash.includes'); ``` -See the [documentation](https://lodash.com/docs#includes) or [package source](https://github.com/lodash/lodash/blob/3.1.2-npm-packages/lodash.includes) for more details. +See the [documentation](https://lodash.com/docs#includes) or [package source](https://github.com/lodash/lodash/blob/3.1.3-npm-packages/lodash.includes) for more details. diff --git a/lodash.includes/index.js b/lodash.includes/index.js index 15af57091..cd48267d2 100644 --- a/lodash.includes/index.js +++ b/lodash.includes/index.js @@ -1,5 +1,5 @@ /** - * lodash 3.1.2 (Custom Build) + * lodash 3.1.3 (Custom Build) * Build: `lodash modern modularize exports="npm" -o ./` * Copyright 2012-2015 The Dojo Foundation * Based on Underscore.js 1.8.3 @@ -17,7 +17,7 @@ var baseIndexOf = require('lodash._baseindexof'), var nativeMax = Math.max; /** - * Used as the [maximum length](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-number.max_safe_integer) + * Used as the [maximum length](http://ecma-international.org/ecma-262/6.0/#sec-number.max_safe_integer) * of an array-like value. */ var MAX_SAFE_INTEGER = 9007199254740991; @@ -50,7 +50,7 @@ var getLength = baseProperty('length'); /** * Checks if `value` is a valid array-like length. * - * **Note:** This function is based on [`ToLength`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tolength). + * **Note:** This function is based on [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength). * * @private * @param {*} value The value to check. @@ -61,9 +61,9 @@ function isLength(value) { } /** - * Checks if `value` is in `collection` using - * [`SameValueZero`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) - * for equality comparisons. If `fromIndex` is negative, it is used as the offset + * Checks if `target` is in `collection` using + * [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) + * for equality comparisons. If `fromIndex` is negative, it's used as the offset * from the end of `collection`. * * @static @@ -95,17 +95,14 @@ function includes(collection, target, fromIndex, guard) { collection = values(collection); length = collection.length; } - if (!length) { - return false; - } if (typeof fromIndex != 'number' || (guard && isIterateeCall(target, fromIndex, guard))) { fromIndex = 0; } else { fromIndex = fromIndex < 0 ? nativeMax(length + fromIndex, 0) : (fromIndex || 0); } return (typeof collection == 'string' || !isArray(collection) && isString(collection)) - ? (fromIndex < length && collection.indexOf(target, fromIndex) > -1) - : (baseIndexOf(collection, target, fromIndex) > -1); + ? (fromIndex <= length && collection.indexOf(target, fromIndex) > -1) + : (!!length && baseIndexOf(collection, target, fromIndex) > -1); } /** diff --git a/lodash.includes/package.json b/lodash.includes/package.json index 12ab1000b..055c53a08 100644 --- a/lodash.includes/package.json +++ b/lodash.includes/package.json @@ -1,6 +1,6 @@ { "name": "lodash.includes", - "version": "3.1.2", + "version": "3.1.3", "description": "The modern build of lodash’s `_.includes` as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", diff --git a/lodash.ismatch/README.md b/lodash.ismatch/README.md index 50a3020d6..dda6531c3 100644 --- a/lodash.ismatch/README.md +++ b/lodash.ismatch/README.md @@ -1,4 +1,4 @@ -# lodash.ismatch v3.1.2 +# lodash.ismatch v3.1.3 The [modern build](https://github.com/lodash/lodash/wiki/Build-Differences) of [lodash’s](https://lodash.com/) `_.isMatch` exported as a [Node.js](http://nodejs.org/)/[io.js](https://iojs.org/) module. @@ -17,4 +17,4 @@ In Node.js/io.js: var isMatch = require('lodash.ismatch'); ``` -See the [documentation](https://lodash.com/docs#isMatch) or [package source](https://github.com/lodash/lodash/blob/3.1.2-npm-packages/lodash.ismatch) for more details. +See the [documentation](https://lodash.com/docs#isMatch) or [package source](https://github.com/lodash/lodash/blob/3.1.3-npm-packages/lodash.ismatch) for more details. diff --git a/lodash.ismatch/index.js b/lodash.ismatch/index.js index 2fed94668..54db885ea 100644 --- a/lodash.ismatch/index.js +++ b/lodash.ismatch/index.js @@ -1,5 +1,5 @@ /** - * lodash 3.1.2 (Custom Build) + * lodash 3.1.3 (Custom Build) * Build: `lodash modern modularize exports="npm" -o ./` * Copyright 2012-2015 The Dojo Foundation * Based on Underscore.js 1.8.3 @@ -19,7 +19,7 @@ var baseIsMatch = require('lodash._baseismatch'), * equality comparisons, else `false`. */ function isStrictComparable(value) { - return value === value && (value === 0 ? ((1 / value) > 0) : !isObject(value)); + return value === value && !isObject(value); } /** diff --git a/lodash.ismatch/package.json b/lodash.ismatch/package.json index f92ac0959..ad95353b5 100644 --- a/lodash.ismatch/package.json +++ b/lodash.ismatch/package.json @@ -1,6 +1,6 @@ { "name": "lodash.ismatch", - "version": "3.1.2", + "version": "3.1.3", "description": "The modern build of lodash’s `_.isMatch` as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", diff --git a/lodash.map/README.md b/lodash.map/README.md index cf728cc39..28f463f2c 100644 --- a/lodash.map/README.md +++ b/lodash.map/README.md @@ -1,4 +1,4 @@ -# lodash.map v3.1.1 +# lodash.map v3.1.3 The [modern build](https://github.com/lodash/lodash/wiki/Build-Differences) of [lodash’s](https://lodash.com/) `_.map` exported as a [Node.js](http://nodejs.org/)/[io.js](https://iojs.org/) module. @@ -17,4 +17,4 @@ In Node.js/io.js: var map = require('lodash.map'); ``` -See the [documentation](https://lodash.com/docs#map) or [package source](https://github.com/lodash/lodash/blob/3.1.1-npm-packages/lodash.map) for more details. +See the [documentation](https://lodash.com/docs#map) or [package source](https://github.com/lodash/lodash/blob/3.1.3-npm-packages/lodash.map) for more details. diff --git a/lodash.map/index.js b/lodash.map/index.js index 5ea9ecf62..2f4c8a62b 100644 --- a/lodash.map/index.js +++ b/lodash.map/index.js @@ -1,5 +1,5 @@ /** - * lodash 3.1.1 (Custom Build) + * lodash 3.1.3 (Custom Build) * Build: `lodash modern modularize exports="npm" -o ./` * Copyright 2012-2015 The Dojo Foundation * Based on Underscore.js 1.8.3 @@ -16,7 +16,7 @@ var arrayMap = require('lodash._arraymap'), * Used as the [maximum length](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-number.max_safe_integer) * of an array-like value. */ -var MAX_SAFE_INTEGER = Math.pow(2, 53) - 1; +var MAX_SAFE_INTEGER = 9007199254740991; /** * The base implementation of `_.map` without support for callback shorthands @@ -29,8 +29,7 @@ var MAX_SAFE_INTEGER = Math.pow(2, 53) - 1; */ function baseMap(collection, iteratee) { var index = -1, - length = getLength(collection), - result = isLength(length) ? Array(length) : []; + result = isArrayLike(collection) ? Array(collection.length) : []; baseEach(collection, function(value, key, collection) { result[++index] = iteratee(value, key, collection); @@ -55,7 +54,7 @@ function baseProperty(key) { * Gets the "length" property value of `object`. * * **Note:** This function is used to avoid a [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792) - * in Safari on iOS 8.1 ARM64. + * that affects Safari on at least iOS 8.1-8.3 ARM64. * * @private * @param {Object} object The object to query. @@ -63,6 +62,17 @@ function baseProperty(key) { */ var getLength = baseProperty('length'); +/** + * Checks if `value` is array-like. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is array-like, else `false`. + */ +function isArrayLike(value) { + return value != null && isLength(getLength(value)); +} + /** * Checks if `value` is a valid array-like length. * @@ -92,14 +102,15 @@ function isLength(value) { * callback returns `true` for elements that have the properties of the given * object, else `false`. * - * Many lodash methods are guarded to work as interatees for methods like + * Many lodash methods are guarded to work as iteratees for methods like * `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`. * * The guarded methods are: - * `ary`, `callback`, `chunk`, `clone`, `create`, `curry`, `curryRight`, `drop`, - * `dropRight`, `every`, `fill`, `flatten`, `invert`, `max`, `min`, `parseInt`, - * `slice`, `sortBy`, `take`, `takeRight`, `template`, `trim`, `trimLeft`, - * `trimRight`, `trunc`, `random`, `range`, `sample`, `some`, `uniq`, and `words` + * `ary`, `callback`, `chunk`, `clone`, `create`, `curry`, `curryRight`, + * `drop`, `dropRight`, `every`, `fill`, `flatten`, `invert`, `max`, `min`, + * `parseInt`, `slice`, `sortBy`, `take`, `takeRight`, `template`, `trim`, + * `trimLeft`, `trimRight`, `trunc`, `random`, `range`, `sample`, `some`, + * `sum`, `uniq`, and `words` * * @static * @memberOf _ diff --git a/lodash.map/package.json b/lodash.map/package.json index 7cd2847da..6b33c2224 100644 --- a/lodash.map/package.json +++ b/lodash.map/package.json @@ -1,6 +1,6 @@ { "name": "lodash.map", - "version": "3.1.1", + "version": "3.1.3", "description": "The modern build of lodash’s `_.map` as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", diff --git a/lodash.padleft/README.md b/lodash.padleft/README.md index 06cfc4c33..5256675c6 100644 --- a/lodash.padleft/README.md +++ b/lodash.padleft/README.md @@ -1,4 +1,4 @@ -# lodash.padleft v3.1.2 +# lodash.padleft v3.1.3 The [lodash](https://lodash.com/) method `_.padLeft` exported as a [Node.js](https://nodejs.org/) module. @@ -21,4 +21,4 @@ In Node.js/io.js: var padLeft = require('lodash.padleft'); ``` -See the [documentation](https://lodash.com/docs#padLeft) or [package source](https://github.com/lodash/lodash/blob/3.1.2-npm-packages/lodash.padleft) for more details. +See the [documentation](https://lodash.com/docs#padLeft) or [package source](https://github.com/lodash/lodash/blob/3.1.3-npm-packages/lodash.padleft) for more details. diff --git a/lodash.padleft/index.js b/lodash.padleft/index.js index 395b801ba..7f5aed840 100644 --- a/lodash.padleft/index.js +++ b/lodash.padleft/index.js @@ -1,5 +1,5 @@ /** - * lodash 3.1.2 (Custom Build) + * lodash 3.1.3 (Custom Build) * Build: `lodash modern modularize exports="npm" -o ./` * Copyright 2012-2015 The Dojo Foundation * Based on Underscore.js 1.8.3 diff --git a/lodash.padleft/package.json b/lodash.padleft/package.json index 15db495d7..49eabad5d 100644 --- a/lodash.padleft/package.json +++ b/lodash.padleft/package.json @@ -1,17 +1,14 @@ { "name": "lodash.padleft", - "version": "3.1.2", - "description": "The modern build of lodash’s `_.padLeft` as a module.", + "version": "3.1.3", + "description": "The lodash method `_.padLeft` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", "license": "MIT", - "keywords": "lodash, lodash-modularized, stdlib, util", "author": "John-David Dalton (http://allyoucanleet.com/)", "contributors": [ "John-David Dalton (http://allyoucanleet.com/)", - "Benjamin Tan (https://d10.github.io/)", - "Blaine Bublitz (http://www.iceddev.com/)", - "Kit Cambridge (http://kitcambridge.be/)", + "Blaine Bublitz (https://github.com/phated)", "Mathias Bynens (https://mathiasbynens.be/)" ], "repository": "lodash/lodash", diff --git a/lodash.padright/README.md b/lodash.padright/README.md index f90b77bda..66db91b15 100644 --- a/lodash.padright/README.md +++ b/lodash.padright/README.md @@ -1,4 +1,4 @@ -# lodash.padright v3.1.2 +# lodash.padright v3.1.3 The [lodash](https://lodash.com/) method `_.padRight` exported as a [Node.js](https://nodejs.org/) module. @@ -21,4 +21,4 @@ In Node.js/io.js: var padRight = require('lodash.padright'); ``` -See the [documentation](https://lodash.com/docs#padRight) or [package source](https://github.com/lodash/lodash/blob/3.1.2-npm-packages/lodash.padright) for more details. +See the [documentation](https://lodash.com/docs#padRight) or [package source](https://github.com/lodash/lodash/blob/3.1.3-npm-packages/lodash.padright) for more details. diff --git a/lodash.padright/index.js b/lodash.padright/index.js index 56615ada0..e0f0bf021 100644 --- a/lodash.padright/index.js +++ b/lodash.padright/index.js @@ -1,5 +1,5 @@ /** - * lodash 3.1.2 (Custom Build) + * lodash 3.1.3 (Custom Build) * Build: `lodash modern modularize exports="npm" -o ./` * Copyright 2012-2015 The Dojo Foundation * Based on Underscore.js 1.8.3 diff --git a/lodash.padright/package.json b/lodash.padright/package.json index 3c6e1aae3..a765b3831 100644 --- a/lodash.padright/package.json +++ b/lodash.padright/package.json @@ -1,17 +1,14 @@ { "name": "lodash.padright", - "version": "3.1.2", - "description": "The modern build of lodash’s `_.padRight` as a module.", + "version": "3.1.3", + "description": "The lodash method `_.padRight` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", "license": "MIT", - "keywords": "lodash, lodash-modularized, stdlib, util", "author": "John-David Dalton (http://allyoucanleet.com/)", "contributors": [ "John-David Dalton (http://allyoucanleet.com/)", - "Benjamin Tan (https://d10.github.io/)", - "Blaine Bublitz (http://www.iceddev.com/)", - "Kit Cambridge (http://kitcambridge.be/)", + "Blaine Bublitz (https://github.com/phated)", "Mathias Bynens (https://mathiasbynens.be/)" ], "repository": "lodash/lodash", diff --git a/lodash.random/README.md b/lodash.random/README.md index d10b1cda9..1da0568e3 100644 --- a/lodash.random/README.md +++ b/lodash.random/README.md @@ -1,4 +1,4 @@ -# lodash.random v3.1.2 +# lodash.random v3.1.3 The [lodash](https://lodash.com/) method `_.random` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var random = require('lodash.random'); ``` -See the [documentation](https://lodash.com/docs#random) or [package source](https://github.com/lodash/lodash/blob/3.1.2-npm-packages/lodash.random) for more details. +See the [documentation](https://lodash.com/docs#random) or [package source](https://github.com/lodash/lodash/blob/3.1.3-npm-packages/lodash.random) for more details. diff --git a/lodash.random/index.js b/lodash.random/index.js index 34596f906..f292c1c68 100644 --- a/lodash.random/index.js +++ b/lodash.random/index.js @@ -1,5 +1,5 @@ /** - * lodash 3.1.2 (Custom Build) + * lodash 3.1.3 (Custom Build) * Build: `lodash modularize exports="npm" -o ./` * Copyright 2012-2016 The Dojo Foundation * Based on Underscore.js 1.8.3 @@ -181,8 +181,7 @@ function eq(value, other) { * // => false */ function isArrayLike(value) { - return value != null && - !(typeof value == 'function' && isFunction(value)) && isLength(getLength(value)); + return value != null && isLength(getLength(value)) && !isFunction(value); } /** @@ -203,8 +202,8 @@ function isArrayLike(value) { */ function isFunction(value) { // The use of `Object#toString` avoids issues with the `typeof` operator - // in Safari 8 which returns 'object' for typed array constructors, and - // PhantomJS 1.9 which returns 'function' for `NodeList` instances. + // in Safari 8 which returns 'object' for typed array and weak map constructors, + // and PhantomJS 1.9 which returns 'function' for `NodeList` instances. var tag = isObject(value) ? objectToString.call(value) : ''; return tag == funcTag || tag == genTag; } diff --git a/lodash.random/package.json b/lodash.random/package.json index 70e37f9f0..2a6a88997 100644 --- a/lodash.random/package.json +++ b/lodash.random/package.json @@ -1,6 +1,6 @@ { "name": "lodash.random", - "version": "3.1.2", + "version": "3.1.3", "description": "The lodash method `_.random` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -9,7 +9,7 @@ "author": "John-David Dalton (http://allyoucanleet.com/)", "contributors": [ "John-David Dalton (http://allyoucanleet.com/)", - "Blaine Bublitz (https://github.com/phated)", + "Blaine Bublitz (https://github.com/phated)", "Mathias Bynens (https://mathiasbynens.be/)" ], "repository": "lodash/lodash", diff --git a/lodash.range/README.md b/lodash.range/README.md index 3d17aa5c6..fe868299a 100644 --- a/lodash.range/README.md +++ b/lodash.range/README.md @@ -1,4 +1,4 @@ -# lodash.range v3.1.2 +# lodash.range v3.1.3 The [lodash](https://lodash.com/) method `_.range` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var range = require('lodash.range'); ``` -See the [documentation](https://lodash.com/docs#range) or [package source](https://github.com/lodash/lodash/blob/3.1.2-npm-packages/lodash.range) for more details. +See the [documentation](https://lodash.com/docs#range) or [package source](https://github.com/lodash/lodash/blob/3.1.3-npm-packages/lodash.range) for more details. diff --git a/lodash.range/index.js b/lodash.range/index.js index b8281a2f3..49141ae50 100644 --- a/lodash.range/index.js +++ b/lodash.range/index.js @@ -1,5 +1,5 @@ /** - * lodash 3.1.2 (Custom Build) + * lodash 3.1.3 (Custom Build) * Build: `lodash modularize exports="npm" -o ./` * Copyright 2012-2016 The Dojo Foundation * Based on Underscore.js 1.8.3 @@ -215,8 +215,7 @@ function eq(value, other) { * // => false */ function isArrayLike(value) { - return value != null && - !(typeof value == 'function' && isFunction(value)) && isLength(getLength(value)); + return value != null && isLength(getLength(value)) && !isFunction(value); } /** @@ -237,8 +236,8 @@ function isArrayLike(value) { */ function isFunction(value) { // The use of `Object#toString` avoids issues with the `typeof` operator - // in Safari 8 which returns 'object' for typed array constructors, and - // PhantomJS 1.9 which returns 'function' for `NodeList` instances. + // in Safari 8 which returns 'object' for typed array and weak map constructors, + // and PhantomJS 1.9 which returns 'function' for `NodeList` instances. var tag = isObject(value) ? objectToString.call(value) : ''; return tag == funcTag || tag == genTag; } diff --git a/lodash.range/package.json b/lodash.range/package.json index e1b160f03..51a2f585b 100644 --- a/lodash.range/package.json +++ b/lodash.range/package.json @@ -1,6 +1,6 @@ { "name": "lodash.range", - "version": "3.1.2", + "version": "3.1.3", "description": "The lodash method `_.range` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -9,7 +9,7 @@ "author": "John-David Dalton (http://allyoucanleet.com/)", "contributors": [ "John-David Dalton (http://allyoucanleet.com/)", - "Blaine Bublitz (https://github.com/phated)", + "Blaine Bublitz (https://github.com/phated)", "Mathias Bynens (https://mathiasbynens.be/)" ], "repository": "lodash/lodash", diff --git a/lodash.sortby/README.md b/lodash.sortby/README.md index 1c5540422..4fe0ae302 100644 --- a/lodash.sortby/README.md +++ b/lodash.sortby/README.md @@ -1,4 +1,4 @@ -# lodash.sortby v3.1.1 +# lodash.sortby v3.1.3 The [modern build](https://github.com/lodash/lodash/wiki/Build-Differences) of [lodash’s](https://lodash.com/) `_.sortBy` exported as a [Node.js](http://nodejs.org/)/[io.js](https://iojs.org/) module. @@ -17,4 +17,4 @@ In Node.js/io.js: var sortBy = require('lodash.sortby'); ``` -See the [documentation](https://lodash.com/docs#sortBy) or [package source](https://github.com/lodash/lodash/blob/3.1.1-npm-packages/lodash.sortby) for more details. +See the [documentation](https://lodash.com/docs#sortBy) or [package source](https://github.com/lodash/lodash/blob/3.1.3-npm-packages/lodash.sortby) for more details. diff --git a/lodash.sortby/index.js b/lodash.sortby/index.js index 3699b8400..cb872e169 100644 --- a/lodash.sortby/index.js +++ b/lodash.sortby/index.js @@ -1,5 +1,5 @@ /** - * lodash 3.1.1 (Custom Build) + * lodash 3.1.3 (Custom Build) * Build: `lodash modern modularize exports="npm" -o ./` * Copyright 2012-2015 The Dojo Foundation * Based on Underscore.js 1.8.3 @@ -31,7 +31,7 @@ function compareAscending(object, other) { * Used as the [maximum length](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-number.max_safe_integer) * of an array-like value. */ -var MAX_SAFE_INTEGER = Math.pow(2, 53) - 1; +var MAX_SAFE_INTEGER = 9007199254740991; /** * The base implementation of `_.map` without support for callback shorthands @@ -44,8 +44,7 @@ var MAX_SAFE_INTEGER = Math.pow(2, 53) - 1; */ function baseMap(collection, iteratee) { var index = -1, - length = getLength(collection), - result = isLength(length) ? Array(length) : []; + result = isArrayLike(collection) ? Array(collection.length) : []; baseEach(collection, function(value, key, collection) { result[++index] = iteratee(value, key, collection); @@ -70,7 +69,7 @@ function baseProperty(key) { * Gets the "length" property value of `object`. * * **Note:** This function is used to avoid a [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792) - * in Safari on iOS 8.1 ARM64. + * that affects Safari on at least iOS 8.1-8.3 ARM64. * * @private * @param {Object} object The object to query. @@ -78,6 +77,17 @@ function baseProperty(key) { */ var getLength = baseProperty('length'); +/** + * Checks if `value` is array-like. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is array-like, else `false`. + */ +function isArrayLike(value) { + return value != null && isLength(getLength(value)); +} + /** * Checks if `value` is a valid array-like length. * diff --git a/lodash.sortby/package.json b/lodash.sortby/package.json index 14b44b9d1..7411061a5 100644 --- a/lodash.sortby/package.json +++ b/lodash.sortby/package.json @@ -1,6 +1,6 @@ { "name": "lodash.sortby", - "version": "3.1.1", + "version": "3.1.3", "description": "The modern build of lodash’s `_.sortBy` as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg",