diff --git a/README.md b/README.md index 56c103463..fea48cc14 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# lodash v3.1.7 +# lodash v3.2.0 The [lodash](https://lodash.com/) library exported as [npm packages](https://www.npmjs.com/browse/keyword/lodash-modularized) per method. diff --git a/lodash._baseassign/README.md b/lodash._baseassign/README.md index ac002bc03..0aa230937 100644 --- a/lodash._baseassign/README.md +++ b/lodash._baseassign/README.md @@ -1,4 +1,4 @@ -# lodash._baseassign v3.1.1 +# lodash._baseassign v3.2.0 The [modern build](https://github.com/lodash/lodash/wiki/Build-Differences) of [lodash’s](https://lodash.com/) internal `baseAssign` exported as a [Node.js](http://nodejs.org/)/[io.js](https://iojs.org/) module. @@ -17,4 +17,4 @@ In Node.js/io.js: var baseAssign = require('lodash._baseassign'); ``` -See the [package source](https://github.com/lodash/lodash/blob/3.1.1-npm-packages/lodash._baseassign) for more details. +See the [package source](https://github.com/lodash/lodash/blob/3.2.0-npm-packages/lodash._baseassign) for more details. diff --git a/lodash._baseassign/index.js b/lodash._baseassign/index.js index 1e37f49e8..f5612c850 100644 --- a/lodash._baseassign/index.js +++ b/lodash._baseassign/index.js @@ -1,5 +1,5 @@ /** - * lodash 3.1.1 (Custom Build) + * lodash 3.2.0 (Custom Build) * Build: `lodash modern modularize exports="npm" -o ./` * Copyright 2012-2015 The Dojo Foundation * Based on Underscore.js 1.8.3 @@ -7,12 +7,8 @@ * Available under MIT license */ var baseCopy = require('lodash._basecopy'), - isNative = require('lodash.isnative'), keys = require('lodash.keys'); -/** Native method references. */ -var getOwnPropertySymbols = isNative(getOwnPropertySymbols = Object.getOwnPropertySymbols) && getOwnPropertySymbols; - /** * The base implementation of `_.assign` without support for argument juggling, * multiple sources, and `customizer` functions. @@ -22,81 +18,10 @@ var getOwnPropertySymbols = isNative(getOwnPropertySymbols = Object.getOwnProper * @param {Object} source The source object. * @returns {Object} Returns `object`. */ -var baseAssign = function(object, source) { +function baseAssign(object, source) { return source == null ? object - : baseCopy(source, getSymbols(source), baseCopy(source, keys(source), object)); -}; - -/** - * Creates an array of the own symbols of `object`. - * - * @private - * @param {Object} object The object to query. - * @returns {Array} Returns the array of symbols. - */ -var getSymbols = !getOwnPropertySymbols ? constant([]) : function(object) { - return getOwnPropertySymbols(toObject(object)); -}; - -/** - * Converts `value` to an object if it is 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 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; - }; + : baseCopy(source, keys(source), object); } module.exports = baseAssign; diff --git a/lodash._baseassign/package.json b/lodash._baseassign/package.json index 8a8418ff0..9eda1a808 100644 --- a/lodash._baseassign/package.json +++ b/lodash._baseassign/package.json @@ -1,6 +1,6 @@ { "name": "lodash._baseassign", - "version": "3.1.1", + "version": "3.2.0", "description": "The modern build of lodash’s internal `baseAssign` as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -17,7 +17,6 @@ "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, "dependencies": { "lodash._basecopy": "^3.0.0", - "lodash.isnative": "^3.0.0", "lodash.keys": "^3.0.0" } } diff --git a/lodash._basecallback/README.md b/lodash._basecallback/README.md index 665919808..383c55d74 100644 --- a/lodash._basecallback/README.md +++ b/lodash._basecallback/README.md @@ -1,4 +1,4 @@ -# lodash._basecallback v3.1.3 +# lodash._basecallback v3.2.0 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.3-npm-packages/lodash._basecallback) for more details. +See the [package source](https://github.com/lodash/lodash/blob/3.2.0-npm-packages/lodash._basecallback) for more details. diff --git a/lodash._basecallback/index.js b/lodash._basecallback/index.js index 77da0f99c..c8725ab64 100644 --- a/lodash._basecallback/index.js +++ b/lodash._basecallback/index.js @@ -1,15 +1,39 @@ /** - * lodash 3.1.3 (Custom Build) + * lodash 3.2.0 (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 */ var baseIsEqual = require('lodash._baseisequal'), bindCallback = require('lodash._bindcallback'), + isArray = require('lodash.isarray'), keys = require('lodash.keys'); +/** Used to match property names within property paths. */ +var reIsDeepProp = /\.|\[(?:[^[\]]+|(["'])(?:(?!\1)[^\n\\]|\\.)*?)\1\]/, + reIsPlainProp = /^\w*$/, + rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\n\\]|\\.)*?)\2)\]/g; + +/** Used to match backslashes in property paths. */ +var reEscapeChar = /\\(\\)?/g; + +/** + * Converts `value` to a string if it is not one. An empty string is returned + * for `null` or `undefined` values. + * + * @private + * @param {*} value The value to process. + * @returns {string} Returns the string. + */ +function baseToString(value) { + if (typeof value == 'string') { + return value; + } + return value == null ? '' : (value + ''); +} + /** * The base implementation of `_.callback` which supports specifying the * number of arguments to provide to `func`. @@ -23,7 +47,7 @@ var baseIsEqual = require('lodash._baseisequal'), function baseCallback(func, thisArg, argCount) { var type = typeof func; if (type == 'function') { - return typeof thisArg == 'undefined' + return thisArg === undefined ? func : bindCallback(func, thisArg, argCount); } @@ -33,9 +57,35 @@ function baseCallback(func, thisArg, argCount) { if (type == 'object') { return baseMatches(func); } - return typeof thisArg == 'undefined' - ? baseProperty(func + '') - : baseMatchesProperty(func + '', thisArg); + return thisArg === undefined + ? property(func) + : baseMatchesProperty(func, thisArg); +} + +/** + * The base implementation of `get` without support for string paths + * and default values. + * + * @private + * @param {Object} object The object to query. + * @param {Array} path The path of the property to get. + * @param {string} [pathKey] The key representation of path. + * @returns {*} Returns the resolved value. + */ +function baseGet(object, path, pathKey) { + if (object == null) { + return; + } + if (pathKey !== undefined && pathKey in toObject(object)) { + path = [pathKey]; + } + var index = -1, + length = path.length; + + while (object != null && ++index < length) { + var result = object = object[path[index]]; + } + return result; } /** @@ -70,10 +120,10 @@ function baseIsMatch(object, props, values, strictCompareFlags, customizer) { srcValue = values[index]; if (noCustomizer && strictCompareFlags[index]) { - var result = typeof objValue != 'undefined' || (key in object); + var result = objValue !== undefined || (key in object); } else { result = customizer ? customizer(objValue, srcValue, key) : undefined; - if (typeof result == 'undefined') { + if (result === undefined) { result = baseIsEqual(srcValue, objValue, customizer, true); } } @@ -104,8 +154,10 @@ function baseMatches(source) { if (isStrictComparable(value)) { return function(object) { - return object != null && object[key] === value && - (typeof value != 'undefined' || (key in toObject(object))); + if (object == null) { + return false; + } + return object[key] === value && (value !== undefined || (key in toObject(object))); }; } } @@ -123,28 +175,42 @@ function baseMatches(source) { } /** - * The base implementation of `_.matchesProperty` which does not coerce `key` - * to a string. + * The base implementation of `_.matchesProperty` which does not which does + * not clone `value`. * * @private - * @param {string} key The key of the property to get. + * @param {string} path The path of the property to get. * @param {*} value The value to compare. * @returns {Function} Returns the new function. */ -function baseMatchesProperty(key, value) { - if (isStrictComparable(value)) { - return function(object) { - return object != null && object[key] === value && - (typeof value != 'undefined' || (key in toObject(object))); - }; - } +function baseMatchesProperty(path, value) { + var isArr = isArray(path), + isCommon = isKey(path) && isStrictComparable(value), + pathKey = (path + ''); + + path = toPath(path); return function(object) { - return object != null && baseIsEqual(value, object[key], null, true); + if (object == null) { + return false; + } + var key = pathKey; + object = toObject(object); + if ((isArr || !isCommon) && !(key in object)) { + object = path.length == 1 ? object : baseGet(object, baseSlice(path, 0, -1)); + if (object == null) { + return false; + } + key = last(path); + object = toObject(object); + } + return object[key] === value + ? (value !== undefined || (key in object)) + : baseIsEqual(value, object[key], null, true); }; } /** - * The base implementation of `_.property` which does not coerce `key` to a string. + * The base implementation of `_.property` without support for deep paths. * * @private * @param {string} key The key of the property to get. @@ -156,6 +222,72 @@ function baseProperty(key) { }; } +/** + * A specialized version of `baseProperty` which supports deep paths. + * + * @private + * @param {Array|string} path The path of the property to get. + * @returns {Function} Returns the new function. + */ +function basePropertyDeep(path) { + var pathKey = (path + ''); + path = toPath(path); + return function(object) { + return baseGet(object, path, pathKey); + }; +} + +/** + * The base implementation of `_.slice` without an iteratee call guard. + * + * @private + * @param {Array} array The array to slice. + * @param {number} [start=0] The start position. + * @param {number} [end=array.length] The end position. + * @returns {Array} Returns the slice of `array`. + */ +function baseSlice(array, start, end) { + var index = -1, + length = array.length; + + start = start == null ? 0 : (+start || 0); + if (start < 0) { + start = -start > length ? 0 : (length + start); + } + end = (end === undefined || end > length) ? length : (+end || 0); + if (end < 0) { + end += length; + } + length = start > end ? 0 : ((end - start) >>> 0); + start >>>= 0; + + var result = Array(length); + while (++index < length) { + result[index] = array[index + start]; + } + return result; +} + +/** + * Checks if `value` is a property name and not a property path. + * + * @private + * @param {*} value The value to check. + * @param {Object} [object] The object to query keys on. + * @returns {boolean} Returns `true` if `value` is a property name, else `false`. + */ +function isKey(value, object) { + var type = typeof value; + if ((type == 'string' && reIsPlainProp.test(value)) || type == 'number') { + return true; + } + if (isArray(value)) { + return false; + } + var result = !reIsDeepProp.test(value); + return result || (object != null && value in toObject(object)); +} + /** * Checks if `value` is suitable for strict equality comparisons, i.e. `===`. * @@ -179,6 +311,42 @@ function toObject(value) { return isObject(value) ? value : Object(value); } +/** + * Converts `value` to property path array if it is not one. + * + * @private + * @param {*} value The value to process. + * @returns {Array} Returns the property path array. + */ +function toPath(value) { + if (isArray(value)) { + return value; + } + var result = []; + baseToString(value).replace(rePropName, function(match, number, quote, string) { + result.push(quote ? string.replace(reEscapeChar, '$1') : (number || match)); + }); + return result; +} + +/** + * Gets the last element of `array`. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array to query. + * @returns {*} Returns the last element of `array`. + * @example + * + * _.last([1, 2, 3]); + * // => 3 + */ +function last(array) { + var length = array ? array.length : 0; + return length ? array[length - 1] : undefined; +} + /** * 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('')`) @@ -247,4 +415,30 @@ function identity(value) { return value; } +/** + * Creates a function which returns the property value at `path` on a + * given object. + * + * @static + * @memberOf _ + * @category Utility + * @param {Array|string} path The path of the property to get. + * @returns {Function} Returns the new function. + * @example + * + * var objects = [ + * { 'a': { 'b': { 'c': 2 } } }, + * { 'a': { 'b': { 'c': 1 } } } + * ]; + * + * _.map(objects, _.property('a.b.c')); + * // => [2, 1] + * + * _.pluck(_.sortBy(objects, _.property(['a', 'b', 'c'])), 'a.b.c'); + * // => [1, 2] + */ +function property(path) { + return isKey(path) ? baseProperty(path) : basePropertyDeep(path); +} + module.exports = baseCallback; diff --git a/lodash._basecallback/package.json b/lodash._basecallback/package.json index 5ca503c6e..315a4c0b1 100644 --- a/lodash._basecallback/package.json +++ b/lodash._basecallback/package.json @@ -1,6 +1,6 @@ { "name": "lodash._basecallback", - "version": "3.1.3", + "version": "3.2.0", "description": "The modern build of lodash’s internal `baseCallback` as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -18,6 +18,7 @@ "dependencies": { "lodash._baseisequal": "^3.0.0", "lodash._bindcallback": "^3.0.0", + "lodash.isarray": "^3.0.0", "lodash.keys": "^3.0.0" } } diff --git a/lodash._baseclone/README.md b/lodash._baseclone/README.md index 20acdb866..65fdc7785 100644 --- a/lodash._baseclone/README.md +++ b/lodash._baseclone/README.md @@ -1,4 +1,4 @@ -# lodash._baseclone v3.1.0 +# lodash._baseclone v3.2.0 The [modern build](https://github.com/lodash/lodash/wiki/Build-Differences) of [lodash’s](https://lodash.com/) internal `baseClone` exported as a [Node.js](http://nodejs.org/)/[io.js](https://iojs.org/) module. @@ -17,4 +17,4 @@ In Node.js/io.js: var baseClone = require('lodash._baseclone'); ``` -See the [package source](https://github.com/lodash/lodash/blob/3.1.0-npm-packages/lodash._baseclone) for more details. +See the [package source](https://github.com/lodash/lodash/blob/3.2.0-npm-packages/lodash._baseclone) for more details. diff --git a/lodash._baseclone/index.js b/lodash._baseclone/index.js index a77e8c2ea..acc172d7f 100644 --- a/lodash._baseclone/index.js +++ b/lodash._baseclone/index.js @@ -1,5 +1,5 @@ /** - * lodash 3.1.0 (Custom Build) + * lodash 3.2.0 (Custom Build) * Build: `lodash modern modularize exports="npm" -o ./` * Copyright 2012-2015 The Dojo Foundation * Based on Underscore.js 1.8.3 @@ -10,8 +10,8 @@ var arrayCopy = require('lodash._arraycopy'), arrayEach = require('lodash._arrayeach'), baseAssign = require('lodash._baseassign'), baseFor = require('lodash._basefor'), + getNative = require('lodash._getnative'), isArray = require('lodash.isarray'), - isNative = require('lodash.isnative'), keys = require('lodash.keys'); /** `Object#toString` result references. */ @@ -71,10 +71,10 @@ var hasOwnProperty = objectProto.hasOwnProperty; var objToString = objectProto.toString; /** Native method references. */ -var ArrayBuffer = isNative(ArrayBuffer = global.ArrayBuffer) && ArrayBuffer, - bufferSlice = isNative(bufferSlice = ArrayBuffer && new ArrayBuffer(0).slice) && bufferSlice, +var ArrayBuffer = getNative(root, 'ArrayBuffer'), + bufferSlice = getNative(ArrayBuffer && new ArrayBuffer(0), 'slice'), floor = Math.floor, - Uint8Array = isNative(Uint8Array = global.Uint8Array) && Uint8Array; + Uint8Array = getNative(root, 'Uint8Array'); /** Used to clone array buffers. */ var Float64Array = (function() { @@ -82,10 +82,10 @@ var Float64Array = (function() { // where the array buffer's `byteLength` is not a multiple of the typed // array's `BYTES_PER_ELEMENT`. try { - var func = isNative(func = global.Float64Array) && func, + var func = getNative(root, 'Float64Array'), result = new func(new ArrayBuffer(10), 0, 1) && func; } catch(e) {} - return result; + return result || null; }()); /** Used as the size, in bytes, of each `Float64Array` element. */ @@ -298,7 +298,7 @@ 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'); + return !!value && (type == 'object' || type == 'function'); } /** diff --git a/lodash._baseclone/package.json b/lodash._baseclone/package.json index 8799ded64..cc835f3bd 100644 --- a/lodash._baseclone/package.json +++ b/lodash._baseclone/package.json @@ -1,6 +1,6 @@ { "name": "lodash._baseclone", - "version": "3.1.0", + "version": "3.2.0", "description": "The modern build of lodash’s internal `baseClone` as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -20,8 +20,8 @@ "lodash._arrayeach": "^3.0.0", "lodash._baseassign": "^3.0.0", "lodash._basefor": "^3.0.0", + "lodash._getnative": "^3.0.0", "lodash.isarray": "^3.0.0", - "lodash.isnative": "^3.0.0", "lodash.keys": "^3.0.0" } } diff --git a/lodash._basematches/README.md b/lodash._basematches/README.md index 696cc325b..ef6de6d18 100644 --- a/lodash._basematches/README.md +++ b/lodash._basematches/README.md @@ -1,4 +1,4 @@ -# lodash._basematches v3.1.5 +# lodash._basematches v3.2.0 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.5-npm-packages/lodash._basematches) for more details. +See the [package source](https://github.com/lodash/lodash/blob/3.2.0-npm-packages/lodash._basematches) for more details. diff --git a/lodash._basematches/index.js b/lodash._basematches/index.js index 3bed8b331..f62cc4d9d 100644 --- a/lodash._basematches/index.js +++ b/lodash._basematches/index.js @@ -1,5 +1,5 @@ /** - * lodash 3.1.5 (Custom Build) + * lodash 3.2.0 (Custom Build) * Build: `lodash modern modularize exports="npm" -o ./` * Copyright 2012-2015 The Dojo Foundation * Based on Underscore.js 1.8.3 @@ -7,7 +7,7 @@ * Available under MIT license */ var baseIsMatch = require('lodash._baseismatch'), - keys = require('lodash.keys'); + pairs = require('lodash.pairs'); /** * The base implementation of `_.matches` which does not clone `source`. @@ -17,38 +17,40 @@ var baseIsMatch = require('lodash._baseismatch'), * @returns {Function} Returns the new function. */ function baseMatches(source) { - var props = keys(source), - length = props.length; + var matchData = getMatchData(source); + if (matchData.length == 1 && matchData[0][2]) { + var key = matchData[0][0], + value = matchData[0][1]; - if (!length) { - return constant(true); - } - if (length == 1) { - var key = props[0], - value = source[key]; - - if (isStrictComparable(value)) { - return function(object) { - if (object == null) { - return false; - } - return object[key] === value && (value !== undefined || (key in toObject(object))); - }; - } - } - var values = Array(length), - strictCompareFlags = Array(length); - - while (length--) { - value = source[props[length]]; - values[length] = value; - strictCompareFlags[length] = isStrictComparable(value); + return function(object) { + if (object == null) { + return false; + } + return object[key] === value && (value !== undefined || (key in toObject(object))); + }; } return function(object) { - return object != null && baseIsMatch(toObject(object), props, values, strictCompareFlags); + return baseIsMatch(object, matchData); }; } +/** + * Gets the propery names, values, and compare flags of `object`. + * + * @private + * @param {Object} object The object to query. + * @returns {Array} Returns the match data of `object`. + */ +function getMatchData(object) { + var result = pairs(object), + length = result.length; + + while (length--) { + result[length][2] = isStrictComparable(result[length][1]); + } + return result; +} + /** * Checks if `value` is suitable for strict equality comparisons, i.e. `===`. * @@ -62,7 +64,7 @@ function isStrictComparable(value) { } /** - * Converts `value` to an object if it is not one. + * Converts `value` to an object if it's not one. * * @private * @param {*} value The value to process. @@ -96,29 +98,7 @@ 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'); -} - -/** - * 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; - }; + return !!value && (type == 'object' || type == 'function'); } module.exports = baseMatches; diff --git a/lodash._basematches/package.json b/lodash._basematches/package.json index 6ae9ed51e..973a6c2f7 100644 --- a/lodash._basematches/package.json +++ b/lodash._basematches/package.json @@ -1,6 +1,6 @@ { "name": "lodash._basematches", - "version": "3.1.5", + "version": "3.2.0", "description": "The modern build of lodash’s internal `baseMatches` as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -17,6 +17,6 @@ "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, "dependencies": { "lodash._baseismatch": "^3.0.0", - "lodash.keys": "^3.0.0" + "lodash.pairs": "^3.0.0" } } diff --git a/lodash._basematchesproperty/LICENSE.txt b/lodash._basematchesproperty/LICENSE.txt new file mode 100644 index 000000000..17764328c --- /dev/null +++ b/lodash._basematchesproperty/LICENSE.txt @@ -0,0 +1,22 @@ +Copyright 2012-2015 The Dojo Foundation +Based on Underscore.js 1.7.0, copyright 2009-2015 Jeremy Ashkenas, +DocumentCloud and Investigative Reporters & Editors + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/lodash._basematchesproperty/README.md b/lodash._basematchesproperty/README.md new file mode 100644 index 000000000..6d197c30d --- /dev/null +++ b/lodash._basematchesproperty/README.md @@ -0,0 +1,20 @@ +# lodash._basematchesproperty v3.2.0 + +The [modern build](https://github.com/lodash/lodash/wiki/Build-Differences) of [lodash’s](https://lodash.com/) internal `baseMatchesProperty` exported as a [Node.js](http://nodejs.org/)/[io.js](https://iojs.org/) module. + +## Installation + +Using npm: + +```bash +$ {sudo -H} npm i -g npm +$ npm i --save lodash._basematchesproperty +``` + +In Node.js/io.js: + +```js +var baseMatchesProperty = require('lodash._basematchesproperty'); +``` + +See the [package source](https://github.com/lodash/lodash/blob/3.2.0-npm-packages/lodash._basematchesproperty) for more details. diff --git a/lodash._basematchesproperty/index.js b/lodash._basematchesproperty/index.js new file mode 100644 index 000000000..eaa4a0eb4 --- /dev/null +++ b/lodash._basematchesproperty/index.js @@ -0,0 +1,72 @@ +/** + * lodash 3.2.0 (Custom Build) + * Build: `lodash modern modularize exports="npm" -o ./` + * Copyright 2012-2015 The Dojo Foundation + * Based on Underscore.js 1.7.0 + * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors + * Available under MIT license + */ +var baseIsEqual = require('lodash._baseisequal'); + +/** + * The base implementation of `_.matchesProperty` which does not coerce `key` + * to a string. + * + * @private + * @param {string} key The key of the property to get. + * @param {*} value The value to compare. + * @returns {Function} Returns the new function. + */ +function baseMatchesProperty(key, value) { + if (isStrictComparable(value)) { + return function(object) { + return object != null && object[key] === value; + }; + } + return function(object) { + return object != null && baseIsEqual(value, object[key], null, true); + }; +} + +/** + * Checks if `value` is suitable for strict equality comparisons, i.e. `===`. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` if suitable for strict + * equality comparisons, else `false`. + */ +function isStrictComparable(value) { + return value === value && (value === 0 ? ((1 / value) > 0) : !isObject(value)); +} + +/** + * Checks if `value` is the language type of `Object`. + * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) + * + * **Note:** See the [ES5 spec](https://es5.github.io/#x8) for more details. + * + * @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 type == 'function' || (value && type == 'object') || false; +} + +module.exports = baseMatchesProperty; diff --git a/lodash._basematchesproperty/package.json b/lodash._basematchesproperty/package.json new file mode 100644 index 000000000..e9283eea0 --- /dev/null +++ b/lodash._basematchesproperty/package.json @@ -0,0 +1,21 @@ +{ + "name": "lodash._basematchesproperty", + "version": "3.2.0", + "description": "The modern build of lodash’s internal `baseMatchesProperty` as a module.", + "homepage": "https://lodash.com/", + "icon": "https://lodash.com/icon.svg", + "license": "MIT", + "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/)", + "Mathias Bynens (https://mathiasbynens.be/)" + ], + "repository": "lodash/lodash", + "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, + "dependencies": { + "lodash._baseisequal": "^3.0.0" + } +} diff --git a/lodash._createwrapper/README.md b/lodash._createwrapper/README.md index 3fecca400..207e64550 100644 --- a/lodash._createwrapper/README.md +++ b/lodash._createwrapper/README.md @@ -1,4 +1,4 @@ -# lodash._createwrapper v3.1.1 +# lodash._createwrapper v3.2.0 The internal [lodash](https://lodash.com/) function `createWrapper` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var createWrapper = require('lodash._createwrapper'); ``` -See the [package source](https://github.com/lodash/lodash/blob/3.1.1-npm-packages/lodash._createwrapper) for more details. +See the [package source](https://github.com/lodash/lodash/blob/3.2.0-npm-packages/lodash._createwrapper) for more details. diff --git a/lodash._createwrapper/index.js b/lodash._createwrapper/index.js index 8b3eb1419..47f878e10 100644 --- a/lodash._createwrapper/index.js +++ b/lodash._createwrapper/index.js @@ -1,11 +1,12 @@ /** - * lodash 3.1.1 (Custom Build) + * lodash 3.2.0 (Custom Build) * Build: `lodash modularize exports="npm" -o ./` * Copyright 2012-2016 The Dojo Foundation * Based on Underscore.js 1.8.3 * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors * Available under MIT license */ +var root = require('lodash._root'); /** Used to compose bitmasks for wrapper metadata. */ var BIND_FLAG = 1, @@ -49,41 +50,9 @@ var reIsOctal = /^0o[0-7]+$/i; /** Used to detect unsigned integer values. */ var reIsUint = /^(?:0|[1-9]\d*)$/; -/** Used to determine if values are of the language type `Object`. */ -var objectTypes = { - 'function': true, - 'object': true -}; - /** Built-in method references without a dependency on `root`. */ var freeParseInt = parseInt; -/** 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 free variable `global` from Node.js. */ -var freeGlobal = checkGlobal(freeExports && freeModule && typeof global == 'object' && global); - -/** Detect free variable `self`. */ -var freeSelf = checkGlobal(objectTypes[typeof self] && self); - -/** Detect free variable `window`. */ -var freeWindow = checkGlobal(objectTypes[typeof window] && window); - -/** Detect `this` as the global object. */ -var thisGlobal = checkGlobal(objectTypes[typeof this] && this); - -/** - * Used as a reference to the global object. - * - * The `this` value is used if it's the global object to avoid Greasemonkey's - * restricted `window` object, otherwise the `window` object is used. - */ -var root = freeGlobal || ((freeWindow !== (thisGlobal && thisGlobal.window)) && freeWindow) || freeSelf || thisGlobal || Function('return this')(); - /** * A faster alternative to `Function#apply`, this function invokes `func` * with the `this` binding of `thisArg` and the arguments of `args`. @@ -105,17 +74,6 @@ function apply(func, thisArg, args) { return func.apply(thisArg, args); } -/** - * Checks if `value` is a global object. - * - * @private - * @param {*} value The value to check. - * @returns {null|Object} Returns `value` if it's a global object, else `null`. - */ -function checkGlobal(value) { - return (value && value.Object === Object) ? value : null; -} - /** * Checks if `value` is a valid array-like index. * diff --git a/lodash._createwrapper/package.json b/lodash._createwrapper/package.json index 85e65a939..675c44766 100644 --- a/lodash._createwrapper/package.json +++ b/lodash._createwrapper/package.json @@ -1,6 +1,6 @@ { "name": "lodash._createwrapper", - "version": "3.1.1", + "version": "3.2.0", "description": "The internal lodash function `createWrapper` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -12,5 +12,8 @@ "Mathias Bynens (https://mathiasbynens.be/)" ], "repository": "lodash/lodash", - "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" } + "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, + "dependencies": { + "lodash._root": "^3.0.0" + } } diff --git a/lodash.assign/README.md b/lodash.assign/README.md index 2a89889b1..59a24c0f2 100644 --- a/lodash.assign/README.md +++ b/lodash.assign/README.md @@ -1,4 +1,4 @@ -# lodash.assign v3.1.0 +# lodash.assign v3.2.0 The [modern build](https://github.com/lodash/lodash/wiki/Build-Differences) of [lodash’s](https://lodash.com/) `_.assign` exported as a [Node.js](http://nodejs.org/)/[io.js](https://iojs.org/) module. @@ -17,4 +17,4 @@ In Node.js/io.js: var assign = require('lodash.assign'); ``` -See the [documentation](https://lodash.com/docs#assign) or [package source](https://github.com/lodash/lodash/blob/3.1.0-npm-packages/lodash.assign) for more details. +See the [documentation](https://lodash.com/docs#assign) or [package source](https://github.com/lodash/lodash/blob/3.2.0-npm-packages/lodash.assign) for more details. diff --git a/lodash.assign/index.js b/lodash.assign/index.js index 232996030..837fe627a 100644 --- a/lodash.assign/index.js +++ b/lodash.assign/index.js @@ -1,5 +1,5 @@ /** - * lodash 3.1.0 (Custom Build) + * lodash 3.2.0 (Custom Build) * Build: `lodash modern modularize exports="npm" -o ./` * Copyright 2012-2015 The Dojo Foundation * Based on Underscore.js 1.8.3 @@ -8,16 +8,8 @@ */ var baseAssign = require('lodash._baseassign'), createAssigner = require('lodash._createassigner'), - isNative = require('lodash.isnative'), keys = require('lodash.keys'); -/** Used for native method references. */ -var arrayProto = Array.prototype; - -/** Native method references. */ -var getOwnPropertySymbols = isNative(getOwnPropertySymbols = Object.getOwnPropertySymbols) && getOwnPropertySymbols, - push = arrayProto.push; - /** * A specialized version of `_.assign` for customizing assigned values without * support for argument juggling, multiple sources, and `this` binding `customizer` @@ -30,10 +22,8 @@ var getOwnPropertySymbols = isNative(getOwnPropertySymbols = Object.getOwnProper * @returns {Object} Returns `object`. */ function assignWith(object, source, customizer) { - var props = keys(source); - push.apply(props, getSymbols(source)); - var index = -1, + props = keys(source), length = props.length; while (++index < length) { @@ -49,64 +39,15 @@ function assignWith(object, source, customizer) { return object; } -/** - * Creates an array of the own symbols of `object`. - * - * @private - * @param {Object} object The object to query. - * @returns {Array} Returns the array of symbols. - */ -var getSymbols = !getOwnPropertySymbols ? constant([]) : function(object) { - return getOwnPropertySymbols(toObject(object)); -}; - -/** - * Converts `value` to an object if it is 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 type == 'function' || (!!value && type == 'object'); -} - /** * Assigns own enumerable properties of source object(s) to the destination * object. Subsequent sources overwrite property assignments of previous sources. - * If `customizer` is provided it is invoked to produce the assigned values. + * If `customizer` is provided it's invoked to produce the assigned values. * The `customizer` is bound to `thisArg` and invoked with five arguments: * (objectValue, sourceValue, key, object, source). * * **Note:** This method mutates `object` and is based on - * [`Object.assign`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.assign). + * [`Object.assign`](http://ecma-international.org/ecma-262/6.0/#sec-object.assign). * * @static * @memberOf _ @@ -136,26 +77,4 @@ var assign = createAssigner(function(object, source, customizer) { : baseAssign(object, source); }); -/** - * 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 = assign; diff --git a/lodash.assign/package.json b/lodash.assign/package.json index 563ff01db..aceb708a9 100644 --- a/lodash.assign/package.json +++ b/lodash.assign/package.json @@ -1,6 +1,6 @@ { "name": "lodash.assign", - "version": "3.1.0", + "version": "3.2.0", "description": "The modern build of lodash’s `_.assign` as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -19,7 +19,6 @@ "dependencies": { "lodash._baseassign": "^3.0.0", "lodash._createassigner": "^3.0.0", - "lodash.isnative": "^3.0.0", "lodash.keys": "^3.0.0" } } diff --git a/lodash.at/README.md b/lodash.at/README.md index 585b7f1cc..00968d3d0 100644 --- a/lodash.at/README.md +++ b/lodash.at/README.md @@ -1,4 +1,4 @@ -# lodash.at v3.1.1 +# lodash.at v3.2.0 The [modern build](https://github.com/lodash/lodash/wiki/Build-Differences) of [lodash’s](https://lodash.com/) `_.at` exported as a [Node.js](http://nodejs.org/)/[io.js](https://iojs.org/) module. @@ -17,4 +17,4 @@ In Node.js/io.js: var at = require('lodash.at'); ``` -See the [documentation](https://lodash.com/docs#at) or [package source](https://github.com/lodash/lodash/blob/3.1.1-npm-packages/lodash.at) for more details. +See the [documentation](https://lodash.com/docs#at) or [package source](https://github.com/lodash/lodash/blob/3.2.0-npm-packages/lodash.at) for more details. diff --git a/lodash.at/index.js b/lodash.at/index.js index 5ef099991..48e0ba62c 100644 --- a/lodash.at/index.js +++ b/lodash.at/index.js @@ -1,5 +1,5 @@ /** - * lodash 3.1.1 (Custom Build) + * lodash 3.2.0 (Custom Build) * Build: `lodash modern modularize exports="npm" -o ./` * Copyright 2012-2015 The Dojo Foundation * Based on Underscore.js 1.8.3 @@ -8,53 +8,8 @@ */ var baseAt = require('lodash._baseat'), baseFlatten = require('lodash._baseflatten'), - toIterable = require('lodash._toiterable'), restParam = require('lodash.restparam'); -/** - * 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; - -/** - * 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) - * in Safari on iOS 8.1 ARM64. - * - * @private - * @param {Object} object The object to query. - * @returns {*} Returns the "length" value. - */ -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). - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. - */ -function isLength(value) { - return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; -} - /** * Creates an array of elements corresponding to the given keys, or indexes, * of `collection`. Keys may be specified as individual arguments or as arrays @@ -76,10 +31,6 @@ function isLength(value) { * // => ['barney', 'pebbles'] */ var at = restParam(function(collection, props) { - var length = collection ? getLength(collection) : 0; - if (isLength(length)) { - collection = toIterable(collection); - } return baseAt(collection, baseFlatten(props)); }); diff --git a/lodash.at/package.json b/lodash.at/package.json index 581e87979..5a580d961 100644 --- a/lodash.at/package.json +++ b/lodash.at/package.json @@ -1,6 +1,6 @@ { "name": "lodash.at", - "version": "3.1.1", + "version": "3.2.0", "description": "The modern build of lodash’s `_.at` as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -19,7 +19,6 @@ "dependencies": { "lodash._baseat": "^3.0.0", "lodash._baseflatten": "^3.0.0", - "lodash._toiterable": "^3.0.0", "lodash.restparam": "^3.0.0" } } diff --git a/lodash.attempt/README.md b/lodash.attempt/README.md index cc3ead3c6..0544f5a28 100644 --- a/lodash.attempt/README.md +++ b/lodash.attempt/README.md @@ -1,4 +1,4 @@ -# lodash.attempt v3.1.0 +# lodash.attempt v3.2.0 The [modern build](https://github.com/lodash/lodash/wiki/Build-Differences) of [lodash’s](https://lodash.com/) `_.attempt` exported as a [Node.js](http://nodejs.org/)/[io.js](https://iojs.org/) module. @@ -17,4 +17,4 @@ In Node.js/io.js: var attempt = require('lodash.attempt'); ``` -See the [documentation](https://lodash.com/docs#attempt) or [package source](https://github.com/lodash/lodash/blob/3.1.0-npm-packages/lodash.attempt) for more details. +See the [documentation](https://lodash.com/docs#attempt) or [package source](https://github.com/lodash/lodash/blob/3.2.0-npm-packages/lodash.attempt) for more details. diff --git a/lodash.attempt/index.js b/lodash.attempt/index.js index d96eb2997..d34a285da 100644 --- a/lodash.attempt/index.js +++ b/lodash.attempt/index.js @@ -1,13 +1,12 @@ /** - * lodash 3.1.0 (Custom Build) + * lodash 3.2.0 (Custom Build) * Build: `lodash modern modularize exports="npm" -o ./` * Copyright 2012-2015 The Dojo Foundation * Based on Underscore.js 1.7.0 * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors * Available under MIT license */ -var baseSlice = require('lodash._baseslice'), - isError = require('lodash.iserror'); +var isError = require('lodash.iserror'); /** * Attempts to invoke `func`, returning either the result or the caught error @@ -29,9 +28,16 @@ var baseSlice = require('lodash._baseslice'), * elements = []; * } */ -function attempt(func) { +function attempt() { + var length = arguments.length, + func = arguments[0]; + try { - return func.apply(undefined, baseSlice(arguments, 1)); + var args = Array(length ? length - 1 : 0); + while (--length > 0) { + args[length - 1] = arguments[length]; + } + return func.apply(undefined, args); } catch(e) { return isError(e) ? e : new Error(e); } diff --git a/lodash.attempt/package.json b/lodash.attempt/package.json index 4111abe25..35c656314 100644 --- a/lodash.attempt/package.json +++ b/lodash.attempt/package.json @@ -1,6 +1,6 @@ { "name": "lodash.attempt", - "version": "3.1.0", + "version": "3.2.0", "description": "The modern build of lodash’s `_.attempt` as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -17,7 +17,6 @@ "repository": "lodash/lodash", "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, "dependencies": { - "lodash._baseslice": "^3.0.0", "lodash.iserror": "^3.0.0" } } diff --git a/lodash.callback/README.md b/lodash.callback/README.md index e2817e75f..ea4ec81e2 100644 --- a/lodash.callback/README.md +++ b/lodash.callback/README.md @@ -1,4 +1,4 @@ -# lodash.callback v3.1.1 +# lodash.callback v3.2.0 The [modern build](https://github.com/lodash/lodash/wiki/Build-Differences) of [lodash’s](https://lodash.com/) `_.callback` exported as a [Node.js](http://nodejs.org/)/[io.js](https://iojs.org/) module. @@ -17,4 +17,4 @@ In Node.js/io.js: var callback = require('lodash.callback'); ``` -See the [documentation](https://lodash.com/docs#callback) or [package source](https://github.com/lodash/lodash/blob/3.1.1-npm-packages/lodash.callback) for more details. +See the [documentation](https://lodash.com/docs#callback) or [package source](https://github.com/lodash/lodash/blob/3.2.0-npm-packages/lodash.callback) for more details. diff --git a/lodash.callback/index.js b/lodash.callback/index.js index 25693cc89..7e6ceb04e 100644 --- a/lodash.callback/index.js +++ b/lodash.callback/index.js @@ -1,27 +1,14 @@ /** - * lodash 3.1.1 (Custom Build) + * lodash 3.2.0 (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 */ var baseCallback = require('lodash._basecallback'), - baseClone = require('lodash._baseclone'), - baseMatches = require('lodash._basematches'), isIterateeCall = require('lodash._isiterateecall'); -/** - * Checks if `value` is object-like. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is object-like, else `false`. - */ -function isObjectLike(value) { - return !!value && typeof value == 'object'; -} - /** * Creates a function that invokes `func` with the `this` binding of `thisArg` * and arguments of the created function. If `func` is a property name the @@ -64,38 +51,7 @@ function callback(func, thisArg, guard) { if (guard && isIterateeCall(func, thisArg, guard)) { thisArg = null; } - return isObjectLike(func) - ? matches(func) - : baseCallback(func, thisArg); -} - -/** - * Creates a function which performs a deep comparison between a given object - * and `source`, returning `true` if the given object has equivalent property - * values, else `false`. - * - * **Note:** This method supports comparing arrays, booleans, `Date` objects, - * numbers, `Object` objects, regexes, and strings. Objects are compared by - * their own, not inherited, enumerable properties. For comparing a single - * own or inherited property value see `_.matchesProperty`. - * - * @static - * @memberOf _ - * @category Utility - * @param {Object} source The object of property values to match. - * @returns {Function} Returns the new function. - * @example - * - * var users = [ - * { 'user': 'barney', 'age': 36, 'active': true }, - * { 'user': 'fred', 'age': 40, 'active': false } - * ]; - * - * _.filter(users, _.matches({ 'age': 40, 'active': false })); - * // => [{ 'user': 'fred', 'age': 40, 'active': false }] - */ -function matches(source) { - return baseMatches(baseClone(source, true)); + return baseCallback(func, thisArg); } module.exports = callback; diff --git a/lodash.callback/package.json b/lodash.callback/package.json index 8eef2944a..158869487 100644 --- a/lodash.callback/package.json +++ b/lodash.callback/package.json @@ -1,6 +1,6 @@ { "name": "lodash.callback", - "version": "3.1.1", + "version": "3.2.0", "description": "The modern build of lodash’s `_.callback` as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -18,8 +18,6 @@ "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, "dependencies": { "lodash._basecallback": "^3.0.0", - "lodash._baseclone": "^3.0.0", - "lodash._basematches": "^3.0.0", "lodash._isiterateecall": "^3.0.0" } } diff --git a/lodash.deburr/README.md b/lodash.deburr/README.md index 2467bccbc..5c534a3f0 100644 --- a/lodash.deburr/README.md +++ b/lodash.deburr/README.md @@ -1,4 +1,4 @@ -# lodash.deburr v3.1.2 +# lodash.deburr v3.2.0 The [lodash](https://lodash.com/) method `_.deburr` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var deburr = require('lodash.deburr'); ``` -See the [documentation](https://lodash.com/docs#deburr) or [package source](https://github.com/lodash/lodash/blob/3.1.2-npm-packages/lodash.deburr) for more details. +See the [documentation](https://lodash.com/docs#deburr) or [package source](https://github.com/lodash/lodash/blob/3.2.0-npm-packages/lodash.deburr) for more details. diff --git a/lodash.deburr/index.js b/lodash.deburr/index.js index ecb49e997..48c6ed536 100644 --- a/lodash.deburr/index.js +++ b/lodash.deburr/index.js @@ -1,11 +1,12 @@ /** - * lodash 3.1.2 (Custom Build) + * lodash 3.2.0 (Custom Build) * Build: `lodash modularize exports="npm" -o ./` * Copyright 2012-2016 The Dojo Foundation * Based on Underscore.js 1.8.3 * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors * Available under MIT license */ +var root = require('lodash._root'); /** Used as references for various `Number` constants. */ var INFINITY = 1 / 0; @@ -50,49 +51,6 @@ var deburredLetters = { '\xdf': 'ss' }; -/** 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 free variable `global` from Node.js. */ -var freeGlobal = checkGlobal(freeExports && freeModule && typeof global == 'object' && global); - -/** Detect free variable `self`. */ -var freeSelf = checkGlobal(objectTypes[typeof self] && self); - -/** Detect free variable `window`. */ -var freeWindow = checkGlobal(objectTypes[typeof window] && window); - -/** Detect `this` as the global object. */ -var thisGlobal = checkGlobal(objectTypes[typeof this] && this); - -/** - * Used as a reference to the global object. - * - * The `this` value is used if it's the global object to avoid Greasemonkey's - * restricted `window` object, otherwise the `window` object is used. - */ -var root = freeGlobal || ((freeWindow !== (thisGlobal && thisGlobal.window)) && freeWindow) || freeSelf || thisGlobal || Function('return this')(); - -/** - * Checks if `value` is a global object. - * - * @private - * @param {*} value The value to check. - * @returns {null|Object} Returns `value` if it's a global object, else `null`. - */ -function checkGlobal(value) { - return (value && value.Object === Object) ? value : null; -} - /** * Used by `_.deburr` to convert latin-1 supplementary letters to basic latin letters. * diff --git a/lodash.deburr/package.json b/lodash.deburr/package.json index 1f321f2ad..cd4d9790a 100644 --- a/lodash.deburr/package.json +++ b/lodash.deburr/package.json @@ -1,6 +1,6 @@ { "name": "lodash.deburr", - "version": "3.1.2", + "version": "3.2.0", "description": "The lodash method `_.deburr` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -13,5 +13,8 @@ "Mathias Bynens (https://mathiasbynens.be/)" ], "repository": "lodash/lodash", - "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" } + "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, + "dependencies": { + "lodash._root": "^3.0.0" + } } diff --git a/lodash.difference/README.md b/lodash.difference/README.md index 71af40fc0..8e1288319 100644 --- a/lodash.difference/README.md +++ b/lodash.difference/README.md @@ -1,4 +1,4 @@ -# lodash.difference v3.1.0 +# lodash.difference v3.2.0 The [modern build](https://github.com/lodash/lodash/wiki/Build-Differences) of [lodash’s](https://lodash.com/) `_.difference` exported as a [Node.js](http://nodejs.org/)/[io.js](https://iojs.org/) module. @@ -17,4 +17,4 @@ In Node.js/io.js: var difference = require('lodash.difference'); ``` -See the [documentation](https://lodash.com/docs#difference) or [package source](https://github.com/lodash/lodash/blob/3.1.0-npm-packages/lodash.difference) for more details. +See the [documentation](https://lodash.com/docs#difference) or [package source](https://github.com/lodash/lodash/blob/3.2.0-npm-packages/lodash.difference) for more details. diff --git a/lodash.difference/index.js b/lodash.difference/index.js index 3ff7fdd70..8e8928e4c 100644 --- a/lodash.difference/index.js +++ b/lodash.difference/index.js @@ -1,24 +1,74 @@ /** - * lodash 3.1.0 (Custom Build) + * lodash 3.2.0 (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 */ var baseDifference = require('lodash._basedifference'), baseFlatten = require('lodash._baseflatten'), - isArguments = require('lodash.isarguments'), - isArray = require('lodash.isarray'), restParam = require('lodash.restparam'); /** - * Creates an array excluding all values of the provided arrays using - * `SameValueZero` for equality comparisons. + * 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; + +/** + * The base implementation of `_.property` without support for deep paths. * - * **Note:** [`SameValueZero`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) - * comparisons are like strict equality comparisons, e.g. `===`, except that - * `NaN` matches `NaN`. + * @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. + * + * **Note:** This function is based on [`ToLength`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tolength). + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. + */ +function isLength(value) { + return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; +} + +/** + * Creates an array excluding all values of the provided arrays using + * [`SameValueZero`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) + * for equality comparisons. * * @static * @memberOf _ @@ -32,7 +82,7 @@ var baseDifference = require('lodash._basedifference'), * // => [1, 3] */ var difference = restParam(function(array, values) { - return (isArray(array) || isArguments(array)) + return isArrayLike(array) ? baseDifference(array, baseFlatten(values, false, true)) : []; }); diff --git a/lodash.difference/package.json b/lodash.difference/package.json index b6995bd47..95adc14f5 100644 --- a/lodash.difference/package.json +++ b/lodash.difference/package.json @@ -1,6 +1,6 @@ { "name": "lodash.difference", - "version": "3.1.0", + "version": "3.2.0", "description": "The modern build of lodash’s `_.difference` as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -19,8 +19,6 @@ "dependencies": { "lodash._basedifference": "^3.0.0", "lodash._baseflatten": "^3.0.0", - "lodash.isarguments": "^3.0.0", - "lodash.isarray": "^3.0.0", "lodash.restparam": "^3.0.0" } } diff --git a/lodash.endswith/README.md b/lodash.endswith/README.md index a14540420..60fb945d0 100644 --- a/lodash.endswith/README.md +++ b/lodash.endswith/README.md @@ -1,4 +1,4 @@ -# lodash.endswith v3.1.2 +# lodash.endswith v3.2.0 The [lodash](https://lodash.com/) method `_.endsWith` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var endsWith = require('lodash.endswith'); ``` -See the [documentation](https://lodash.com/docs#endsWith) or [package source](https://github.com/lodash/lodash/blob/3.1.2-npm-packages/lodash.endswith) for more details. +See the [documentation](https://lodash.com/docs#endsWith) or [package source](https://github.com/lodash/lodash/blob/3.2.0-npm-packages/lodash.endswith) for more details. diff --git a/lodash.endswith/index.js b/lodash.endswith/index.js index c799ee129..af6078b9b 100644 --- a/lodash.endswith/index.js +++ b/lodash.endswith/index.js @@ -1,11 +1,12 @@ /** - * lodash 3.1.2 (Custom Build) + * lodash 3.2.0 (Custom Build) * Build: `lodash modularize exports="npm" -o ./` * Copyright 2012-2016 The Dojo Foundation * Based on Underscore.js 1.8.3 * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors * Available under MIT license */ +var root = require('lodash._root'); /** Used as references for various `Number` constants. */ var INFINITY = 1 / 0, @@ -29,52 +30,9 @@ var reIsBinary = /^0b[01]+$/i; /** Used to detect octal string values. */ var reIsOctal = /^0o[0-7]+$/i; -/** Used to determine if values are of the language type `Object`. */ -var objectTypes = { - 'function': true, - 'object': true -}; - /** Built-in method references without a dependency on `root`. */ var freeParseInt = parseInt; -/** 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 free variable `global` from Node.js. */ -var freeGlobal = checkGlobal(freeExports && freeModule && typeof global == 'object' && global); - -/** Detect free variable `self`. */ -var freeSelf = checkGlobal(objectTypes[typeof self] && self); - -/** Detect free variable `window`. */ -var freeWindow = checkGlobal(objectTypes[typeof window] && window); - -/** Detect `this` as the global object. */ -var thisGlobal = checkGlobal(objectTypes[typeof this] && this); - -/** - * Used as a reference to the global object. - * - * The `this` value is used if it's the global object to avoid Greasemonkey's - * restricted `window` object, otherwise the `window` object is used. - */ -var root = freeGlobal || ((freeWindow !== (thisGlobal && thisGlobal.window)) && freeWindow) || freeSelf || thisGlobal || Function('return this')(); - -/** - * Checks if `value` is a global object. - * - * @private - * @param {*} value The value to check. - * @returns {null|Object} Returns `value` if it's a global object, else `null`. - */ -function checkGlobal(value) { - return (value && value.Object === Object) ? value : null; -} - /** Used for built-in method references. */ var objectProto = Object.prototype; diff --git a/lodash.endswith/package.json b/lodash.endswith/package.json index 163cf677d..284a0f778 100644 --- a/lodash.endswith/package.json +++ b/lodash.endswith/package.json @@ -1,6 +1,6 @@ { "name": "lodash.endswith", - "version": "3.1.2", + "version": "3.2.0", "description": "The lodash method `_.endsWith` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -13,5 +13,8 @@ "Mathias Bynens (https://mathiasbynens.be/)" ], "repository": "lodash/lodash", - "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" } + "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, + "dependencies": { + "lodash._root": "^3.0.0" + } } diff --git a/lodash.escape/README.md b/lodash.escape/README.md index 698b9e2dc..b012def33 100644 --- a/lodash.escape/README.md +++ b/lodash.escape/README.md @@ -1,4 +1,4 @@ -# lodash.escape v3.1.2 +# lodash.escape v3.2.0 The [lodash](https://lodash.com/) method `_.escape` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var escape = require('lodash.escape'); ``` -See the [documentation](https://lodash.com/docs#escape) or [package source](https://github.com/lodash/lodash/blob/3.1.2-npm-packages/lodash.escape) for more details. +See the [documentation](https://lodash.com/docs#escape) or [package source](https://github.com/lodash/lodash/blob/3.2.0-npm-packages/lodash.escape) for more details. diff --git a/lodash.escape/index.js b/lodash.escape/index.js index a4cfddc33..0971ae8e2 100644 --- a/lodash.escape/index.js +++ b/lodash.escape/index.js @@ -1,11 +1,12 @@ /** - * lodash 3.1.2 (Custom Build) + * lodash 3.2.0 (Custom Build) * Build: `lodash modularize exports="npm" -o ./` * Copyright 2012-2016 The Dojo Foundation * Based on Underscore.js 1.8.3 * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors * Available under MIT license */ +var root = require('lodash._root'); /** Used as references for various `Number` constants. */ var INFINITY = 1 / 0; @@ -27,49 +28,6 @@ var htmlEscapes = { '`': '`' }; -/** 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 free variable `global` from Node.js. */ -var freeGlobal = checkGlobal(freeExports && freeModule && typeof global == 'object' && global); - -/** Detect free variable `self`. */ -var freeSelf = checkGlobal(objectTypes[typeof self] && self); - -/** Detect free variable `window`. */ -var freeWindow = checkGlobal(objectTypes[typeof window] && window); - -/** Detect `this` as the global object. */ -var thisGlobal = checkGlobal(objectTypes[typeof this] && this); - -/** - * Used as a reference to the global object. - * - * The `this` value is used if it's the global object to avoid Greasemonkey's - * restricted `window` object, otherwise the `window` object is used. - */ -var root = freeGlobal || ((freeWindow !== (thisGlobal && thisGlobal.window)) && freeWindow) || freeSelf || thisGlobal || Function('return this')(); - -/** - * Checks if `value` is a global object. - * - * @private - * @param {*} value The value to check. - * @returns {null|Object} Returns `value` if it's a global object, else `null`. - */ -function checkGlobal(value) { - return (value && value.Object === Object) ? value : null; -} - /** * Used by `_.escape` to convert characters to HTML entities. * diff --git a/lodash.escape/package.json b/lodash.escape/package.json index 22972670c..fc19009cf 100644 --- a/lodash.escape/package.json +++ b/lodash.escape/package.json @@ -1,6 +1,6 @@ { "name": "lodash.escape", - "version": "3.1.2", + "version": "3.2.0", "description": "The lodash method `_.escape` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -13,5 +13,8 @@ "Mathias Bynens (https://mathiasbynens.be/)" ], "repository": "lodash/lodash", - "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" } + "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, + "dependencies": { + "lodash._root": "^3.0.0" + } } diff --git a/lodash.every/README.md b/lodash.every/README.md index d1bc560b3..74423b886 100644 --- a/lodash.every/README.md +++ b/lodash.every/README.md @@ -1,4 +1,4 @@ -# lodash.every v3.1.0 +# lodash.every v3.2.0 The [modern build](https://github.com/lodash/lodash/wiki/Build-Differences) of [lodash’s](https://lodash.com/) `_.every` exported as a [Node.js](http://nodejs.org/)/[io.js](https://iojs.org/) module. @@ -17,4 +17,4 @@ In Node.js/io.js: var every = require('lodash.every'); ``` -See the [documentation](https://lodash.com/docs#every) or [package source](https://github.com/lodash/lodash/blob/3.1.0-npm-packages/lodash.every) for more details. +See the [documentation](https://lodash.com/docs#every) or [package source](https://github.com/lodash/lodash/blob/3.2.0-npm-packages/lodash.every) for more details. diff --git a/lodash.every/index.js b/lodash.every/index.js index 65319bab7..058b2f341 100644 --- a/lodash.every/index.js +++ b/lodash.every/index.js @@ -1,5 +1,5 @@ /** - * lodash 3.1.0 (Custom Build) + * lodash 3.2.0 (Custom Build) * Build: `lodash modern modularize exports="npm" -o ./` * Copyright 2012-2015 The Dojo Foundation * Based on Underscore.js 1.8.2 @@ -10,7 +10,8 @@ var arrayEvery = require('lodash._arrayevery'), baseCallback = require('lodash._basecallback'), baseEach = require('lodash._baseeach'), isIterateeCall = require('lodash._isiterateecall'), - isArray = require('lodash.isarray'); + isArray = require('lodash.isarray'), + keys = require('lodash.keys'); /** * The base implementation of `_.every` without support for callback diff --git a/lodash.every/package.json b/lodash.every/package.json index d11bac83f..629cfa043 100644 --- a/lodash.every/package.json +++ b/lodash.every/package.json @@ -1,6 +1,6 @@ { "name": "lodash.every", - "version": "3.1.0", + "version": "3.2.0", "description": "The modern build of lodash’s `_.every` as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -21,6 +21,7 @@ "lodash._basecallback": "^3.0.0", "lodash._baseeach": "^3.0.0", "lodash._isiterateecall": "^3.0.0", - "lodash.isarray": "^3.0.0" + "lodash.isarray": "^3.0.0", + "lodash.keys": "^3.0.0" } } diff --git a/lodash.fill/LICENSE.txt b/lodash.fill/LICENSE.txt new file mode 100644 index 000000000..17764328c --- /dev/null +++ b/lodash.fill/LICENSE.txt @@ -0,0 +1,22 @@ +Copyright 2012-2015 The Dojo Foundation +Based on Underscore.js 1.7.0, copyright 2009-2015 Jeremy Ashkenas, +DocumentCloud and Investigative Reporters & Editors + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/lodash.fill/README.md b/lodash.fill/README.md new file mode 100644 index 000000000..55fce3a57 --- /dev/null +++ b/lodash.fill/README.md @@ -0,0 +1,20 @@ +# lodash.fill v3.2.0 + +The [modern build](https://github.com/lodash/lodash/wiki/Build-Differences) of [lodash’s](https://lodash.com/) `_.fill` exported as a [Node.js](http://nodejs.org/)/[io.js](https://iojs.org/) module. + +## Installation + +Using npm: + +```bash +$ {sudo -H} npm i -g npm +$ npm i --save lodash.fill +``` + +In Node.js/io.js: + +```js +var fill = require('lodash.fill'); +``` + +See the [documentation](https://lodash.com/docs#fill) or [package source](https://github.com/lodash/lodash/blob/3.2.0-npm-packages/lodash.fill) for more details. diff --git a/lodash.fill/index.js b/lodash.fill/index.js new file mode 100644 index 000000000..99fb617e9 --- /dev/null +++ b/lodash.fill/index.js @@ -0,0 +1,68 @@ +/** + * lodash 3.2.0 (Custom Build) + * Build: `lodash modern modularize exports="npm" -o ./` + * Copyright 2012-2015 The Dojo Foundation + * Based on Underscore.js 1.7.0 + * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors + * Available under MIT license + */ +var isIterateeCall = require('lodash._isiterateecall'); + +/** + * The base implementation of `_.fill` without an iteratee call guard. + * + * @private + * @param {Array} array The array to fill. + * @param {*} value The value to fill `array` with. + * @param {number} [start=0] The start position. + * @param {number} [end=array.length] The end position. + * @returns {Array} Returns `array`. + */ +function baseFill(array, value, start, end) { + var length = array.length; + + start = start == null ? 0 : (+start || 0); + if (start < 0) { + start = -start > length ? 0 : (length + start); + } + end = (typeof end == 'undefined' || end > length) ? length : (+end || 0); + if (end < 0) { + end += length; + } + length = start > end ? 0 : end >>> 0; + start >>>= 0; + + while (start < length) { + array[start++] = value; + } + return array; +} + +/** + * Fills elements of `array` with `value` from `start` up to, but not + * including, `end`. + * + * **Note:** This method mutates `array`. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array to fill. + * @param {*} value The value to fill `array` with. + * @param {number} [start=0] The start position. + * @param {number} [end=array.length] The end position. + * @returns {Array} Returns `array`. + */ +function fill(array, value, start, end) { + var length = array ? array.length : 0; + if (!length) { + return []; + } + if (start && typeof start != 'number' && isIterateeCall(array, value, start)) { + start = 0; + end = length; + } + return baseFill(array, value, start, end); +} + +module.exports = fill; diff --git a/lodash.fill/package.json b/lodash.fill/package.json new file mode 100644 index 000000000..dc5c2d15e --- /dev/null +++ b/lodash.fill/package.json @@ -0,0 +1,22 @@ +{ + "name": "lodash.fill", + "version": "3.2.0", + "description": "The modern build of lodash’s `_.fill` 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/)", + "Mathias Bynens (https://mathiasbynens.be/)" + ], + "repository": "lodash/lodash", + "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, + "dependencies": { + "lodash._isiterateecall": "^3.0.0" + } +} diff --git a/lodash.find/README.md b/lodash.find/README.md index 05f898af4..9ed24bcf9 100644 --- a/lodash.find/README.md +++ b/lodash.find/README.md @@ -1,4 +1,4 @@ -# lodash.find v3.1.0 +# lodash.find v3.2.0 The [modern build](https://github.com/lodash/lodash/wiki/Build-Differences) of [lodash’s](https://lodash.com/) `_.find` exported as a [Node.js](http://nodejs.org/)/[io.js](https://iojs.org/) module. @@ -17,4 +17,4 @@ In Node.js/io.js: var find = require('lodash.find'); ``` -See the [documentation](https://lodash.com/docs#find) or [package source](https://github.com/lodash/lodash/blob/3.1.0-npm-packages/lodash.find) for more details. +See the [documentation](https://lodash.com/docs#find) or [package source](https://github.com/lodash/lodash/blob/3.2.0-npm-packages/lodash.find) for more details. diff --git a/lodash.find/index.js b/lodash.find/index.js index 6768f93a4..9dfdcc472 100644 --- a/lodash.find/index.js +++ b/lodash.find/index.js @@ -1,8 +1,8 @@ /** - * lodash 3.1.0 (Custom Build) + * lodash 3.2.0 (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 */ @@ -10,7 +10,8 @@ var baseCallback = require('lodash._basecallback'), baseEach = require('lodash._baseeach'), baseFind = require('lodash._basefind'), baseFindIndex = require('lodash._basefindindex'), - isArray = require('lodash.isarray'); + isArray = require('lodash.isarray'), + keys = require('lodash.keys'); /** * Creates a `_.find` or `_.findLast` function. @@ -28,7 +29,7 @@ function createFind(eachFunc, fromRight) { return index > -1 ? collection[index] : undefined; } return baseFind(collection, predicate, eachFunc); - } + }; } /** diff --git a/lodash.find/package.json b/lodash.find/package.json index 579ea14e7..fb2dac9bb 100644 --- a/lodash.find/package.json +++ b/lodash.find/package.json @@ -1,6 +1,6 @@ { "name": "lodash.find", - "version": "3.1.0", + "version": "3.2.0", "description": "The modern build of lodash’s `_.find` as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -21,6 +21,7 @@ "lodash._baseeach": "^3.0.0", "lodash._basefind": "^3.0.0", "lodash._basefindindex": "^3.0.0", - "lodash.isarray": "^3.0.0" + "lodash.isarray": "^3.0.0", + "lodash.keys": "^3.0.0" } } diff --git a/lodash.findindex/README.md b/lodash.findindex/README.md index 3ec1fd250..26399bd92 100644 --- a/lodash.findindex/README.md +++ b/lodash.findindex/README.md @@ -1,4 +1,4 @@ -# lodash.findindex v3.1.0 +# lodash.findindex v3.2.0 The [modern build](https://github.com/lodash/lodash/wiki/Build-Differences) of [lodash’s](https://lodash.com/) `_.findIndex` exported as a [Node.js](http://nodejs.org/)/[io.js](https://iojs.org/) module. @@ -17,4 +17,4 @@ In Node.js/io.js: var findIndex = require('lodash.findindex'); ``` -See the [documentation](https://lodash.com/docs#findIndex) or [package source](https://github.com/lodash/lodash/blob/3.1.0-npm-packages/lodash.findindex) for more details. +See the [documentation](https://lodash.com/docs#findIndex) or [package source](https://github.com/lodash/lodash/blob/3.2.0-npm-packages/lodash.findindex) for more details. diff --git a/lodash.findindex/index.js b/lodash.findindex/index.js index e9669fd52..c1f5ba0e8 100644 --- a/lodash.findindex/index.js +++ b/lodash.findindex/index.js @@ -1,5 +1,5 @@ /** - * lodash 3.1.0 (Custom Build) + * lodash 3.2.0 (Custom Build) * Build: `lodash modern modularize exports="npm" -o ./` * Copyright 2012-2015 The Dojo Foundation * Based on Underscore.js 1.8.2 @@ -7,7 +7,8 @@ * Available under MIT license */ var baseCallback = require('lodash._basecallback'), - baseFindIndex = require('lodash._basefindindex'); + baseFindIndex = require('lodash._basefindindex'), + isArray = require('lodash.isarray'); /** * Creates a `_.findIndex` or `_.findLastIndex` function. diff --git a/lodash.findindex/package.json b/lodash.findindex/package.json index c8df1cf89..65c42b70b 100644 --- a/lodash.findindex/package.json +++ b/lodash.findindex/package.json @@ -1,6 +1,6 @@ { "name": "lodash.findindex", - "version": "3.1.0", + "version": "3.2.0", "description": "The modern build of lodash’s `_.findIndex` as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -18,6 +18,7 @@ "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, "dependencies": { "lodash._basecallback": "^3.0.0", - "lodash._basefindindex": "^3.0.0" + "lodash._basefindindex": "^3.0.0", + "lodash.isarray": "^3.0.0" } } diff --git a/lodash.findlast/README.md b/lodash.findlast/README.md index 487639f00..5aba08e3f 100644 --- a/lodash.findlast/README.md +++ b/lodash.findlast/README.md @@ -1,4 +1,4 @@ -# lodash.findlast v3.1.0 +# lodash.findlast v3.2.0 The [modern build](https://github.com/lodash/lodash/wiki/Build-Differences) of [lodash’s](https://lodash.com/) `_.findLast` exported as a [Node.js](http://nodejs.org/)/[io.js](https://iojs.org/) module. @@ -17,4 +17,4 @@ In Node.js/io.js: var findLast = require('lodash.findlast'); ``` -See the [documentation](https://lodash.com/docs#findLast) or [package source](https://github.com/lodash/lodash/blob/3.1.0-npm-packages/lodash.findlast) for more details. +See the [documentation](https://lodash.com/docs#findLast) or [package source](https://github.com/lodash/lodash/blob/3.2.0-npm-packages/lodash.findlast) for more details. diff --git a/lodash.findlast/index.js b/lodash.findlast/index.js index 2cfdf0f5e..1fb469ecd 100644 --- a/lodash.findlast/index.js +++ b/lodash.findlast/index.js @@ -1,8 +1,8 @@ /** - * lodash 3.1.0 (Custom Build) + * lodash 3.2.0 (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 */ @@ -10,7 +10,8 @@ var baseCallback = require('lodash._basecallback'), baseEachRight = require('lodash._baseeachright'), baseFind = require('lodash._basefind'), baseFindIndex = require('lodash._basefindindex'), - isArray = require('lodash.isarray'); + isArray = require('lodash.isarray'), + keys = require('lodash.keys'); /** * Creates a `_.find` or `_.findLast` function. @@ -28,7 +29,7 @@ function createFind(eachFunc, fromRight) { return index > -1 ? collection[index] : undefined; } return baseFind(collection, predicate, eachFunc); - } + }; } /** diff --git a/lodash.findlast/package.json b/lodash.findlast/package.json index 3bb30b3c8..0ba892252 100644 --- a/lodash.findlast/package.json +++ b/lodash.findlast/package.json @@ -1,6 +1,6 @@ { "name": "lodash.findlast", - "version": "3.1.0", + "version": "3.2.0", "description": "The modern build of lodash’s `_.findLast` as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -21,6 +21,7 @@ "lodash._baseeachright": "^3.0.0", "lodash._basefind": "^3.0.0", "lodash._basefindindex": "^3.0.0", - "lodash.isarray": "^3.0.0" + "lodash.isarray": "^3.0.0", + "lodash.keys": "^3.0.0" } } diff --git a/lodash.findlastindex/README.md b/lodash.findlastindex/README.md index 471c0adec..f8781b4c5 100644 --- a/lodash.findlastindex/README.md +++ b/lodash.findlastindex/README.md @@ -1,4 +1,4 @@ -# lodash.findlastindex v3.1.0 +# lodash.findlastindex v3.2.0 The [modern build](https://github.com/lodash/lodash/wiki/Build-Differences) of [lodash’s](https://lodash.com/) `_.findLastIndex` exported as a [Node.js](http://nodejs.org/)/[io.js](https://iojs.org/) module. @@ -17,4 +17,4 @@ In Node.js/io.js: var findLastIndex = require('lodash.findlastindex'); ``` -See the [documentation](https://lodash.com/docs#findLastIndex) or [package source](https://github.com/lodash/lodash/blob/3.1.0-npm-packages/lodash.findlastindex) for more details. +See the [documentation](https://lodash.com/docs#findLastIndex) or [package source](https://github.com/lodash/lodash/blob/3.2.0-npm-packages/lodash.findlastindex) for more details. diff --git a/lodash.findlastindex/index.js b/lodash.findlastindex/index.js index b3ac91088..57200382f 100644 --- a/lodash.findlastindex/index.js +++ b/lodash.findlastindex/index.js @@ -1,5 +1,5 @@ /** - * lodash 3.1.0 (Custom Build) + * lodash 3.2.0 (Custom Build) * Build: `lodash modern modularize exports="npm" -o ./` * Copyright 2012-2015 The Dojo Foundation * Based on Underscore.js 1.8.2 @@ -7,7 +7,8 @@ * Available under MIT license */ var baseCallback = require('lodash._basecallback'), - baseFindIndex = require('lodash._basefindindex'); + baseFindIndex = require('lodash._basefindindex'), + isArray = require('lodash.isarray'); /** * Creates a `_.findIndex` or `_.findLastIndex` function. diff --git a/lodash.findlastindex/package.json b/lodash.findlastindex/package.json index 0083bcd71..eb29b470e 100644 --- a/lodash.findlastindex/package.json +++ b/lodash.findlastindex/package.json @@ -1,6 +1,6 @@ { "name": "lodash.findlastindex", - "version": "3.1.0", + "version": "3.2.0", "description": "The modern build of lodash’s `_.findLastIndex` as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -18,6 +18,7 @@ "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, "dependencies": { "lodash._basecallback": "^3.0.0", - "lodash._basefindindex": "^3.0.0" + "lodash._basefindindex": "^3.0.0", + "lodash.isarray": "^3.0.0" } } diff --git a/lodash.flow/LICENSE.txt b/lodash.flow/LICENSE.txt index 17764328c..9cd87e5dc 100644 --- a/lodash.flow/LICENSE.txt +++ b/lodash.flow/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.flow/README.md b/lodash.flow/README.md index 0643da91b..223e6a39e 100644 --- a/lodash.flow/README.md +++ b/lodash.flow/README.md @@ -1,4 +1,4 @@ -# lodash.flow v3.1.0 +# lodash.flow v3.2.0 The [modern build](https://github.com/lodash/lodash/wiki/Build-Differences) of [lodash’s](https://lodash.com/) `_.flow` exported as a [Node.js](http://nodejs.org/)/[io.js](https://iojs.org/) module. @@ -17,4 +17,4 @@ In Node.js/io.js: var flow = require('lodash.flow'); ``` -See the [documentation](https://lodash.com/docs#flow) or [package source](https://github.com/lodash/lodash/blob/3.1.0-npm-packages/lodash.flow) for more details. +See the [documentation](https://lodash.com/docs#flow) or [package source](https://github.com/lodash/lodash/blob/3.2.0-npm-packages/lodash.flow) for more details. diff --git a/lodash.flow/index.js b/lodash.flow/index.js index 95348308e..8cd5374e1 100644 --- a/lodash.flow/index.js +++ b/lodash.flow/index.js @@ -1,12 +1,49 @@ /** - * lodash 3.1.0 (Custom Build) + * lodash 3.2.0 (Custom Build) * Build: `lodash modern modularize exports="npm" -o ./` * Copyright 2012-2015 The Dojo Foundation * Based on Underscore.js 1.8.2 * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors * Available under MIT license */ -var createComposer = require('lodash._createcomposer'); + +/** Used as the `TypeError` message for "Functions" methods. */ +var FUNC_ERROR_TEXT = 'Expected a function'; + +/** + * Creates a `_.flow` or `_.flowRight` function. + * + * @private + * @param {boolean} [fromRight] Specify iterating from right to left. + * @returns {Function} Returns the new flow function. + */ +function createFlow(fromRight) { + return function() { + var length = arguments.length; + if (!length) { + return function() { return arguments[0]; }; + } + var index = fromRight ? length : -1, + leftIndex = 0, + funcs = Array(length); + + while ((fromRight ? index-- : ++index < length)) { + var func = funcs[leftIndex++] = arguments[index]; + if (typeof func != 'function') { + throw new TypeError(FUNC_ERROR_TEXT); + } + } + return function() { + var index = 0, + result = funcs[index].apply(this, arguments); + + while (++index < length) { + result = funcs[index].call(this, result); + } + return result; + }; + }; +} /** * Creates a function that returns the result of invoking the provided @@ -28,6 +65,6 @@ var createComposer = require('lodash._createcomposer'); * addSquare(1, 2); * // => 9 */ -var flow = createComposer(); +var flow = createFlow(); module.exports = flow; diff --git a/lodash.flow/package.json b/lodash.flow/package.json index db1bbd8a1..470ff3eb8 100644 --- a/lodash.flow/package.json +++ b/lodash.flow/package.json @@ -1,6 +1,6 @@ { "name": "lodash.flow", - "version": "3.1.0", + "version": "3.2.0", "description": "The modern build of lodash’s `_.flow` as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -15,8 +15,5 @@ "Mathias Bynens (https://mathiasbynens.be/)" ], "repository": "lodash/lodash", - "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, - "dependencies": { - "lodash._createcomposer": "^3.0.0" - } + "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" } } diff --git a/lodash.flowright/LICENSE.txt b/lodash.flowright/LICENSE.txt index 17764328c..9cd87e5dc 100644 --- a/lodash.flowright/LICENSE.txt +++ b/lodash.flowright/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.flowright/README.md b/lodash.flowright/README.md index b34ae4e24..c38e89462 100644 --- a/lodash.flowright/README.md +++ b/lodash.flowright/README.md @@ -1,4 +1,4 @@ -# lodash.flowright v3.1.0 +# lodash.flowright v3.2.0 The [modern build](https://github.com/lodash/lodash/wiki/Build-Differences) of [lodash’s](https://lodash.com/) `_.flowRight` exported as a [Node.js](http://nodejs.org/)/[io.js](https://iojs.org/) module. @@ -17,4 +17,4 @@ In Node.js/io.js: var flowRight = require('lodash.flowright'); ``` -See the [documentation](https://lodash.com/docs#flowRight) or [package source](https://github.com/lodash/lodash/blob/3.1.0-npm-packages/lodash.flowright) for more details. +See the [documentation](https://lodash.com/docs#flowRight) or [package source](https://github.com/lodash/lodash/blob/3.2.0-npm-packages/lodash.flowright) for more details. diff --git a/lodash.flowright/index.js b/lodash.flowright/index.js index c6da631a9..62c9ff8b6 100644 --- a/lodash.flowright/index.js +++ b/lodash.flowright/index.js @@ -1,12 +1,49 @@ /** - * lodash 3.1.0 (Custom Build) + * lodash 3.2.0 (Custom Build) * Build: `lodash modern modularize exports="npm" -o ./` * Copyright 2012-2015 The Dojo Foundation * Based on Underscore.js 1.8.2 * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors * Available under MIT license */ -var createComposer = require('lodash._createcomposer'); + +/** Used as the `TypeError` message for "Functions" methods. */ +var FUNC_ERROR_TEXT = 'Expected a function'; + +/** + * Creates a `_.flow` or `_.flowRight` function. + * + * @private + * @param {boolean} [fromRight] Specify iterating from right to left. + * @returns {Function} Returns the new flow function. + */ +function createFlow(fromRight) { + return function() { + var length = arguments.length; + if (!length) { + return function() { return arguments[0]; }; + } + var index = fromRight ? length : -1, + leftIndex = 0, + funcs = Array(length); + + while ((fromRight ? index-- : ++index < length)) { + var func = funcs[leftIndex++] = arguments[index]; + if (typeof func != 'function') { + throw new TypeError(FUNC_ERROR_TEXT); + } + } + return function() { + var index = 0, + result = funcs[index].apply(this, arguments); + + while (++index < length) { + result = funcs[index].call(this, result); + } + return result; + }; + }; +} /** * This method is like `_.flow` except that it creates a function that @@ -28,6 +65,6 @@ var createComposer = require('lodash._createcomposer'); * addSquare(1, 2); * // => 9 */ -var flowRight = createComposer(true); +var flowRight = createFlow(true); module.exports = flowRight; diff --git a/lodash.flowright/package.json b/lodash.flowright/package.json index 74bf70702..bcb8303f5 100644 --- a/lodash.flowright/package.json +++ b/lodash.flowright/package.json @@ -1,6 +1,6 @@ { "name": "lodash.flowright", - "version": "3.1.0", + "version": "3.2.0", "description": "The modern build of lodash’s `_.flowRight` as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -15,8 +15,5 @@ "Mathias Bynens (https://mathiasbynens.be/)" ], "repository": "lodash/lodash", - "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, - "dependencies": { - "lodash._createcomposer": "^3.0.0" - } + "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" } } diff --git a/lodash.has/README.md b/lodash.has/README.md index 56d759294..56eb2e8c6 100644 --- a/lodash.has/README.md +++ b/lodash.has/README.md @@ -1,4 +1,4 @@ -# lodash.has v3.1.1 +# lodash.has v3.2.0 The [modern build](https://github.com/lodash/lodash/wiki/Build-Differences) of [lodash’s](https://lodash.com/) `_.has` exported as a [Node.js](http://nodejs.org/)/[io.js](https://iojs.org/) module. @@ -17,4 +17,4 @@ In Node.js/io.js: var has = require('lodash.has'); ``` -See the [documentation](https://lodash.com/docs#has) or [package source](https://github.com/lodash/lodash/blob/3.1.1-npm-packages/lodash.has) for more details. +See the [documentation](https://lodash.com/docs#has) or [package source](https://github.com/lodash/lodash/blob/3.2.0-npm-packages/lodash.has) for more details. diff --git a/lodash.has/index.js b/lodash.has/index.js index c22e9b729..5062d7a7a 100644 --- a/lodash.has/index.js +++ b/lodash.has/index.js @@ -1,5 +1,5 @@ /** - * lodash 3.1.1 (Custom Build) + * lodash 3.2.0 (Custom Build) * Build: `lodash modern modularize exports="npm" -o ./` * Copyright 2012-2015 The Dojo Foundation * Based on Underscore.js 1.8.3 @@ -9,6 +9,7 @@ var baseGet = require('lodash._baseget'), baseSlice = require('lodash._baseslice'), toPath = require('lodash._topath'), + isArguments = require('lodash.isarguments'), isArray = require('lodash.isarray'); /** Used to match property names within property paths. */ @@ -21,6 +22,26 @@ var objectProto = Object.prototype; /** Used to check objects for own properties. */ var hasOwnProperty = objectProto.hasOwnProperty; +/** + * 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 = 9007199254740991; + +/** + * Checks if `value` is a valid array-like index. + * + * @private + * @param {*} value The value to check. + * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index. + * @returns {boolean} Returns `true` if `value` is a valid index, else `false`. + */ +function isIndex(value, length) { + value = typeof value == 'number' ? value : parseFloat(value); + length = length == null ? MAX_SAFE_INTEGER : length; + return value > -1 && value % 1 == 0 && value < length; +} + /** * Checks if `value` is a property name and not a property path. * @@ -42,7 +63,20 @@ function isKey(value, object) { } /** - * Converts `value` to an object if it is not one. + * 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). + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. + */ +function isLength(value) { + return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; +} + +/** + * Converts `value` to an object if it's not one. * * @private * @param {*} value The value to process. @@ -94,7 +128,7 @@ 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'); + return !!value && (type == 'object' || type == 'function'); } /** @@ -127,10 +161,14 @@ function has(object, path) { if (!result && !isKey(path)) { path = toPath(path); object = path.length == 1 ? object : baseGet(object, baseSlice(path, 0, -1)); + if (object == null) { + return false; + } path = last(path); - result = object != null && hasOwnProperty.call(object, path); + result = hasOwnProperty.call(object, path); } - return result; + return result || (isLength(object.length) && isIndex(path, object.length) && + (isArray(object) || isArguments(object))); } module.exports = has; diff --git a/lodash.has/package.json b/lodash.has/package.json index 77a93661c..cfc89bf4b 100644 --- a/lodash.has/package.json +++ b/lodash.has/package.json @@ -1,6 +1,6 @@ { "name": "lodash.has", - "version": "3.1.1", + "version": "3.2.0", "description": "The modern build of lodash’s `_.has` as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -20,6 +20,7 @@ "lodash._baseget": "^3.0.0", "lodash._baseslice": "^3.0.0", "lodash._topath": "^3.0.0", + "lodash.isarguments": "^3.0.0", "lodash.isarray": "^3.0.0" } } diff --git a/lodash.intersection/README.md b/lodash.intersection/README.md index 10c9741ff..46de66536 100644 --- a/lodash.intersection/README.md +++ b/lodash.intersection/README.md @@ -1,4 +1,4 @@ -# lodash.intersection v3.1.0 +# lodash.intersection v3.2.0 The [modern build](https://github.com/lodash/lodash/wiki/Build-Differences) of [lodash’s](https://lodash.com/) `_.intersection` exported as a [Node.js](http://nodejs.org/)/[io.js](https://iojs.org/) module. @@ -17,4 +17,4 @@ In Node.js/io.js: var intersection = require('lodash.intersection'); ``` -See the [documentation](https://lodash.com/docs#intersection) or [package source](https://github.com/lodash/lodash/blob/3.1.0-npm-packages/lodash.intersection) for more details. +See the [documentation](https://lodash.com/docs#intersection) or [package source](https://github.com/lodash/lodash/blob/3.2.0-npm-packages/lodash.intersection) for more details. diff --git a/lodash.intersection/index.js b/lodash.intersection/index.js index ae2469672..4314402d8 100644 --- a/lodash.intersection/index.js +++ b/lodash.intersection/index.js @@ -1,5 +1,5 @@ /** - * lodash 3.1.0 (Custom Build) + * lodash 3.2.0 (Custom Build) * Build: `lodash modern modularize exports="npm" -o ./` * Copyright 2012-2015 The Dojo Foundation * Based on Underscore.js 1.8.3 @@ -8,13 +8,14 @@ */ var baseIndexOf = require('lodash._baseindexof'), cacheIndexOf = require('lodash._cacheindexof'), - createCache = require('lodash._createcache'); + createCache = require('lodash._createcache'), + restParam = require('lodash.restparam'); /** - * 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 = Math.pow(2, 53) - 1; +var MAX_SAFE_INTEGER = 9007199254740991; /** * The base implementation of `_.property` without support for deep paths. @@ -55,7 +56,7 @@ function isArrayLike(value) { /** * 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. @@ -66,8 +67,8 @@ function isLength(value) { } /** - * Creates an array of unique values in all provided arrays using - * [`SameValueZero`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) + * 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) * for equality comparisons. * * @static @@ -79,27 +80,19 @@ function isLength(value) { * _.intersection([1, 2], [4, 2], [2, 1]); * // => [2] */ -function intersection() { - var args = [], - argsIndex = -1, - argsLength = arguments.length, - caches = [], +var intersection = restParam(function(arrays) { + var othLength = arrays.length, + othIndex = othLength, + caches = Array(length), indexOf = baseIndexOf, isCommon = true, result = []; - while (++argsIndex < argsLength) { - var value = arguments[argsIndex]; - if (isArrayLike(value)) { - args.push(value); - caches.push((isCommon && value.length >= 120) ? createCache(argsIndex && value) : null); - } + while (othIndex--) { + var value = arrays[othIndex] = isArrayLike(value = arrays[othIndex]) ? value : []; + caches[othIndex] = (isCommon && value.length >= 120) ? createCache(othIndex && value) : null; } - argsLength = args.length; - if (argsLength < 2) { - return result; - } - var array = args[0], + var array = arrays[0], index = -1, length = array ? array.length : 0, seen = caches[0]; @@ -108,10 +101,10 @@ function intersection() { while (++index < length) { value = array[index]; if ((seen ? cacheIndexOf(seen, value) : indexOf(result, value, 0)) < 0) { - argsIndex = argsLength; - while (--argsIndex) { - var cache = caches[argsIndex]; - if ((cache ? cacheIndexOf(cache, value) : indexOf(args[argsIndex], value, 0)) < 0) { + var othIndex = othLength; + while (--othIndex) { + var cache = caches[othIndex]; + if ((cache ? cacheIndexOf(cache, value) : indexOf(arrays[othIndex], value, 0)) < 0) { continue outer; } } @@ -122,6 +115,6 @@ function intersection() { } } return result; -} +}); module.exports = intersection; diff --git a/lodash.intersection/package.json b/lodash.intersection/package.json index 41b1eca45..a63376096 100644 --- a/lodash.intersection/package.json +++ b/lodash.intersection/package.json @@ -1,6 +1,6 @@ { "name": "lodash.intersection", - "version": "3.1.0", + "version": "3.2.0", "description": "The modern build of lodash’s `_.intersection` as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -19,6 +19,7 @@ "dependencies": { "lodash._baseindexof": "^3.0.0", "lodash._cacheindexof": "^3.0.0", - "lodash._createcache": "^3.0.0" + "lodash._createcache": "^3.0.0", + "lodash.restparam": "^3.0.0" } } diff --git a/lodash.invoke/README.md b/lodash.invoke/README.md index 1681d0e12..4bb98974e 100644 --- a/lodash.invoke/README.md +++ b/lodash.invoke/README.md @@ -1,4 +1,4 @@ -# lodash.invoke v3.1.0 +# lodash.invoke v3.2.0 The [modern build](https://github.com/lodash/lodash/wiki/Build-Differences) of [lodash’s](https://lodash.com/) `_.invoke` exported as a [Node.js](http://nodejs.org/)/[io.js](https://iojs.org/) module. @@ -17,4 +17,4 @@ In Node.js/io.js: var invoke = require('lodash.invoke'); ``` -See the [documentation](https://lodash.com/docs#invoke) or [package source](https://github.com/lodash/lodash/blob/3.1.0-npm-packages/lodash.invoke) for more details. +See the [documentation](https://lodash.com/docs#invoke) or [package source](https://github.com/lodash/lodash/blob/3.2.0-npm-packages/lodash.invoke) for more details. diff --git a/lodash.invoke/index.js b/lodash.invoke/index.js index e9f5f217f..6f4b9481a 100644 --- a/lodash.invoke/index.js +++ b/lodash.invoke/index.js @@ -1,20 +1,71 @@ /** - * lodash 3.1.0 (Custom Build) + * lodash 3.2.0 (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 */ var baseEach = require('lodash._baseeach'), + invokePath = require('lodash._invokepath'), + isArray = require('lodash.isarray'), restParam = require('lodash.restparam'); +/** Used to match property names within property paths. */ +var reIsDeepProp = /\.|\[(?:[^[\]]+|(["'])(?:(?!\1)[^\n\\]|\\.)*?)\1\]/, + reIsPlainProp = /^\w*$/; + /** * 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; +/** + * 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) + * in Safari on iOS 8.1 ARM64. + * + * @private + * @param {Object} object The object to query. + * @returns {*} Returns the "length" value. + */ +var getLength = baseProperty('length'); + +/** + * Checks if `value` is a property name and not a property path. + * + * @private + * @param {*} value The value to check. + * @param {Object} [object] The object to query keys on. + * @returns {boolean} Returns `true` if `value` is a property name, else `false`. + */ +function isKey(value, object) { + var type = typeof value; + if ((type == 'string' && reIsPlainProp.test(value)) || type == 'number') { + return true; + } + if (isArray(value)) { + return false; + } + var result = !reIsDeepProp.test(value); + return result || (object != null && value in toObject(object)); +} + /** * Checks if `value` is a valid array-like length. * @@ -29,16 +80,27 @@ function isLength(value) { } /** - * Invokes the method named by `methodName` on each element in `collection`, - * returning an array of the results of each invoked method. Any additional - * arguments are provided to each invoked method. If `methodName` is a function - * it is invoked for, and `this` bound to, each element in `collection`. + * Converts `value` to an object if it is not one. + * + * @private + * @param {*} value The value to process. + * @returns {Object} Returns the object. + */ +function toObject(value) { + return isObject(value) ? value : Object(value); +} + +/** + * Invokes the method at `path` on each element in `collection`, returning + * an array of the results of each invoked method. Any additional arguments + * are provided to each invoked method. If `methodName` is a function it is + * invoked for, and `this` bound to, each element in `collection`. * * @static * @memberOf _ * @category Collection * @param {Array|Object|string} collection The collection to iterate over. - * @param {Function|string} methodName The name of the method to invoke or + * @param {Array|Function|string} path The path of the method to invoke or * the function invoked per iteration. * @param {...*} [args] The arguments to invoke the method with. * @returns {Array} Returns the array of results. @@ -50,17 +112,45 @@ function isLength(value) { * _.invoke([123, 456], String.prototype.split, ''); * // => [['1', '2', '3'], ['4', '5', '6']] */ -var invoke = restParam(function(collection, methodName, args) { +var invoke = restParam(function(collection, path, args) { var index = -1, - isFunc = typeof methodName == 'function', - length = collection ? collection.length : 0, + isFunc = typeof path == 'function', + isProp = isKey(path), + length = getLength(collection), result = isLength(length) ? Array(length) : []; baseEach(collection, function(value) { - var func = isFunc ? methodName : (value != null && value[methodName]); - result[++index] = func ? func.apply(value, args) : undefined; + var func = isFunc ? path : (isProp && value != null && value[path]); + result[++index] = func ? func.apply(value, args) : invokePath(value, path, args); }); return result; }); +/** + * 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 type == 'function' || (!!value && type == 'object'); +} + module.exports = invoke; diff --git a/lodash.invoke/package.json b/lodash.invoke/package.json index f8c589475..68b992fb8 100644 --- a/lodash.invoke/package.json +++ b/lodash.invoke/package.json @@ -1,6 +1,6 @@ { "name": "lodash.invoke", - "version": "3.1.0", + "version": "3.2.0", "description": "The modern build of lodash’s `_.invoke` as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -18,6 +18,8 @@ "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, "dependencies": { "lodash._baseeach": "^3.0.0", + "lodash._invokepath": "^3.0.0", + "lodash.isarray": "^3.0.0", "lodash.restparam": "^3.0.0" } } diff --git a/lodash.isfinite/LICENSE.txt b/lodash.isfinite/LICENSE similarity index 100% rename from lodash.isfinite/LICENSE.txt rename to lodash.isfinite/LICENSE diff --git a/lodash.isfinite/README.md b/lodash.isfinite/README.md index 08afaa87d..3c579f79d 100644 --- a/lodash.isfinite/README.md +++ b/lodash.isfinite/README.md @@ -1,4 +1,4 @@ -# lodash.isfinite v3.1.0 +# lodash.isfinite v3.2.0 The [modern build](https://github.com/lodash/lodash/wiki/Build-Differences) of [lodash’s](https://lodash.com/) `_.isFinite` exported as a [Node.js](http://nodejs.org/)/[io.js](https://iojs.org/) module. @@ -17,4 +17,4 @@ In Node.js/io.js: var isFinite = require('lodash.isfinite'); ``` -See the [documentation](https://lodash.com/docs#isFinite) or [package source](https://github.com/lodash/lodash/blob/3.1.0-npm-packages/lodash.isfinite) for more details. +See the [documentation](https://lodash.com/docs#isFinite) or [package source](https://github.com/lodash/lodash/blob/3.2.0-npm-packages/lodash.isfinite) for more details. diff --git a/lodash.isfinite/index.js b/lodash.isfinite/index.js index 71f4259b8..86d0cff95 100644 --- a/lodash.isfinite/index.js +++ b/lodash.isfinite/index.js @@ -1,21 +1,19 @@ /** - * lodash 3.1.0 (Custom Build) - * Build: `lodash modern modularize exports="npm" -o ./` + * lodash 3.2.0 (Custom Build) + * Build: `lodash modularize exports="npm" -o ./` * Copyright 2012-2015 The Dojo Foundation * Based on Underscore.js 1.8.3 * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors * Available under MIT license */ -var getNative = require('lodash._getnative'); -/* Native method references for those with the same name as other `lodash` methods. */ -var nativeIsFinite = global.isFinite, - nativeNumIsFinite = getNative(Number, 'isFinite'); +/* Built-in method references for those with the same name as other `lodash` methods. */ +var nativeIsFinite = global.isFinite; /** * Checks if `value` is a finite primitive number. * - * **Note:** This method is based on [`Number.isFinite`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-number.isfinite). + * **Note:** This method is based on [`Number.isFinite`](https://mdn.io/Number/isFinite). * * @static * @memberOf _ @@ -24,23 +22,20 @@ var nativeIsFinite = global.isFinite, * @returns {boolean} Returns `true` if `value` is a finite number, else `false`. * @example * - * _.isFinite(10); + * _.isFinite(3); * // => true * - * _.isFinite('10'); - * // => false + * _.isFinite(Number.MAX_VALUE); + * // => true * - * _.isFinite(true); - * // => false - * - * _.isFinite(Object(10)); - * // => false + * _.isFinite(3.14); + * // => true * * _.isFinite(Infinity); * // => false */ -var isFinite = nativeNumIsFinite || function(value) { +function isFinite(value) { return typeof value == 'number' && nativeIsFinite(value); -}; +} module.exports = isFinite; diff --git a/lodash.isfinite/package.json b/lodash.isfinite/package.json index ea2be8aab..4a97734fc 100644 --- a/lodash.isfinite/package.json +++ b/lodash.isfinite/package.json @@ -1,6 +1,6 @@ { "name": "lodash.isfinite", - "version": "3.1.0", + "version": "3.2.0", "description": "The modern build of lodash’s `_.isFinite` as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -15,8 +15,5 @@ "Mathias Bynens (https://mathiasbynens.be/)" ], "repository": "lodash/lodash", - "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, - "dependencies": { - "lodash._getnative": "^3.0.0" - } + "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" } } diff --git a/lodash.ismatch/README.md b/lodash.ismatch/README.md index dda6531c3..eed62aaad 100644 --- a/lodash.ismatch/README.md +++ b/lodash.ismatch/README.md @@ -1,4 +1,4 @@ -# lodash.ismatch v3.1.3 +# lodash.ismatch v3.2.0 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.3-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.2.0-npm-packages/lodash.ismatch) for more details. diff --git a/lodash.ismatch/index.js b/lodash.ismatch/index.js index 54db885ea..1e311b70d 100644 --- a/lodash.ismatch/index.js +++ b/lodash.ismatch/index.js @@ -1,5 +1,5 @@ /** - * lodash 3.1.3 (Custom Build) + * lodash 3.2.0 (Custom Build) * Build: `lodash modern modularize exports="npm" -o ./` * Copyright 2012-2015 The Dojo Foundation * Based on Underscore.js 1.8.3 @@ -8,7 +8,24 @@ */ var baseIsMatch = require('lodash._baseismatch'), bindCallback = require('lodash._bindcallback'), - keys = require('lodash.keys'); + pairs = require('lodash.pairs'); + +/** + * Gets the propery names, values, and compare flags of `object`. + * + * @private + * @param {Object} object The object to query. + * @returns {Array} Returns the match data of `object`. + */ +function getMatchData(object) { + var result = pairs(object), + length = result.length; + + while (length--) { + result[length][2] = isStrictComparable(result[length][1]); + } + return result; +} /** * Checks if `value` is suitable for strict equality comparisons, i.e. `===`. @@ -22,17 +39,6 @@ function isStrictComparable(value) { return value === value && !isObject(value); } -/** - * Converts `value` to an object if it is 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('')`) @@ -57,13 +63,13 @@ 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'); + return !!value && (type == 'object' || type == 'function'); } /** * Performs a deep comparison between `object` and `source` to determine if * `object` contains equivalent property values. If `customizer` is provided - * it is invoked to compare values. If `customizer` returns `undefined` + * it's invoked to compare values. If `customizer` returns `undefined` * comparisons are handled by the method instead. The `customizer` is bound * to `thisArg` and invoked with three arguments: (value, other, index|key). * @@ -100,33 +106,8 @@ function isObject(value) { * // => true */ function isMatch(object, source, customizer, thisArg) { - var props = keys(source), - length = props.length; - - if (!length) { - return true; - } - if (object == null) { - return false; - } - customizer = typeof customizer == 'function' && bindCallback(customizer, thisArg, 3); - object = toObject(object); - if (!customizer && length == 1) { - var key = props[0], - value = source[key]; - - if (isStrictComparable(value)) { - return value === object[key] && (value !== undefined || (key in object)); - } - } - var values = Array(length), - strictCompareFlags = Array(length); - - while (length--) { - value = values[length] = source[props[length]]; - strictCompareFlags[length] = isStrictComparable(value); - } - return baseIsMatch(object, props, values, strictCompareFlags, customizer); + customizer = typeof customizer == 'function' ? bindCallback(customizer, thisArg, 3) : undefined; + return baseIsMatch(object, getMatchData(source), customizer); } module.exports = isMatch; diff --git a/lodash.ismatch/package.json b/lodash.ismatch/package.json index ad95353b5..716ba3445 100644 --- a/lodash.ismatch/package.json +++ b/lodash.ismatch/package.json @@ -1,6 +1,6 @@ { "name": "lodash.ismatch", - "version": "3.1.3", + "version": "3.2.0", "description": "The modern build of lodash’s `_.isMatch` as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -19,6 +19,6 @@ "dependencies": { "lodash._baseismatch": "^3.0.0", "lodash._bindcallback": "^3.0.0", - "lodash.keys": "^3.0.0" + "lodash.pairs": "^3.0.0" } } diff --git a/lodash.isplainobject/LICENSE.txt b/lodash.isplainobject/LICENSE similarity index 100% rename from lodash.isplainobject/LICENSE.txt rename to lodash.isplainobject/LICENSE diff --git a/lodash.isplainobject/README.md b/lodash.isplainobject/README.md index 44b9b7db6..49adee1af 100644 --- a/lodash.isplainobject/README.md +++ b/lodash.isplainobject/README.md @@ -1,4 +1,4 @@ -# lodash.isplainobject v3.1.0 +# lodash.isplainobject v3.2.0 The [modern build](https://github.com/lodash/lodash/wiki/Build-Differences) of [lodash’s](https://lodash.com/) `_.isPlainObject` exported as a [Node.js](http://nodejs.org/)/[io.js](https://iojs.org/) module. @@ -17,4 +17,4 @@ In Node.js/io.js: var isPlainObject = require('lodash.isplainobject'); ``` -See the [documentation](https://lodash.com/docs#isPlainObject) or [package source](https://github.com/lodash/lodash/blob/3.1.0-npm-packages/lodash.isplainobject) for more details. +See the [documentation](https://lodash.com/docs#isPlainObject) or [package source](https://github.com/lodash/lodash/blob/3.2.0-npm-packages/lodash.isplainobject) for more details. diff --git a/lodash.isplainobject/index.js b/lodash.isplainobject/index.js index 8bab99faf..beadd60ab 100644 --- a/lodash.isplainobject/index.js +++ b/lodash.isplainobject/index.js @@ -1,5 +1,5 @@ /** - * lodash 3.1.0 (Custom Build) + * lodash 3.2.0 (Custom Build) * Build: `lodash modern modularize exports="npm" -o ./` * Copyright 2012-2015 The Dojo Foundation * Based on Underscore.js 1.8.3 @@ -7,7 +7,7 @@ * Available under MIT license */ var baseFor = require('lodash._basefor'), - getNative = require('lodash._getnative'), + isArguments = require('lodash.isarguments'), keysIn = require('lodash.keysin'); /** `Object#toString` result references. */ @@ -31,14 +31,11 @@ var objectProto = Object.prototype; var hasOwnProperty = objectProto.hasOwnProperty; /** - * Used to resolve the [`toStringTag`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.prototype.tostring) + * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) * of values. */ var objToString = objectProto.toString; -/** Native method references. */ -var getPrototypeOf = getNative(Object, 'getPrototypeOf'); - /** * The base implementation of `_.forIn` without support for callback * shorthands and `this` binding. @@ -52,37 +49,6 @@ function baseForIn(object, iteratee) { return baseFor(object, iteratee, keysIn); } -/** - * A fallback implementation of `_.isPlainObject` which checks if `value` - * is an object created by the `Object` constructor or has a `[[Prototype]]` - * of `null`. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a plain object, else `false`. - */ -function shimIsPlainObject(value) { - var Ctor; - - // Exit early for non `Object` objects. - if (!(isObjectLike(value) && objToString.call(value) == objectTag) || - (!hasOwnProperty.call(value, 'constructor') && - (Ctor = value.constructor, typeof Ctor == 'function' && !(Ctor instanceof Ctor)))) { - return false; - } - // IE < 9 iterates inherited properties before own properties. If the first - // iterated property is an object's own property then there are no inherited - // enumerable properties. - var result; - // In most environments an object's own properties are iterated before - // its inherited properties. If the last iterated property is an object's - // own property then there are no inherited enumerable properties. - baseForIn(value, function(subValue, key) { - result = key; - }); - return result === undefined || hasOwnProperty.call(value, result); -} - /** * Checks if `value` is a plain object, that is, an object created by the * `Object` constructor or one with a `[[Prototype]]` of `null`. @@ -113,16 +79,25 @@ function shimIsPlainObject(value) { * _.isPlainObject(Object.create(null)); * // => true */ -var isPlainObject = !getPrototypeOf ? shimIsPlainObject : function(value) { - if (!(value && objToString.call(value) == objectTag)) { +function isPlainObject(value) { + var Ctor; + + // Exit early for non `Object` objects. + if (!(isObjectLike(value) && objToString.call(value) == objectTag && !isArguments(value)) || + (!hasOwnProperty.call(value, 'constructor') && (Ctor = value.constructor, typeof Ctor == 'function' && !(Ctor instanceof Ctor)))) { return false; } - var valueOf = getNative(value, 'valueOf'), - objProto = valueOf && (objProto = getPrototypeOf(valueOf)) && getPrototypeOf(objProto); - - return objProto - ? (value == objProto || getPrototypeOf(value) == objProto) - : shimIsPlainObject(value); -}; + // IE < 9 iterates inherited properties before own properties. If the first + // iterated property is an object's own property then there are no inherited + // enumerable properties. + var result; + // In most environments an object's own properties are iterated before + // its inherited properties. If the last iterated property is an object's + // own property then there are no inherited enumerable properties. + baseForIn(value, function(subValue, key) { + result = key; + }); + return result === undefined || hasOwnProperty.call(value, result); +} module.exports = isPlainObject; diff --git a/lodash.isplainobject/package.json b/lodash.isplainobject/package.json index bab225ba1..3ea7f628c 100644 --- a/lodash.isplainobject/package.json +++ b/lodash.isplainobject/package.json @@ -1,6 +1,6 @@ { "name": "lodash.isplainobject", - "version": "3.1.0", + "version": "3.2.0", "description": "The modern build of lodash’s `_.isPlainObject` as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -18,7 +18,7 @@ "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, "dependencies": { "lodash._basefor": "^3.0.0", - "lodash._getnative": "^3.0.0", + "lodash.isarguments": "^3.0.0", "lodash.keysin": "^3.0.0" } } diff --git a/lodash.matchesproperty/LICENSE.txt b/lodash.matchesproperty/LICENSE.txt new file mode 100644 index 000000000..17764328c --- /dev/null +++ b/lodash.matchesproperty/LICENSE.txt @@ -0,0 +1,22 @@ +Copyright 2012-2015 The Dojo Foundation +Based on Underscore.js 1.7.0, copyright 2009-2015 Jeremy Ashkenas, +DocumentCloud and Investigative Reporters & Editors + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/lodash.matchesproperty/README.md b/lodash.matchesproperty/README.md new file mode 100644 index 000000000..4339acd40 --- /dev/null +++ b/lodash.matchesproperty/README.md @@ -0,0 +1,20 @@ +# lodash.matchesproperty v3.2.0 + +The [modern build](https://github.com/lodash/lodash/wiki/Build-Differences) of [lodash’s](https://lodash.com/) `_.matchesProperty` exported as a [Node.js](http://nodejs.org/)/[io.js](https://iojs.org/) module. + +## Installation + +Using npm: + +```bash +$ {sudo -H} npm i -g npm +$ npm i --save lodash.matchesproperty +``` + +In Node.js/io.js: + +```js +var matchesProperty = require('lodash.matchesproperty'); +``` + +See the [documentation](https://lodash.com/docs#matchesProperty) or [package source](https://github.com/lodash/lodash/blob/3.2.0-npm-packages/lodash.matchesproperty) for more details. diff --git a/lodash.matchesproperty/index.js b/lodash.matchesproperty/index.js new file mode 100644 index 000000000..0ad075122 --- /dev/null +++ b/lodash.matchesproperty/index.js @@ -0,0 +1,40 @@ +/** + * lodash 3.2.0 (Custom Build) + * Build: `lodash modern modularize exports="npm" -o ./` + * Copyright 2012-2015 The Dojo Foundation + * Based on Underscore.js 1.7.0 + * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors + * Available under MIT license + */ +var baseClone = require('lodash._baseclone'), + baseMatchesProperty = require('lodash._basematchesproperty'); + +/** + * Creates a function which compares the property value of `key` on a given + * object to `value`. + * + * **Note:** This method supports comparing arrays, booleans, `Date` objects, + * numbers, `Object` objects, regexes, and strings. Objects are compared by + * their own, not inherited, enumerable properties. + * + * @static + * @memberOf _ + * @category Utility + * @param {string} key The key of the property to get. + * @param {*} value The value to compare. + * @returns {Function} Returns the new function. + * @example + * + * var users = [ + * { 'user': 'barney' }, + * { 'user': 'fred' } + * ]; + * + * _.find(users, _.matchesProperty('user', 'fred')); + * // => { 'user': 'fred' } + */ +function matchesProperty(key, value) { + return baseMatchesProperty(key + '', baseClone(value, true)); +} + +module.exports = matchesProperty; diff --git a/lodash.matchesproperty/package.json b/lodash.matchesproperty/package.json new file mode 100644 index 000000000..aeb4c4dae --- /dev/null +++ b/lodash.matchesproperty/package.json @@ -0,0 +1,23 @@ +{ + "name": "lodash.matchesproperty", + "version": "3.2.0", + "description": "The modern build of lodash’s `_.matchesProperty` 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/)", + "Mathias Bynens (https://mathiasbynens.be/)" + ], + "repository": "lodash/lodash", + "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, + "dependencies": { + "lodash._baseclone": "^3.0.0", + "lodash._basematchesproperty": "^3.0.0" + } +} diff --git a/lodash.max/README.md b/lodash.max/README.md index a54fcb23a..8a3a0ece6 100644 --- a/lodash.max/README.md +++ b/lodash.max/README.md @@ -1,4 +1,4 @@ -# lodash.max v3.1.0 +# lodash.max v3.2.0 The [modern build](https://github.com/lodash/lodash/wiki/Build-Differences) of [lodash’s](https://lodash.com/) `_.max` exported as a [Node.js](http://nodejs.org/)/[io.js](https://iojs.org/) module. @@ -17,4 +17,4 @@ In Node.js/io.js: var max = require('lodash.max'); ``` -See the [documentation](https://lodash.com/docs#max) or [package source](https://github.com/lodash/lodash/blob/3.1.0-npm-packages/lodash.max) for more details. +See the [documentation](https://lodash.com/docs#max) or [package source](https://github.com/lodash/lodash/blob/3.2.0-npm-packages/lodash.max) for more details. diff --git a/lodash.max/index.js b/lodash.max/index.js index 73f87f3c8..c0ec94eaf 100644 --- a/lodash.max/index.js +++ b/lodash.max/index.js @@ -1,5 +1,5 @@ /** - * lodash 3.1.0 (Custom Build) + * lodash 3.2.0 (Custom Build) * Build: `lodash modern modularize exports="npm" -o ./` * Copyright 2012-2015 The Dojo Foundation * Based on Underscore.js 1.8.2 @@ -12,7 +12,8 @@ var arrayMax = require('lodash._arraymax'), isIterateeCall = require('lodash._isiterateecall'), toIterable = require('lodash._toiterable'), isArray = require('lodash.isarray'), - isString = require('lodash.isstring'); + isString = require('lodash.isstring'), + keys = require('lodash.keys'); /** * Used by `_.max` and `_.min` as the default callback for string values. diff --git a/lodash.max/package.json b/lodash.max/package.json index 2731151f6..7bdf0a82b 100644 --- a/lodash.max/package.json +++ b/lodash.max/package.json @@ -1,6 +1,6 @@ { "name": "lodash.max", - "version": "3.1.0", + "version": "3.2.0", "description": "The modern build of lodash’s `_.max` as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -23,6 +23,7 @@ "lodash._isiterateecall": "^3.0.0", "lodash._toiterable": "^3.0.0", "lodash.isarray": "^3.0.0", - "lodash.isstring": "^3.0.0" + "lodash.isstring": "^3.0.0", + "lodash.keys": "^3.0.0" } } diff --git a/lodash.merge/README.md b/lodash.merge/README.md index bccd4d473..97f31af43 100644 --- a/lodash.merge/README.md +++ b/lodash.merge/README.md @@ -1,4 +1,4 @@ -# lodash.merge v3.1.0 +# lodash.merge v3.2.0 The [modern build](https://github.com/lodash/lodash/wiki/Build-Differences) of [lodash’s](https://lodash.com/) `_.merge` exported as a [Node.js](http://nodejs.org/)/[io.js](https://iojs.org/) module. @@ -17,4 +17,4 @@ In Node.js/io.js: var merge = require('lodash.merge'); ``` -See the [documentation](https://lodash.com/docs#merge) or [package source](https://github.com/lodash/lodash/blob/3.1.0-npm-packages/lodash.merge) for more details. +See the [documentation](https://lodash.com/docs#merge) or [package source](https://github.com/lodash/lodash/blob/3.2.0-npm-packages/lodash.merge) for more details. diff --git a/lodash.merge/index.js b/lodash.merge/index.js index 8e8f36578..a8f509e0b 100644 --- a/lodash.merge/index.js +++ b/lodash.merge/index.js @@ -1,14 +1,13 @@ /** - * lodash 3.1.0 (Custom Build) + * lodash 3.2.0 (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 */ var arrayCopy = require('lodash._arraycopy'), arrayEach = require('lodash._arrayeach'), - baseFor = require('lodash._basefor'), createAssigner = require('lodash._createassigner'), isArguments = require('lodash.isarguments'), isArray = require('lodash.isarray'), @@ -30,25 +29,19 @@ function isObjectLike(value) { return !!value && typeof value == 'object'; } +/** Used for native method references. */ +var arrayProto = Array.prototype; + +/** Native method references. */ +var getOwnPropertySymbols = isNative(getOwnPropertySymbols = Object.getOwnPropertySymbols) && getOwnPropertySymbols, + push = arrayProto.push; + /** * 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; -/** - * The base implementation of `_.forOwn` without support for callback - * shorthands and `this` binding. - * - * @private - * @param {Object} object The object to iterate over. - * @param {Function} iteratee The function invoked per iteration. - * @returns {Object} Returns `object`. - */ -function baseForOwn(object, iteratee) { - return baseFor(object, iteratee, keys); -} - /** * The base implementation of `_.merge` without support for argument juggling, * multiple sources, and `this` binding `customizer` functions. @@ -59,29 +52,39 @@ function baseForOwn(object, iteratee) { * @param {Function} [customizer] The function to customize merging properties. * @param {Array} [stackA=[]] Tracks traversed source objects. * @param {Array} [stackB=[]] Associates values with source counterparts. - * @returns {Object} Returns the destination object. + * @returns {Object} Returns `object`. */ function baseMerge(object, source, customizer, stackA, stackB) { if (!isObject(object)) { return object; } var isSrcArr = isLength(source.length) && (isArray(source) || isTypedArray(source)); - (isSrcArr ? arrayEach : baseForOwn)(source, function(srcValue, key, source) { + if (!isSrcArr) { + var props = keys(source); + push.apply(props, getSymbols(source)); + } + arrayEach(props || source, function(srcValue, key) { + if (props) { + key = srcValue; + srcValue = source[key]; + } if (isObjectLike(srcValue)) { stackA || (stackA = []); stackB || (stackB = []); - return baseMergeDeep(object, source, key, baseMerge, customizer, stackA, stackB); + baseMergeDeep(object, source, key, baseMerge, customizer, stackA, stackB); } - var value = object[key], - result = customizer ? customizer(value, srcValue, key, object, source) : undefined, - isCommon = typeof result == 'undefined'; + else { + var value = object[key], + result = customizer ? customizer(value, srcValue, key, object, source) : undefined, + isCommon = result === undefined; - if (isCommon) { - result = srcValue; - } - if ((isSrcArr || typeof result != 'undefined') && - (isCommon || (result === result ? (result !== value) : (value === value)))) { - object[key] = result; + if (isCommon) { + result = srcValue; + } + if ((isSrcArr || result !== undefined) && + (isCommon || (result === result ? (result !== value) : (value === value)))) { + object[key] = result; + } } }); return object; @@ -114,14 +117,14 @@ function baseMergeDeep(object, source, key, mergeFunc, customizer, stackA, stack } var value = object[key], result = customizer ? customizer(value, srcValue, key, object, source) : undefined, - isCommon = typeof result == 'undefined'; + isCommon = result === undefined; if (isCommon) { result = srcValue; if (isLength(srcValue.length) && (isArray(srcValue) || isTypedArray(srcValue))) { result = isArray(value) ? value - : ((value && value.length) ? arrayCopy(value) : []); + : (getLength(value) ? arrayCopy(value) : []); } else if (isPlainObject(srcValue) || isArguments(srcValue)) { result = isArguments(value) @@ -145,6 +148,42 @@ function baseMergeDeep(object, source, key, mergeFunc, customizer, stackA, stack } } +/** + * 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) + * in Safari on iOS 8.1 ARM64. + * + * @private + * @param {Object} object The object to query. + * @returns {*} Returns the "length" value. + */ +var getLength = baseProperty('length'); + +/** + * Creates an array of the own symbols of `object`. + * + * @private + * @param {Object} object The object to query. + * @returns {Array} Returns the array of symbols. + */ +var getSymbols = !getOwnPropertySymbols ? constant([]) : function(object) { + return getOwnPropertySymbols(toObject(object)); +}; + /** * Checks if `value` is a valid array-like length. * @@ -158,6 +197,17 @@ function isLength(value) { return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; } +/** + * Converts `value` to an object if it is 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('')`) @@ -199,7 +249,7 @@ function isObject(value) { * @category Object * @param {Object} object The destination object. * @param {...Object} [sources] The source objects. - * @param {Function} [customizer] The function to customize merging properties. + * @param {Function} [customizer] The function to customize assigned values. * @param {*} [thisArg] The `this` binding of `customizer`. * @returns {Object} Returns `object`. * @example @@ -235,4 +285,26 @@ function isObject(value) { */ var merge = createAssigner(baseMerge); +/** + * 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 = merge; diff --git a/lodash.merge/package.json b/lodash.merge/package.json index 44b1c1dc4..2e38d0bc4 100644 --- a/lodash.merge/package.json +++ b/lodash.merge/package.json @@ -1,6 +1,6 @@ { "name": "lodash.merge", - "version": "3.1.0", + "version": "3.2.0", "description": "The modern build of lodash’s `_.merge` as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -19,7 +19,6 @@ "dependencies": { "lodash._arraycopy": "^3.0.0", "lodash._arrayeach": "^3.0.0", - "lodash._basefor": "^3.0.0", "lodash._createassigner": "^3.0.0", "lodash.isarguments": "^3.0.0", "lodash.isarray": "^3.0.0", diff --git a/lodash.min/README.md b/lodash.min/README.md index 7a5a78eb6..653cac4d0 100644 --- a/lodash.min/README.md +++ b/lodash.min/README.md @@ -1,4 +1,4 @@ -# lodash.min v3.1.0 +# lodash.min v3.2.0 The [modern build](https://github.com/lodash/lodash/wiki/Build-Differences) of [lodash’s](https://lodash.com/) `_.min` exported as a [Node.js](http://nodejs.org/)/[io.js](https://iojs.org/) module. @@ -17,4 +17,4 @@ In Node.js/io.js: var min = require('lodash.min'); ``` -See the [documentation](https://lodash.com/docs#min) or [package source](https://github.com/lodash/lodash/blob/3.1.0-npm-packages/lodash.min) for more details. +See the [documentation](https://lodash.com/docs#min) or [package source](https://github.com/lodash/lodash/blob/3.2.0-npm-packages/lodash.min) for more details. diff --git a/lodash.min/index.js b/lodash.min/index.js index 444dcb336..e882da057 100644 --- a/lodash.min/index.js +++ b/lodash.min/index.js @@ -1,5 +1,5 @@ /** - * lodash 3.1.0 (Custom Build) + * lodash 3.2.0 (Custom Build) * Build: `lodash modern modularize exports="npm" -o ./` * Copyright 2012-2015 The Dojo Foundation * Based on Underscore.js 1.8.2 @@ -12,7 +12,8 @@ var arrayMin = require('lodash._arraymin'), isIterateeCall = require('lodash._isiterateecall'), toIterable = require('lodash._toiterable'), isArray = require('lodash.isarray'), - isString = require('lodash.isstring'); + isString = require('lodash.isstring'), + keys = require('lodash.keys'); /** * Used by `_.max` and `_.min` as the default callback for string values. diff --git a/lodash.min/package.json b/lodash.min/package.json index 9fc48ce0f..a6faa4438 100644 --- a/lodash.min/package.json +++ b/lodash.min/package.json @@ -1,6 +1,6 @@ { "name": "lodash.min", - "version": "3.1.0", + "version": "3.2.0", "description": "The modern build of lodash’s `_.min` as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -23,6 +23,7 @@ "lodash._isiterateecall": "^3.0.0", "lodash._toiterable": "^3.0.0", "lodash.isarray": "^3.0.0", - "lodash.isstring": "^3.0.0" + "lodash.isstring": "^3.0.0", + "lodash.keys": "^3.0.0" } } diff --git a/lodash.pad/LICENSE b/lodash.pad/LICENSE index 9cd87e5dc..b054ca5a3 100644 --- a/lodash.pad/LICENSE +++ b/lodash.pad/LICENSE @@ -1,5 +1,5 @@ -Copyright 2012-2015 The Dojo Foundation -Based on Underscore.js, copyright 2009-2015 Jeremy Ashkenas, +Copyright 2012-2016 The Dojo Foundation +Based on Underscore.js, copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors Permission is hereby granted, free of charge, to any person obtaining diff --git a/lodash.pad/README.md b/lodash.pad/README.md index 456d23ddf..89c8deeaf 100644 --- a/lodash.pad/README.md +++ b/lodash.pad/README.md @@ -1,20 +1,18 @@ -# lodash.pad v3.1.1 +# lodash.pad v3.2.0 -The [modern build](https://github.com/lodash/lodash/wiki/Build-Differences) of [lodash’s](https://lodash.com/) `_.pad` exported as a [Node.js](http://nodejs.org/)/[io.js](https://iojs.org/) module. +The [lodash](https://lodash.com/) method `_.pad` exported as a [Node.js](https://nodejs.org/) module. ## Installation Using npm: - ```bash $ {sudo -H} npm i -g npm $ npm i --save lodash.pad ``` -In Node.js/io.js: - +In Node.js: ```js var pad = require('lodash.pad'); ``` -See the [documentation](https://lodash.com/docs#pad) or [package source](https://github.com/lodash/lodash/blob/3.1.1-npm-packages/lodash.pad) for more details. +See the [documentation](https://lodash.com/docs#pad) or [package source](https://github.com/lodash/lodash/blob/3.2.0-npm-packages/lodash.pad) for more details. diff --git a/lodash.pad/index.js b/lodash.pad/index.js index a29ccea9c..4a32b912c 100644 --- a/lodash.pad/index.js +++ b/lodash.pad/index.js @@ -1,18 +1,349 @@ /** - * lodash 3.1.1 (Custom Build) - * Build: `lodash modern modularize exports="npm" -o ./` - * Copyright 2012-2015 The Dojo Foundation + * lodash 3.2.0 (Custom Build) + * Build: `lodash modularize exports="npm" -o ./` + * Copyright 2012-2016 The Dojo Foundation * Based on Underscore.js 1.8.3 - * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors + * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors * Available under MIT license */ -var baseToString = require('lodash._basetostring'), - createPadding = require('lodash._createpadding'); +var repeat = require('lodash.repeat'); -/* Native method references for those with the same name as other `lodash` methods. */ +/** Used as references for various `Number` constants. */ +var INFINITY = 1 / 0, + MAX_INTEGER = 1.7976931348623157e+308, + NAN = 0 / 0; + +/** `Object#toString` result references. */ +var funcTag = '[object Function]', + genTag = '[object GeneratorFunction]', + symbolTag = '[object Symbol]'; + +/** Used to match leading and trailing whitespace. */ +var reTrim = /^\s+|\s+$/g; + +/** Used to detect bad signed hexadecimal string values. */ +var reIsBadHex = /^[-+]0x[0-9a-f]+$/i; + +/** Used to detect binary string values. */ +var reIsBinary = /^0b[01]+$/i; + +/** Used to detect octal string values. */ +var reIsOctal = /^0o[0-7]+$/i; + +/** Used to compose unicode character classes. */ +var rsAstralRange = '\\ud800-\\udfff', + rsComboRange = '\\u0300-\\u036f\\ufe20-\\ufe23', + rsVarRange = '\\ufe0e\\ufe0f'; + +/** Used to compose unicode capture groups. */ +var rsAstral = '[' + rsAstralRange + ']', + rsCombo = '[' + rsComboRange + ']', + rsModifier = '(?:\\ud83c[\\udffb-\\udfff])', + rsNonAstral = '[^' + rsAstralRange + ']', + rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}', + rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]', + rsZWJ = '\\u200d'; + +/** Used to compose unicode regexes. */ +var reOptMod = rsModifier + '?', + rsOptVar = '[' + rsVarRange + ']?', + rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*', + rsSeq = rsOptVar + reOptMod + rsOptJoin, + rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')'; + +/** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */ +var reComplexSymbol = RegExp(rsSymbol + rsSeq, 'g'); + +/** Used to detect strings with [zero-width joiners or code points from the astral planes](http://eev.ee/blog/2015/09/12/dark-corners-of-unicode/). */ +var reHasComplexSymbol = RegExp('[' + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + ']'); + +/** Built-in method references without a dependency on `global`. */ +var freeParseInt = parseInt; + +/** + * Gets the number of symbols in `string`. + * + * @param {string} string The string to inspect. + * @returns {number} Returns the string size. + */ +function stringSize(string) { + if (!(string && reHasComplexSymbol.test(string))) { + return string.length; + } + var result = reComplexSymbol.lastIndex = 0; + while (reComplexSymbol.test(string)) { + result++; + } + return result; +} + +/** + * Converts `string` to an array. + * + * @private + * @param {string} string The string to convert. + * @returns {Array} Returns the converted array. + */ +function stringToArray(string) { + return string.match(reComplexSymbol); +} + +/** Used for built-in method references. */ +var objectProto = global.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; + +/** Built-in value references. */ +var _Symbol = global.Symbol; + +/* Built-in method references for those with the same name as other `lodash` methods. */ var nativeCeil = Math.ceil, - nativeFloor = Math.floor, - nativeIsFinite = global.isFinite; + nativeFloor = Math.floor; + +/** Used to convert symbols to primitives and strings. */ +var symbolProto = _Symbol ? _Symbol.prototype : undefined, + symbolToString = _Symbol ? symbolProto.toString : undefined; + +/** + * Creates the padding for `string` based on `length`. The `chars` string + * is truncated if the number of characters exceeds `length`. + * + * @private + * @param {string} string The string to create padding for. + * @param {number} [length=0] The padding length. + * @param {string} [chars=' '] The string used as padding. + * @returns {string} Returns the padding for `string`. + */ +function createPadding(string, length, chars) { + length = toInteger(length); + + var strLength = stringSize(string); + if (!length || strLength >= length) { + return ''; + } + var padLength = length - strLength; + chars = chars === undefined ? ' ' : (chars + ''); + + var result = repeat(chars, nativeCeil(padLength / stringSize(chars))); + return reHasComplexSymbol.test(chars) + ? stringToArray(result).slice(0, padLength).join('') + : result.slice(0, padLength); +} + +/** + * Checks if `value` is classified as a `Function` object. + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. + * @example + * + * _.isFunction(_); + * // => true + * + * _.isFunction(/abc/); + * // => false + */ +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. + var tag = isObject(value) ? objectToString.call(value) : ''; + return tag == funcTag || tag == genTag; +} + +/** + * 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(_.noop); + * // => true + * + * _.isObject(null); + * // => 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'); +} + +/** + * Checks if `value` is object-like. A value is object-like if it's not `null` + * and has a `typeof` result of "object". + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is object-like, else `false`. + * @example + * + * _.isObjectLike({}); + * // => true + * + * _.isObjectLike([1, 2, 3]); + * // => true + * + * _.isObjectLike(_.noop); + * // => false + * + * _.isObjectLike(null); + * // => false + */ +function isObjectLike(value) { + return !!value && typeof value == 'object'; +} + +/** + * Checks if `value` is classified as a `Symbol` primitive or object. + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. + * @example + * + * _.isSymbol(Symbol.iterator); + * // => true + * + * _.isSymbol('abc'); + * // => false + */ +function isSymbol(value) { + return typeof value == 'symbol' || + (isObjectLike(value) && objectToString.call(value) == symbolTag); +} + +/** + * Converts `value` to an integer. + * + * **Note:** This function is loosely based on [`ToInteger`](http://www.ecma-international.org/ecma-262/6.0/#sec-tointeger). + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to convert. + * @returns {number} Returns the converted integer. + * @example + * + * _.toInteger(3); + * // => 3 + * + * _.toInteger(Number.MIN_VALUE); + * // => 0 + * + * _.toInteger(Infinity); + * // => 1.7976931348623157e+308 + * + * _.toInteger('3'); + * // => 3 + */ +function toInteger(value) { + if (!value) { + return value === 0 ? value : 0; + } + value = toNumber(value); + if (value === INFINITY || value === -INFINITY) { + var sign = (value < 0 ? -1 : 1); + return sign * MAX_INTEGER; + } + var remainder = value % 1; + return value === value ? (remainder ? value - remainder : value) : 0; +} + +/** + * Converts `value` to a number. + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to process. + * @returns {number} Returns the number. + * @example + * + * _.toNumber(3); + * // => 3 + * + * _.toNumber(Number.MIN_VALUE); + * // => 5e-324 + * + * _.toNumber(Infinity); + * // => Infinity + * + * _.toNumber('3'); + * // => 3 + */ +function toNumber(value) { + if (isObject(value)) { + var other = isFunction(value.valueOf) ? value.valueOf() : value; + value = isObject(other) ? (other + '') : other; + } + if (typeof value != 'string') { + return value === 0 ? value : +value; + } + value = value.replace(reTrim, ''); + var isBinary = reIsBinary.test(value); + return (isBinary || reIsOctal.test(value)) + ? freeParseInt(value.slice(2), isBinary ? 2 : 8) + : (reIsBadHex.test(value) ? NAN : +value); +} + +/** + * Converts `value` to a string if it's not one. An empty string is returned + * for `null` and `undefined` values. The sign of `-0` is preserved. + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to process. + * @returns {string} Returns the string. + * @example + * + * _.toString(null); + * // => '' + * + * _.toString(-0); + * // => '-0' + * + * _.toString([1, 2, 3]); + * // => '1,2,3' + */ +function toString(value) { + // Exit early for strings to avoid a performance hit in some environments. + if (typeof value == 'string') { + return value; + } + if (value == null) { + return ''; + } + if (isSymbol(value)) { + return _Symbol ? symbolToString.call(value) : ''; + } + var result = (value + ''); + return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result; +} /** * Pads `string` on the left and right sides if it's shorter than `length`. @@ -37,19 +368,18 @@ var nativeCeil = Math.ceil, * // => 'abc' */ function pad(string, length, chars) { - string = baseToString(string); - length = +length; + string = toString(string); + length = toInteger(length); - var strLength = string.length; - if (strLength >= length || !nativeIsFinite(length)) { + var strLength = stringSize(string); + if (!length || strLength >= length) { return string; } var mid = (length - strLength) / 2, leftLength = nativeFloor(mid), rightLength = nativeCeil(mid); - chars = createPadding('', rightLength, chars); - return chars.slice(0, leftLength) + string + chars; + return createPadding('', leftLength, chars) + string + createPadding('', rightLength, chars); } module.exports = pad; diff --git a/lodash.pad/package.json b/lodash.pad/package.json index 14413b8f0..d5b701d37 100644 --- a/lodash.pad/package.json +++ b/lodash.pad/package.json @@ -1,23 +1,20 @@ { "name": "lodash.pad", - "version": "3.1.1", - "description": "The modern build of lodash’s `_.pad` as a module.", + "version": "3.2.0", + "description": "The lodash method `_.pad` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", "license": "MIT", - "keywords": "lodash, lodash-modularized, stdlib, util", + "keywords": "lodash, lodash-modularized, stdlib, util, pad", "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", "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, "dependencies": { - "lodash._basetostring": "^3.0.0", - "lodash._createpadding": "^3.0.0" + "lodash.repeat": "^3.0.0" } } diff --git a/lodash.parseint/README.md b/lodash.parseint/README.md index eb2f7995e..65be29138 100644 --- a/lodash.parseint/README.md +++ b/lodash.parseint/README.md @@ -1,4 +1,4 @@ -# lodash.parseint v3.1.2 +# lodash.parseint v3.2.0 The [lodash](https://lodash.com/) method `_.parseInt` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var parseInt = require('lodash.parseint'); ``` -See the [documentation](https://lodash.com/docs#parseInt) or [package source](https://github.com/lodash/lodash/blob/3.1.2-npm-packages/lodash.parseint) for more details. +See the [documentation](https://lodash.com/docs#parseInt) or [package source](https://github.com/lodash/lodash/blob/3.2.0-npm-packages/lodash.parseint) for more details. diff --git a/lodash.parseint/index.js b/lodash.parseint/index.js index 3657bd5bd..c28371876 100644 --- a/lodash.parseint/index.js +++ b/lodash.parseint/index.js @@ -1,11 +1,12 @@ /** - * lodash 3.1.2 (Custom Build) + * lodash 3.2.0 (Custom Build) * Build: `lodash modularize exports="npm" -o ./` * Copyright 2012-2016 The Dojo Foundation * Based on Underscore.js 1.8.3 * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors * Available under MIT license */ +var root = require('lodash._root'); /** Used as references for various `Number` constants. */ var INFINITY = 1 / 0; @@ -19,49 +20,6 @@ var reTrim = /^\s+|\s+$/g; /** Used to detect hexadecimal string values. */ var reHasHexPrefix = /^0x/i; -/** 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 free variable `global` from Node.js. */ -var freeGlobal = checkGlobal(freeExports && freeModule && typeof global == 'object' && global); - -/** Detect free variable `self`. */ -var freeSelf = checkGlobal(objectTypes[typeof self] && self); - -/** Detect free variable `window`. */ -var freeWindow = checkGlobal(objectTypes[typeof window] && window); - -/** Detect `this` as the global object. */ -var thisGlobal = checkGlobal(objectTypes[typeof this] && this); - -/** - * Used as a reference to the global object. - * - * The `this` value is used if it's the global object to avoid Greasemonkey's - * restricted `window` object, otherwise the `window` object is used. - */ -var root = freeGlobal || ((freeWindow !== (thisGlobal && thisGlobal.window)) && freeWindow) || freeSelf || thisGlobal || Function('return this')(); - -/** - * Checks if `value` is a global object. - * - * @private - * @param {*} value The value to check. - * @returns {null|Object} Returns `value` if it's a global object, else `null`. - */ -function checkGlobal(value) { - return (value && value.Object === Object) ? value : null; -} - /** Used for built-in method references. */ var objectProto = Object.prototype; diff --git a/lodash.parseint/package.json b/lodash.parseint/package.json index f39401f3d..013f4b1df 100644 --- a/lodash.parseint/package.json +++ b/lodash.parseint/package.json @@ -1,6 +1,6 @@ { "name": "lodash.parseint", - "version": "3.1.2", + "version": "3.2.0", "description": "The lodash method `_.parseInt` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -13,5 +13,8 @@ "Mathias Bynens (https://mathiasbynens.be/)" ], "repository": "lodash/lodash", - "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" } + "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, + "dependencies": { + "lodash._root": "^3.0.0" + } } diff --git a/lodash.pullat/README.md b/lodash.pullat/README.md index 0a66e6864..f0a511c08 100644 --- a/lodash.pullat/README.md +++ b/lodash.pullat/README.md @@ -1,4 +1,4 @@ -# lodash.pullat v3.1.1 +# lodash.pullat v3.2.0 The [modern build](https://github.com/lodash/lodash/wiki/Build-Differences) of [lodash’s](https://lodash.com/) `_.pullAt` exported as a [Node.js](http://nodejs.org/)/[io.js](https://iojs.org/) module. @@ -17,4 +17,4 @@ In Node.js/io.js: var pullAt = require('lodash.pullat'); ``` -See the [documentation](https://lodash.com/docs#pullAt) or [package source](https://github.com/lodash/lodash/blob/3.1.1-npm-packages/lodash.pullat) for more details. +See the [documentation](https://lodash.com/docs#pullAt) or [package source](https://github.com/lodash/lodash/blob/3.2.0-npm-packages/lodash.pullat) for more details. diff --git a/lodash.pullat/index.js b/lodash.pullat/index.js index 59258d784..3175e6d89 100644 --- a/lodash.pullat/index.js +++ b/lodash.pullat/index.js @@ -1,5 +1,5 @@ /** - * lodash 3.1.1 (Custom Build) + * lodash 3.2.0 (Custom Build) * Build: `lodash modern modularize exports="npm" -o ./` * Copyright 2012-2015 The Dojo Foundation * Based on Underscore.js 1.8.3 @@ -9,55 +9,9 @@ var baseAt = require('lodash._baseat'), baseCompareAscending = require('lodash._basecompareascending'), baseFlatten = require('lodash._baseflatten'), + basePullAt = require('lodash._basepullat'), restParam = require('lodash.restparam'); -/** Used for native method references. */ -var arrayProto = Array.prototype; - -/** Native method references. */ -var splice = arrayProto.splice; - -/** - * 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; - -/** - * The base implementation of `_.pullAt` without support for individual - * index arguments and capturing the removed elements. - * - * @private - * @param {Array} array The array to modify. - * @param {number[]} indexes The indexes of elements to remove. - * @returns {Array} Returns `array`. - */ -function basePullAt(array, indexes) { - var length = indexes.length; - while (length--) { - var index = parseFloat(indexes[length]); - if (index != previous && isIndex(index)) { - var previous = index; - splice.call(array, index, 1); - } - } - return array; -} - -/** - * Checks if `value` is a valid array-like index. - * - * @private - * @param {*} value The value to check. - * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index. - * @returns {boolean} Returns `true` if `value` is a valid index, else `false`. - */ -function isIndex(value, length) { - value = +value; - length = length == null ? MAX_SAFE_INTEGER : length; - return value > -1 && value % 1 == 0 && value < length; -} - /** * Removes elements from `array` corresponding to the given indexes and returns * an array of the removed elements. Indexes may be specified as an array of @@ -84,7 +38,6 @@ function isIndex(value, length) { * // => [10, 20] */ var pullAt = restParam(function(array, indexes) { - array || (array = []); indexes = baseFlatten(indexes); var result = baseAt(array, indexes); diff --git a/lodash.pullat/package.json b/lodash.pullat/package.json index 3c370a05a..8b179d72f 100644 --- a/lodash.pullat/package.json +++ b/lodash.pullat/package.json @@ -1,6 +1,6 @@ { "name": "lodash.pullat", - "version": "3.1.1", + "version": "3.2.0", "description": "The modern build of lodash’s `_.pullAt` as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -20,6 +20,7 @@ "lodash._baseat": "^3.0.0", "lodash._basecompareascending": "^3.0.0", "lodash._baseflatten": "^3.0.0", + "lodash._basepullat": "^3.0.0", "lodash.restparam": "^3.0.0" } } diff --git a/lodash.random/README.md b/lodash.random/README.md index 0106b54a0..317c44591 100644 --- a/lodash.random/README.md +++ b/lodash.random/README.md @@ -1,4 +1,4 @@ -# lodash.random v3.1.7 +# lodash.random v3.2.0 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.7-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.2.0-npm-packages/lodash.random) for more details. diff --git a/lodash.random/index.js b/lodash.random/index.js index 1c1de6bb9..dc4d6654d 100644 --- a/lodash.random/index.js +++ b/lodash.random/index.js @@ -37,25 +37,12 @@ var reIsUint = /^(?:0|[1-9]\d*)$/; var freeParseFloat = parseFloat, freeParseInt = parseInt; -/** - * 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 accessor function. - */ -function baseProperty(key) { - return function(object) { - return object == null ? undefined : object[key]; - }; -} - /** 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) + * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) * of values. */ var objectToString = objectProto.toString; @@ -78,19 +65,6 @@ function baseRandom(lower, upper) { return lower + nativeFloor(nativeRandom() * (upper - lower + 1)); } -/** - * 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 a valid array-like index. * @@ -132,7 +106,7 @@ function isIterateeCall(value, index, object) { /** * Performs a - * [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) + * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) * comparison between two values to determine if they are equivalent. * * @static @@ -192,7 +166,7 @@ function eq(value, other) { * // => false */ function isArrayLike(value) { - return value != null && isLength(getLength(value)) && !isFunction(value); + return value != null && isLength(value.length) && !isFunction(value); } /** @@ -214,8 +188,7 @@ 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 and weak map constructors, - // and PhantomJS 1.9 which returns 'function' for `NodeList` instances. + // in Safari 8-9 which returns 'object' for typed array and other constructors. var tag = isObject(value) ? objectToString.call(value) : ''; return tag == funcTag || tag == genTag; } @@ -223,16 +196,15 @@ function isFunction(value) { /** * Checks if `value` is a valid array-like length. * - * **Note:** This function is loosely based on - * [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength). + * **Note:** This method is loosely based on + * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength). * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a valid length, - * else `false`. + * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. * @example * * _.isLength(3); @@ -254,7 +226,7 @@ function isLength(value) { /** * Checks if `value` is the - * [language type](http://www.ecma-international.org/ecma-262/6.0/#sec-ecmascript-language-types) + * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types) * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) * * @static @@ -398,7 +370,7 @@ function toNumber(value) { return NAN; } if (isObject(value)) { - var other = isFunction(value.valueOf) ? value.valueOf() : value; + var other = typeof value.valueOf == 'function' ? value.valueOf() : value; value = isObject(other) ? (other + '') : other; } if (typeof value != 'string') { diff --git a/lodash.random/package.json b/lodash.random/package.json index 51d6f6d71..eaf9c214b 100644 --- a/lodash.random/package.json +++ b/lodash.random/package.json @@ -1,6 +1,6 @@ { "name": "lodash.random", - "version": "3.1.7", + "version": "3.2.0", "description": "The lodash method `_.random` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", diff --git a/lodash.range/README.md b/lodash.range/README.md index de1691f02..3296f292b 100644 --- a/lodash.range/README.md +++ b/lodash.range/README.md @@ -1,4 +1,4 @@ -# lodash.range v3.1.7 +# lodash.range v3.2.0 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.7-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.2.0-npm-packages/lodash.range) for more details. diff --git a/lodash.range/index.js b/lodash.range/index.js index 83a7c770b..af4f2ffe0 100644 --- a/lodash.range/index.js +++ b/lodash.range/index.js @@ -36,25 +36,12 @@ var reIsUint = /^(?:0|[1-9]\d*)$/; /** Built-in method references without a dependency on `root`. */ var freeParseInt = parseInt; -/** - * 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 accessor function. - */ -function baseProperty(key) { - return function(object) { - return object == null ? undefined : object[key]; - }; -} - /** 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) + * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) * of values. */ var objectToString = objectProto.toString; @@ -111,19 +98,6 @@ function createRange(fromRight) { }; } -/** - * 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 a valid array-like index. * @@ -165,7 +139,7 @@ function isIterateeCall(value, index, object) { /** * Performs a - * [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) + * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) * comparison between two values to determine if they are equivalent. * * @static @@ -225,7 +199,7 @@ function eq(value, other) { * // => false */ function isArrayLike(value) { - return value != null && isLength(getLength(value)) && !isFunction(value); + return value != null && isLength(value.length) && !isFunction(value); } /** @@ -247,8 +221,7 @@ 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 and weak map constructors, - // and PhantomJS 1.9 which returns 'function' for `NodeList` instances. + // in Safari 8-9 which returns 'object' for typed array and other constructors. var tag = isObject(value) ? objectToString.call(value) : ''; return tag == funcTag || tag == genTag; } @@ -256,16 +229,15 @@ function isFunction(value) { /** * Checks if `value` is a valid array-like length. * - * **Note:** This function is loosely based on - * [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength). + * **Note:** This method is loosely based on + * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength). * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a valid length, - * else `false`. + * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. * @example * * _.isLength(3); @@ -287,7 +259,7 @@ function isLength(value) { /** * Checks if `value` is the - * [language type](http://www.ecma-international.org/ecma-262/6.0/#sec-ecmascript-language-types) + * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types) * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) * * @static @@ -431,7 +403,7 @@ function toNumber(value) { return NAN; } if (isObject(value)) { - var other = isFunction(value.valueOf) ? value.valueOf() : value; + var other = typeof value.valueOf == 'function' ? value.valueOf() : value; value = isObject(other) ? (other + '') : other; } if (typeof value != 'string') { diff --git a/lodash.range/package.json b/lodash.range/package.json index 1d7c45eb7..afa4513ea 100644 --- a/lodash.range/package.json +++ b/lodash.range/package.json @@ -1,6 +1,6 @@ { "name": "lodash.range", - "version": "3.1.7", + "version": "3.2.0", "description": "The lodash method `_.range` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", diff --git a/lodash.repeat/README.md b/lodash.repeat/README.md index a18ab4140..740d58539 100644 --- a/lodash.repeat/README.md +++ b/lodash.repeat/README.md @@ -1,4 +1,4 @@ -# lodash.repeat v3.1.2 +# lodash.repeat v3.2.0 The [lodash](https://lodash.com/) method `_.repeat` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var repeat = require('lodash.repeat'); ``` -See the [documentation](https://lodash.com/docs#repeat) or [package source](https://github.com/lodash/lodash/blob/3.1.2-npm-packages/lodash.repeat) for more details. +See the [documentation](https://lodash.com/docs#repeat) or [package source](https://github.com/lodash/lodash/blob/3.2.0-npm-packages/lodash.repeat) for more details. diff --git a/lodash.repeat/index.js b/lodash.repeat/index.js index f84e2a7f9..d2b8bab59 100644 --- a/lodash.repeat/index.js +++ b/lodash.repeat/index.js @@ -1,11 +1,12 @@ /** - * lodash 3.1.2 (Custom Build) + * lodash 3.2.0 (Custom Build) * Build: `lodash modularize exports="npm" -o ./` * Copyright 2012-2016 The Dojo Foundation * Based on Underscore.js 1.8.3 * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors * Available under MIT license */ +var root = require('lodash._root'); /** Used as references for various `Number` constants. */ var INFINITY = 1 / 0, @@ -30,52 +31,9 @@ var reIsBinary = /^0b[01]+$/i; /** Used to detect octal string values. */ var reIsOctal = /^0o[0-7]+$/i; -/** Used to determine if values are of the language type `Object`. */ -var objectTypes = { - 'function': true, - 'object': true -}; - /** Built-in method references without a dependency on `root`. */ var freeParseInt = parseInt; -/** 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 free variable `global` from Node.js. */ -var freeGlobal = checkGlobal(freeExports && freeModule && typeof global == 'object' && global); - -/** Detect free variable `self`. */ -var freeSelf = checkGlobal(objectTypes[typeof self] && self); - -/** Detect free variable `window`. */ -var freeWindow = checkGlobal(objectTypes[typeof window] && window); - -/** Detect `this` as the global object. */ -var thisGlobal = checkGlobal(objectTypes[typeof this] && this); - -/** - * Used as a reference to the global object. - * - * The `this` value is used if it's the global object to avoid Greasemonkey's - * restricted `window` object, otherwise the `window` object is used. - */ -var root = freeGlobal || ((freeWindow !== (thisGlobal && thisGlobal.window)) && freeWindow) || freeSelf || thisGlobal || Function('return this')(); - -/** - * Checks if `value` is a global object. - * - * @private - * @param {*} value The value to check. - * @returns {null|Object} Returns `value` if it's a global object, else `null`. - */ -function checkGlobal(value) { - return (value && value.Object === Object) ? value : null; -} - /** Used for built-in method references. */ var objectProto = Object.prototype; diff --git a/lodash.repeat/package.json b/lodash.repeat/package.json index b8f0c16a1..c822ed846 100644 --- a/lodash.repeat/package.json +++ b/lodash.repeat/package.json @@ -1,6 +1,6 @@ { "name": "lodash.repeat", - "version": "3.1.2", + "version": "3.2.0", "description": "The lodash method `_.repeat` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -13,5 +13,8 @@ "Mathias Bynens (https://mathiasbynens.be/)" ], "repository": "lodash/lodash", - "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" } + "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, + "dependencies": { + "lodash._root": "^3.0.0" + } } diff --git a/lodash.some/README.md b/lodash.some/README.md index b2770d155..732b55f4d 100644 --- a/lodash.some/README.md +++ b/lodash.some/README.md @@ -1,4 +1,4 @@ -# lodash.some v3.1.0 +# lodash.some v3.2.0 The [modern build](https://github.com/lodash/lodash/wiki/Build-Differences) of [lodash’s](https://lodash.com/) `_.some` exported as a [Node.js](http://nodejs.org/)/[io.js](https://iojs.org/) module. @@ -17,4 +17,4 @@ In Node.js/io.js: var some = require('lodash.some'); ``` -See the [documentation](https://lodash.com/docs#some) or [package source](https://github.com/lodash/lodash/blob/3.1.0-npm-packages/lodash.some) for more details. +See the [documentation](https://lodash.com/docs#some) or [package source](https://github.com/lodash/lodash/blob/3.2.0-npm-packages/lodash.some) for more details. diff --git a/lodash.some/index.js b/lodash.some/index.js index 5960ac469..55793e517 100644 --- a/lodash.some/index.js +++ b/lodash.some/index.js @@ -1,5 +1,5 @@ /** - * lodash 3.1.0 (Custom Build) + * lodash 3.2.0 (Custom Build) * Build: `lodash modern modularize exports="npm" -o ./` * Copyright 2012-2015 The Dojo Foundation * Based on Underscore.js 1.8.2 @@ -9,7 +9,8 @@ var baseCallback = require('lodash._basecallback'), baseEach = require('lodash._baseeach'), isIterateeCall = require('lodash._isiterateecall'), - isArray = require('lodash.isarray'); + isArray = require('lodash.isarray'), + keys = require('lodash.keys'); /** * A specialized version of `_.some` for arrays without support for callback diff --git a/lodash.some/package.json b/lodash.some/package.json index a7b6f0c00..4fbb2c3bc 100644 --- a/lodash.some/package.json +++ b/lodash.some/package.json @@ -1,6 +1,6 @@ { "name": "lodash.some", - "version": "3.1.0", + "version": "3.2.0", "description": "The modern build of lodash’s `_.some` as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -20,6 +20,7 @@ "lodash._basecallback": "^3.0.0", "lodash._baseeach": "^3.0.0", "lodash._isiterateecall": "^3.0.0", - "lodash.isarray": "^3.0.0" + "lodash.isarray": "^3.0.0", + "lodash.keys": "^3.0.0" } } diff --git a/lodash.sortbyall/README.md b/lodash.sortbyall/README.md index a24885a3f..bd02f6cf4 100644 --- a/lodash.sortbyall/README.md +++ b/lodash.sortbyall/README.md @@ -1,4 +1,4 @@ -# lodash.sortbyall v3.1.1 +# lodash.sortbyall v3.2.0 The [modern build](https://github.com/lodash/lodash/wiki/Build-Differences) of [lodash’s](https://lodash.com/) `_.sortByAll` exported as a [Node.js](http://nodejs.org/)/[io.js](https://iojs.org/) module. @@ -17,4 +17,4 @@ In Node.js/io.js: var sortByAll = require('lodash.sortbyall'); ``` -See the [documentation](https://lodash.com/docs#sortByAll) or [package source](https://github.com/lodash/lodash/blob/3.1.1-npm-packages/lodash.sortbyall) for more details. +See the [documentation](https://lodash.com/docs#sortByAll) or [package source](https://github.com/lodash/lodash/blob/3.2.0-npm-packages/lodash.sortbyall) for more details. diff --git a/lodash.sortbyall/index.js b/lodash.sortbyall/index.js index 8b9ec32c1..82c0a3aab 100644 --- a/lodash.sortbyall/index.js +++ b/lodash.sortbyall/index.js @@ -1,8 +1,8 @@ /** - * lodash 3.1.1 (Custom Build) + * lodash 3.2.0 (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 */ @@ -11,49 +11,53 @@ var baseEach = require('lodash._baseeach'), baseSortByOrder = require('lodash._basesortbyorder'), isIterateeCall = require('lodash._isiterateecall'), isArguments = require('lodash.isarguments'), - isArray = require('lodash.isarray'); + isArray = require('lodash.isarray'), + restParam = require('lodash.restparam'); /** - * This method is like `_.sortBy` except that it sorts by property names - * instead of an iteratee function. + * This method is like `_.sortBy` except that it can sort by multiple iteratees + * or property names. + * + * If a property name is provided for an iteratee the created `_.property` + * style callback returns the property value of the given element. + * + * If an object is provided for an iteratee the created `_.matches` style + * callback returns `true` for elements that have the properties of the given + * object, else `false`. * * @static * @memberOf _ * @category Collection * @param {Array|Object|string} collection The collection to iterate over. - * @param {...(string|string[])} props The property names to sort by, - * specified as individual property names or arrays of property names. + * @param {...(Function|Function[]|Object|Object[]|string|string[])} iteratees + * The iteratees to sort by, specified as individual values or arrays of values. * @returns {Array} Returns the new sorted array. * @example * * var users = [ + * { 'user': 'fred', 'age': 48 }, * { 'user': 'barney', 'age': 36 }, - * { 'user': 'fred', 'age': 40 }, - * { 'user': 'barney', 'age': 26 }, - * { 'user': 'fred', 'age': 30 } + * { 'user': 'fred', 'age': 42 }, + * { 'user': 'barney', 'age': 34 } * ]; * * _.map(_.sortByAll(users, ['user', 'age']), _.values); - * // => [['barney', 26], ['barney', 36], ['fred', 30], ['fred', 40]] + * // => [['barney', 34], ['barney', 36], ['fred', 42], ['fred', 48]] + * + * _.map(_.sortByAll(users, 'user', function(chr) { + * return Math.floor(chr.age / 10); + * }), _.values); + * // => [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 42]] */ -function sortByAll() { - var args = arguments, - collection = args[0], - guard = args[3], - index = 0, - length = args.length - 1; - +var sortByAll = restParam(function(collection, iteratees) { if (collection == null) { return []; } - var props = Array(length); - while (index < length) { - props[index] = args[++index]; + var guard = iteratees[2]; + if (guard && isIterateeCall(iteratees[0], iteratees[1], guard)) { + iteratees.length = 1; } - if (guard && isIterateeCall(args[1], args[2], guard)) { - props = args[1]; - } - return baseSortByOrder(collection, baseFlatten(props), []); -} + return baseSortByOrder(collection, baseFlatten(iteratees), []); +}); module.exports = sortByAll; diff --git a/lodash.sortbyall/package.json b/lodash.sortbyall/package.json index 99b054723..77eaad44c 100644 --- a/lodash.sortbyall/package.json +++ b/lodash.sortbyall/package.json @@ -1,6 +1,6 @@ { "name": "lodash.sortbyall", - "version": "3.1.1", + "version": "3.2.0", "description": "The modern build of lodash’s `_.sortByAll` as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -22,6 +22,7 @@ "lodash._basesortbyorder": "^3.0.0", "lodash._isiterateecall": "^3.0.0", "lodash.isarguments": "^3.0.0", - "lodash.isarray": "^3.0.0" + "lodash.isarray": "^3.0.0", + "lodash.restparam": "^3.0.0" } } diff --git a/lodash.spread/LICENSE.txt b/lodash.spread/LICENSE.txt new file mode 100644 index 000000000..17764328c --- /dev/null +++ b/lodash.spread/LICENSE.txt @@ -0,0 +1,22 @@ +Copyright 2012-2015 The Dojo Foundation +Based on Underscore.js 1.7.0, copyright 2009-2015 Jeremy Ashkenas, +DocumentCloud and Investigative Reporters & Editors + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/lodash.spread/README.md b/lodash.spread/README.md new file mode 100644 index 000000000..d2928cf39 --- /dev/null +++ b/lodash.spread/README.md @@ -0,0 +1,20 @@ +# lodash.spread v3.2.0 + +The [modern build](https://github.com/lodash/lodash/wiki/Build-Differences) of [lodash’s](https://lodash.com/) `_.spread` exported as a [Node.js](http://nodejs.org/)/[io.js](https://iojs.org/) module. + +## Installation + +Using npm: + +```bash +$ {sudo -H} npm i -g npm +$ npm i --save lodash.spread +``` + +In Node.js/io.js: + +```js +var spread = require('lodash.spread'); +``` + +See the [documentation](https://lodash.com/docs#spread) or [package source](https://github.com/lodash/lodash/blob/3.2.0-npm-packages/lodash.spread) for more details. diff --git a/lodash.spread/index.js b/lodash.spread/index.js new file mode 100644 index 000000000..43b1ce959 --- /dev/null +++ b/lodash.spread/index.js @@ -0,0 +1,53 @@ +/** + * lodash 3.2.0 (Custom Build) + * Build: `lodash modern modularize exports="npm" -o ./` + * Copyright 2012-2015 The Dojo Foundation + * Based on Underscore.js 1.7.0 + * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors + * Available under MIT license + */ + +/** Used as the `TypeError` message for "Functions" methods. */ +var FUNC_ERROR_TEXT = 'Expected a function'; + +/** + * Creates a function that invokes `func` with the `this` binding of the created + * function and an array of arguments much like [`Function#apply`](https://es5.github.io/#x15.3.4.3). + * + * **Note:** This method is based on the [spread operator](https://developer.mozilla.org/Web/JavaScript/Reference/Operators/Spread_operator). + * + * @static + * @memberOf _ + * @category Function + * @param {Function} func The function to spread arguments over. + * @returns {Function} Returns the new function. + * @example + * + * var say = _.spread(function(who, what) { + * return who + ' says ' + what; + * }); + * + * say(['fred', 'hello']); + * // => 'fred says hello' + * + * // with a Promise + * var numbers = Promise.all([ + * Promise.resolve(40), + * Promise.resolve(36) + * ]); + * + * numbers.then(_.spread(function(x, y) { + * return x + y; + * })); + * // => a Promise of 76 + */ +function spread(func) { + if (typeof func != 'function') { + throw new TypeError(FUNC_ERROR_TEXT); + } + return function(array) { + return func.apply(this, array); + }; +} + +module.exports = spread; diff --git a/lodash.spread/package.json b/lodash.spread/package.json new file mode 100644 index 000000000..9a2b845a4 --- /dev/null +++ b/lodash.spread/package.json @@ -0,0 +1,19 @@ +{ + "name": "lodash.spread", + "version": "3.2.0", + "description": "The modern build of lodash’s `_.spread` 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/)", + "Mathias Bynens (https://mathiasbynens.be/)" + ], + "repository": "lodash/lodash", + "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" } +} diff --git a/lodash.startswith/README.md b/lodash.startswith/README.md index f3fdac04d..76e478df7 100644 --- a/lodash.startswith/README.md +++ b/lodash.startswith/README.md @@ -1,4 +1,4 @@ -# lodash.startswith v3.1.2 +# lodash.startswith v3.2.0 The [lodash](https://lodash.com/) method `_.startsWith` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var startsWith = require('lodash.startswith'); ``` -See the [documentation](https://lodash.com/docs#startsWith) or [package source](https://github.com/lodash/lodash/blob/3.1.2-npm-packages/lodash.startswith) for more details. +See the [documentation](https://lodash.com/docs#startsWith) or [package source](https://github.com/lodash/lodash/blob/3.2.0-npm-packages/lodash.startswith) for more details. diff --git a/lodash.startswith/index.js b/lodash.startswith/index.js index 830b30041..5b4a632f4 100644 --- a/lodash.startswith/index.js +++ b/lodash.startswith/index.js @@ -1,11 +1,12 @@ /** - * lodash 3.1.2 (Custom Build) + * lodash 3.2.0 (Custom Build) * Build: `lodash modularize exports="npm" -o ./` * Copyright 2012-2016 The Dojo Foundation * Based on Underscore.js 1.8.3 * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors * Available under MIT license */ +var root = require('lodash._root'); /** Used as references for various `Number` constants. */ var INFINITY = 1 / 0, @@ -29,52 +30,9 @@ var reIsBinary = /^0b[01]+$/i; /** Used to detect octal string values. */ var reIsOctal = /^0o[0-7]+$/i; -/** Used to determine if values are of the language type `Object`. */ -var objectTypes = { - 'function': true, - 'object': true -}; - /** Built-in method references without a dependency on `root`. */ var freeParseInt = parseInt; -/** 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 free variable `global` from Node.js. */ -var freeGlobal = checkGlobal(freeExports && freeModule && typeof global == 'object' && global); - -/** Detect free variable `self`. */ -var freeSelf = checkGlobal(objectTypes[typeof self] && self); - -/** Detect free variable `window`. */ -var freeWindow = checkGlobal(objectTypes[typeof window] && window); - -/** Detect `this` as the global object. */ -var thisGlobal = checkGlobal(objectTypes[typeof this] && this); - -/** - * Used as a reference to the global object. - * - * The `this` value is used if it's the global object to avoid Greasemonkey's - * restricted `window` object, otherwise the `window` object is used. - */ -var root = freeGlobal || ((freeWindow !== (thisGlobal && thisGlobal.window)) && freeWindow) || freeSelf || thisGlobal || Function('return this')(); - -/** - * Checks if `value` is a global object. - * - * @private - * @param {*} value The value to check. - * @returns {null|Object} Returns `value` if it's a global object, else `null`. - */ -function checkGlobal(value) { - return (value && value.Object === Object) ? value : null; -} - /** Used for built-in method references. */ var objectProto = Object.prototype; diff --git a/lodash.startswith/package.json b/lodash.startswith/package.json index 0da6aefa4..e0f16fd79 100644 --- a/lodash.startswith/package.json +++ b/lodash.startswith/package.json @@ -1,6 +1,6 @@ { "name": "lodash.startswith", - "version": "3.1.2", + "version": "3.2.0", "description": "The lodash method `_.startsWith` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -13,5 +13,8 @@ "Mathias Bynens (https://mathiasbynens.be/)" ], "repository": "lodash/lodash", - "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" } + "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, + "dependencies": { + "lodash._root": "^3.0.0" + } } diff --git a/lodash.template/README.md b/lodash.template/README.md index 9dabe1f76..9b33f5d7b 100644 --- a/lodash.template/README.md +++ b/lodash.template/README.md @@ -1,4 +1,4 @@ -# lodash.template v3.0.1 +# lodash.template v3.2.0 The [modern build](https://github.com/lodash/lodash/wiki/Build-Differences) of [lodash’s](https://lodash.com/) `_.template` exported as a [Node.js](http://nodejs.org/)/[io.js](https://iojs.org/) module. @@ -17,4 +17,4 @@ In Node.js/io.js: var template = require('lodash.template'); ``` -See the [documentation](https://lodash.com/docs#template) or [package source](https://github.com/lodash/lodash/blob/3.0.1-npm-packages/lodash.template) for more details. +See the [documentation](https://lodash.com/docs#template) or [package source](https://github.com/lodash/lodash/blob/3.2.0-npm-packages/lodash.template) for more details. diff --git a/lodash.template/index.js b/lodash.template/index.js index cc90c6a81..b01fe6796 100644 --- a/lodash.template/index.js +++ b/lodash.template/index.js @@ -1,5 +1,5 @@ /** - * lodash 3.0.1 (Custom Build) + * lodash 3.2.0 (Custom Build) * Build: `lodash modern modularize exports="npm" -o ./` * Copyright 2012-2015 The Dojo Foundation * Based on Underscore.js 1.7.0 @@ -7,14 +7,16 @@ * Available under MIT license */ var baseCopy = require('lodash._basecopy'), - baseToString = require('lodash._basetostring'), + baseSlice = require('lodash._baseslice'), baseValues = require('lodash._basevalues'), isIterateeCall = require('lodash._isiterateecall'), reInterpolate = require('lodash._reinterpolate'), - isError = require('lodash.iserror'), keys = require('lodash.keys'), templateSettings = require('lodash.templatesettings'); +/** `Object#toString` result references. */ +var errorTag = '[object Error]'; + /** Used to match empty string literals in compiled template source. */ var reEmptyStringLeading = /\b__p \+= '';/g, reEmptyStringMiddle = /\b(__p \+=) '' \+/g, @@ -43,6 +45,21 @@ var stringEscapes = { '\u2029': 'u2029' }; +/** + * Converts `value` to a string if it is not one. An empty string is returned + * for `null` or `undefined` values. + * + * @private + * @param {*} value The value to process. + * @returns {string} Returns the string. + */ +function baseToString(value) { + if (typeof value == 'string') { + return value; + } + return value == null ? '' : (value + ''); +} + /** * Used by `_.template` to escape characters for inclusion in compiled * string literals. @@ -55,12 +72,30 @@ function escapeStringChar(chr) { return '\\' + stringEscapes[chr]; } +/** + * Checks if `value` is object-like. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is object-like, else `false`. + */ +function isObjectLike(value) { + return (value && typeof value == 'object') || false; +} + /** Used for native method references. */ var objectProto = Object.prototype; /** Used to check objects for own properties. */ var hasOwnProperty = objectProto.hasOwnProperty; +/** + * Used to resolve the `toStringTag` of values. + * See the [ES spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.prototype.tostring) + * for more details. + */ +var objToString = objectProto.toString; + /** * Used by `_.template` to customize its `_.assign` use. * @@ -96,7 +131,7 @@ function baseAssign(object, source, customizer) { return baseCopy(source, object, props); } var index = -1, - length = props.length + length = props.length; while (++index < length) { var key = props[index], @@ -111,6 +146,27 @@ function baseAssign(object, source, customizer) { return object; } +/** + * Checks if `value` is an `Error`, `EvalError`, `RangeError`, `ReferenceError`, + * `SyntaxError`, `TypeError`, or `URIError` object. + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an error object, else `false`. + * @example + * + * _.isError(new Error); + * // => true + * + * _.isError(Error); + * // => false + */ +function isError(value) { + return (isObjectLike(value) && typeof value.message == 'string' && objToString.call(value) == errorTag) || false; +} + /** * Creates a compiled template function that can interpolate data properties * in "interpolate" delimiters, HTML-escape interpolated data properties in @@ -310,8 +366,8 @@ function template(string, options, otherOptions) { } /** - * Attempts to invoke `func`, returning either the result or the caught - * error object. + * Attempts to invoke `func`, returning either the result or the caught error + * object. Any additional arguments are provided to `func` when it is invoked. * * @static * @memberOf _ @@ -321,9 +377,9 @@ function template(string, options, otherOptions) { * @example * * // avoid throwing errors for invalid selectors - * var elements = _.attempt(function() { + * var elements = _.attempt(function(selector) { * return document.querySelectorAll(selector); - * }); + * }, '>_>'); * * if (_.isError(elements)) { * elements = []; @@ -331,9 +387,9 @@ function template(string, options, otherOptions) { */ function attempt(func) { try { - return func(); + return func.apply(undefined, baseSlice(arguments, 1)); } catch(e) { - return isError(e) ? e : Error(e); + return isError(e) ? e : new Error(e); } } diff --git a/lodash.template/package.json b/lodash.template/package.json index 3ffdd5593..c5692f1a1 100644 --- a/lodash.template/package.json +++ b/lodash.template/package.json @@ -1,6 +1,6 @@ { "name": "lodash.template", - "version": "3.0.1", + "version": "3.2.0", "description": "The modern build of lodash’s `_.template` as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -18,11 +18,10 @@ "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, "dependencies": { "lodash._basecopy": "^3.0.0", - "lodash._basetostring": "^3.0.0", + "lodash._baseslice": "^3.0.0", "lodash._basevalues": "^3.0.0", "lodash._isiterateecall": "^3.0.0", "lodash._reinterpolate": "^3.0.0", - "lodash.iserror": "^3.0.0", "lodash.keys": "^3.0.0", "lodash.templatesettings": "^3.0.0" } diff --git a/lodash.unescape/README.md b/lodash.unescape/README.md index 271b410a4..411d4c543 100644 --- a/lodash.unescape/README.md +++ b/lodash.unescape/README.md @@ -1,4 +1,4 @@ -# lodash.unescape v3.1.2 +# lodash.unescape v3.2.0 The [lodash](https://lodash.com/) method `_.unescape` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var unescape = require('lodash.unescape'); ``` -See the [documentation](https://lodash.com/docs#unescape) or [package source](https://github.com/lodash/lodash/blob/3.1.2-npm-packages/lodash.unescape) for more details. +See the [documentation](https://lodash.com/docs#unescape) or [package source](https://github.com/lodash/lodash/blob/3.2.0-npm-packages/lodash.unescape) for more details. diff --git a/lodash.unescape/index.js b/lodash.unescape/index.js index 08923e666..82195abc5 100644 --- a/lodash.unescape/index.js +++ b/lodash.unescape/index.js @@ -1,11 +1,12 @@ /** - * lodash 3.1.2 (Custom Build) + * lodash 3.2.0 (Custom Build) * Build: `lodash modularize exports="npm" -o ./` * Copyright 2012-2016 The Dojo Foundation * Based on Underscore.js 1.8.3 * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors * Available under MIT license */ +var root = require('lodash._root'); /** Used as references for various `Number` constants. */ var INFINITY = 1 / 0; @@ -27,49 +28,6 @@ var htmlUnescapes = { '`': '`' }; -/** 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 free variable `global` from Node.js. */ -var freeGlobal = checkGlobal(freeExports && freeModule && typeof global == 'object' && global); - -/** Detect free variable `self`. */ -var freeSelf = checkGlobal(objectTypes[typeof self] && self); - -/** Detect free variable `window`. */ -var freeWindow = checkGlobal(objectTypes[typeof window] && window); - -/** Detect `this` as the global object. */ -var thisGlobal = checkGlobal(objectTypes[typeof this] && this); - -/** - * Used as a reference to the global object. - * - * The `this` value is used if it's the global object to avoid Greasemonkey's - * restricted `window` object, otherwise the `window` object is used. - */ -var root = freeGlobal || ((freeWindow !== (thisGlobal && thisGlobal.window)) && freeWindow) || freeSelf || thisGlobal || Function('return this')(); - -/** - * Checks if `value` is a global object. - * - * @private - * @param {*} value The value to check. - * @returns {null|Object} Returns `value` if it's a global object, else `null`. - */ -function checkGlobal(value) { - return (value && value.Object === Object) ? value : null; -} - /** * Used by `_.unescape` to convert HTML entities to characters. * diff --git a/lodash.unescape/package.json b/lodash.unescape/package.json index 14affe70d..f55474dc0 100644 --- a/lodash.unescape/package.json +++ b/lodash.unescape/package.json @@ -1,6 +1,6 @@ { "name": "lodash.unescape", - "version": "3.1.2", + "version": "3.2.0", "description": "The lodash method `_.unescape` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -13,5 +13,8 @@ "Mathias Bynens (https://mathiasbynens.be/)" ], "repository": "lodash/lodash", - "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" } + "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, + "dependencies": { + "lodash._root": "^3.0.0" + } } diff --git a/lodash.uniq/README.md b/lodash.uniq/README.md index 17ec3147a..199b34099 100644 --- a/lodash.uniq/README.md +++ b/lodash.uniq/README.md @@ -1,4 +1,4 @@ -# lodash.uniq v3.1.0 +# lodash.uniq v3.2.0 The [modern build](https://github.com/lodash/lodash/wiki/Build-Differences) of [lodash’s](https://lodash.com/) `_.uniq` exported as a [Node.js](http://nodejs.org/)/[io.js](https://iojs.org/) module. @@ -17,4 +17,4 @@ In Node.js/io.js: var uniq = require('lodash.uniq'); ``` -See the [documentation](https://lodash.com/docs#uniq) or [package source](https://github.com/lodash/lodash/blob/3.1.0-npm-packages/lodash.uniq) for more details. +See the [documentation](https://lodash.com/docs#uniq) or [package source](https://github.com/lodash/lodash/blob/3.2.0-npm-packages/lodash.uniq) for more details. diff --git a/lodash.uniq/index.js b/lodash.uniq/index.js index 94e453e21..6f7d73551 100644 --- a/lodash.uniq/index.js +++ b/lodash.uniq/index.js @@ -1,16 +1,16 @@ /** - * lodash 3.1.0 (Custom Build) + * lodash 3.2.0 (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 */ var baseCallback = require('lodash._basecallback'), baseUniq = require('lodash._baseuniq'), + getNative = require('lodash._getnative'), isIterateeCall = require('lodash._isiterateecall'), - isArray = require('lodash.isarray'), - isNative = require('lodash.isnative'); + isArray = require('lodash.isarray'); /** * An implementation of `_.uniq` optimized for sorted arrays without support diff --git a/lodash.uniq/package.json b/lodash.uniq/package.json index e81f4a8db..5b2826c56 100644 --- a/lodash.uniq/package.json +++ b/lodash.uniq/package.json @@ -1,6 +1,6 @@ { "name": "lodash.uniq", - "version": "3.1.0", + "version": "3.2.0", "description": "The modern build of lodash’s `_.uniq` as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -19,8 +19,8 @@ "dependencies": { "lodash._basecallback": "^3.0.0", "lodash._baseuniq": "^3.0.0", + "lodash._getnative": "^3.0.0", "lodash._isiterateecall": "^3.0.0", - "lodash.isarray": "^3.0.0", - "lodash.isnative": "^3.0.0" + "lodash.isarray": "^3.0.0" } } diff --git a/lodash.uniqueid/README.md b/lodash.uniqueid/README.md index 9dc850e6b..5046066e7 100644 --- a/lodash.uniqueid/README.md +++ b/lodash.uniqueid/README.md @@ -1,4 +1,4 @@ -# lodash.uniqueid v3.1.2 +# lodash.uniqueid v3.2.0 The [lodash](https://lodash.com/) method `_.uniqueId` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var uniqueId = require('lodash.uniqueid'); ``` -See the [documentation](https://lodash.com/docs#uniqueId) or [package source](https://github.com/lodash/lodash/blob/3.1.2-npm-packages/lodash.uniqueid) for more details. +See the [documentation](https://lodash.com/docs#uniqueId) or [package source](https://github.com/lodash/lodash/blob/3.2.0-npm-packages/lodash.uniqueid) for more details. diff --git a/lodash.uniqueid/index.js b/lodash.uniqueid/index.js index 435095347..9be14d48c 100644 --- a/lodash.uniqueid/index.js +++ b/lodash.uniqueid/index.js @@ -1,11 +1,12 @@ /** - * lodash 3.1.2 (Custom Build) + * lodash 3.2.0 (Custom Build) * Build: `lodash modularize exports="npm" -o ./` * Copyright 2012-2016 The Dojo Foundation * Based on Underscore.js 1.8.3 * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors * Available under MIT license */ +var root = require('lodash._root'); /** Used as references for various `Number` constants. */ var INFINITY = 1 / 0; @@ -13,49 +14,6 @@ var INFINITY = 1 / 0; /** `Object#toString` result references. */ var symbolTag = '[object Symbol]'; -/** 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 free variable `global` from Node.js. */ -var freeGlobal = checkGlobal(freeExports && freeModule && typeof global == 'object' && global); - -/** Detect free variable `self`. */ -var freeSelf = checkGlobal(objectTypes[typeof self] && self); - -/** Detect free variable `window`. */ -var freeWindow = checkGlobal(objectTypes[typeof window] && window); - -/** Detect `this` as the global object. */ -var thisGlobal = checkGlobal(objectTypes[typeof this] && this); - -/** - * Used as a reference to the global object. - * - * The `this` value is used if it's the global object to avoid Greasemonkey's - * restricted `window` object, otherwise the `window` object is used. - */ -var root = freeGlobal || ((freeWindow !== (thisGlobal && thisGlobal.window)) && freeWindow) || freeSelf || thisGlobal || Function('return this')(); - -/** - * Checks if `value` is a global object. - * - * @private - * @param {*} value The value to check. - * @returns {null|Object} Returns `value` if it's a global object, else `null`. - */ -function checkGlobal(value) { - return (value && value.Object === Object) ? value : null; -} - /** Used for built-in method references. */ var objectProto = Object.prototype; diff --git a/lodash.uniqueid/package.json b/lodash.uniqueid/package.json index 8e4f94028..ebad5907b 100644 --- a/lodash.uniqueid/package.json +++ b/lodash.uniqueid/package.json @@ -1,6 +1,6 @@ { "name": "lodash.uniqueid", - "version": "3.1.2", + "version": "3.2.0", "description": "The lodash method `_.uniqueId` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -13,5 +13,8 @@ "Mathias Bynens (https://mathiasbynens.be/)" ], "repository": "lodash/lodash", - "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" } + "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, + "dependencies": { + "lodash._root": "^3.0.0" + } } diff --git a/lodash.unzip/README.md b/lodash.unzip/README.md index ee3a51e1f..4398b5ee9 100644 --- a/lodash.unzip/README.md +++ b/lodash.unzip/README.md @@ -1,4 +1,4 @@ -# lodash.unzip v3.1.0 +# lodash.unzip v3.2.0 The [modern build](https://github.com/lodash/lodash/wiki/Build-Differences) of [lodash’s](https://lodash.com/) `_.unzip` exported as a [Node.js](http://nodejs.org/)/[io.js](https://iojs.org/) module. @@ -17,4 +17,4 @@ In Node.js/io.js: var unzip = require('lodash.unzip'); ``` -See the [documentation](https://lodash.com/docs#unzip) or [package source](https://github.com/lodash/lodash/blob/3.1.0-npm-packages/lodash.unzip) for more details. +See the [documentation](https://lodash.com/docs#unzip) or [package source](https://github.com/lodash/lodash/blob/3.2.0-npm-packages/lodash.unzip) for more details. diff --git a/lodash.unzip/index.js b/lodash.unzip/index.js index 5387c1bd0..82ba074e1 100644 --- a/lodash.unzip/index.js +++ b/lodash.unzip/index.js @@ -1,13 +1,22 @@ /** - * lodash 3.1.0 (Custom Build) + * lodash 3.2.0 (Custom Build) * Build: `lodash modern modularize exports="npm" -o ./` * Copyright 2012-2015 The Dojo Foundation * Based on Underscore.js 1.8.3 * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors * Available under MIT license */ -var arrayMap = require('lodash._arraymap'), - arrayMax = require('lodash._arraymax'); +var arrayFilter = require('lodash._arrayfilter'), + arrayMap = require('lodash._arraymap'); + +/* Native method references for those with the same name as other `lodash` methods. */ +var nativeMax = Math.max; + +/** + * 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; /** * The base implementation of `_.property` without support for deep paths. @@ -26,7 +35,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. @@ -34,9 +43,33 @@ 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. + * + * **Note:** This function is based on [`ToLength`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tolength). + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. + */ +function isLength(value) { + return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; +} + /** * This method is like `_.zip` except that it accepts an array of grouped - * elements and creates an array regrouping the elements to their pre-`_.zip` + * elements and creates an array regrouping the elements to their pre-zip * configuration. * * @static @@ -53,10 +86,19 @@ var getLength = baseProperty('length'); * // => [['fred', 'barney'], [30, 40], [true, false]] */ function unzip(array) { + if (!(array && array.length)) { + return []; + } var index = -1, - length = (array && array.length && arrayMax(arrayMap(array, getLength))) >>> 0, - result = Array(length); + length = 0; + array = arrayFilter(array, function(group) { + if (isArrayLike(group)) { + length = nativeMax(group.length, length); + return true; + } + }); + var result = Array(length); while (++index < length) { result[index] = arrayMap(array, baseProperty(index)); } diff --git a/lodash.unzip/package.json b/lodash.unzip/package.json index f1a64c961..f325b0b22 100644 --- a/lodash.unzip/package.json +++ b/lodash.unzip/package.json @@ -1,6 +1,6 @@ { "name": "lodash.unzip", - "version": "3.1.0", + "version": "3.2.0", "description": "The modern build of lodash’s `_.unzip` as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -17,7 +17,7 @@ "repository": "lodash/lodash", "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, "dependencies": { - "lodash._arraymap": "^3.0.0", - "lodash._arraymax": "^3.0.0" + "lodash._arrayfilter": "^3.0.0", + "lodash._arraymap": "^3.0.0" } } diff --git a/lodash.without/README.md b/lodash.without/README.md index 938209292..da352a717 100644 --- a/lodash.without/README.md +++ b/lodash.without/README.md @@ -1,4 +1,4 @@ -# lodash.without v3.1.0 +# lodash.without v3.2.0 The [modern build](https://github.com/lodash/lodash/wiki/Build-Differences) of [lodash’s](https://lodash.com/) `_.without` exported as a [Node.js](http://nodejs.org/)/[io.js](https://iojs.org/) module. @@ -17,4 +17,4 @@ In Node.js/io.js: var without = require('lodash.without'); ``` -See the [documentation](https://lodash.com/docs#without) or [package source](https://github.com/lodash/lodash/blob/3.1.0-npm-packages/lodash.without) for more details. +See the [documentation](https://lodash.com/docs#without) or [package source](https://github.com/lodash/lodash/blob/3.2.0-npm-packages/lodash.without) for more details. diff --git a/lodash.without/index.js b/lodash.without/index.js index 11ad7e925..6108da1d2 100644 --- a/lodash.without/index.js +++ b/lodash.without/index.js @@ -1,23 +1,73 @@ /** - * lodash 3.1.0 (Custom Build) + * lodash 3.2.0 (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 */ var baseDifference = require('lodash._basedifference'), - isArguments = require('lodash.isarguments'), - isArray = require('lodash.isarray'), restParam = require('lodash.restparam'); /** - * Creates an array excluding all provided values using `SameValueZero` for - * equality comparisons. + * 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; + +/** + * The base implementation of `_.property` without support for deep paths. * - * **Note:** [`SameValueZero`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) - * comparisons are like strict equality comparisons, e.g. `===`, except that - * `NaN` matches `NaN`. + * @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. + * + * **Note:** This function is based on [`ToLength`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tolength). + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. + */ +function isLength(value) { + return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; +} + +/** + * Creates an array excluding all provided values using + * [`SameValueZero`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) + * for equality comparisons. * * @static * @memberOf _ @@ -31,7 +81,7 @@ var baseDifference = require('lodash._basedifference'), * // => [3] */ var without = restParam(function(array, values) { - return (isArray(array) || isArguments(array)) + return isArrayLike(array) ? baseDifference(array, values) : []; }); diff --git a/lodash.without/package.json b/lodash.without/package.json index 0f50ae52d..1ca6bd899 100644 --- a/lodash.without/package.json +++ b/lodash.without/package.json @@ -1,6 +1,6 @@ { "name": "lodash.without", - "version": "3.1.0", + "version": "3.2.0", "description": "The modern build of lodash’s `_.without` as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -18,8 +18,6 @@ "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, "dependencies": { "lodash._basedifference": "^3.0.0", - "lodash.isarguments": "^3.0.0", - "lodash.isarray": "^3.0.0", "lodash.restparam": "^3.0.0" } } diff --git a/lodash.words/README.md b/lodash.words/README.md index 38812242b..d1a9ce65d 100644 --- a/lodash.words/README.md +++ b/lodash.words/README.md @@ -1,4 +1,4 @@ -# lodash.words v3.1.2 +# lodash.words v3.2.0 The [lodash](https://lodash.com/) method `_.words` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var words = require('lodash.words'); ``` -See the [documentation](https://lodash.com/docs#words) or [package source](https://github.com/lodash/lodash/blob/3.1.2-npm-packages/lodash.words) for more details. +See the [documentation](https://lodash.com/docs#words) or [package source](https://github.com/lodash/lodash/blob/3.2.0-npm-packages/lodash.words) for more details. diff --git a/lodash.words/index.js b/lodash.words/index.js index f569693e9..8f6e3a521 100644 --- a/lodash.words/index.js +++ b/lodash.words/index.js @@ -1,11 +1,12 @@ /** - * lodash 3.1.2 (Custom Build) + * lodash 3.2.0 (Custom Build) * Build: `lodash modularize exports="npm" -o ./` * Copyright 2012-2016 The Dojo Foundation * Based on Underscore.js 1.8.3 * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors * Available under MIT license */ +var root = require('lodash._root'); /** Used as references for various `Number` constants. */ var INFINITY = 1 / 0; @@ -67,49 +68,6 @@ var reComplexWord = RegExp([ /** Used to detect strings that need a more robust regexp to match words. */ var reHasComplexWord = /[a-z][A-Z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/; -/** 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 free variable `global` from Node.js. */ -var freeGlobal = checkGlobal(freeExports && freeModule && typeof global == 'object' && global); - -/** Detect free variable `self`. */ -var freeSelf = checkGlobal(objectTypes[typeof self] && self); - -/** Detect free variable `window`. */ -var freeWindow = checkGlobal(objectTypes[typeof window] && window); - -/** Detect `this` as the global object. */ -var thisGlobal = checkGlobal(objectTypes[typeof this] && this); - -/** - * Used as a reference to the global object. - * - * The `this` value is used if it's the global object to avoid Greasemonkey's - * restricted `window` object, otherwise the `window` object is used. - */ -var root = freeGlobal || ((freeWindow !== (thisGlobal && thisGlobal.window)) && freeWindow) || freeSelf || thisGlobal || Function('return this')(); - -/** - * Checks if `value` is a global object. - * - * @private - * @param {*} value The value to check. - * @returns {null|Object} Returns `value` if it's a global object, else `null`. - */ -function checkGlobal(value) { - return (value && value.Object === Object) ? value : null; -} - /** Used for built-in method references. */ var objectProto = Object.prototype; diff --git a/lodash.words/package.json b/lodash.words/package.json index 84499df94..2560fad87 100644 --- a/lodash.words/package.json +++ b/lodash.words/package.json @@ -1,6 +1,6 @@ { "name": "lodash.words", - "version": "3.1.2", + "version": "3.2.0", "description": "The lodash method `_.words` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -13,5 +13,8 @@ "Mathias Bynens (https://mathiasbynens.be/)" ], "repository": "lodash/lodash", - "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" } + "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, + "dependencies": { + "lodash._root": "^3.0.0" + } }