diff --git a/README.md b/README.md index 45a01eddb..10a281986 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# lodash v4.4.1 +# lodash v4.4.2 The [lodash](https://lodash.com/) library exported as [npm packages](https://www.npmjs.com/browse/keyword/lodash-modularized) per method. diff --git a/lodash._baseintersection/README.md b/lodash._baseintersection/README.md index 7f7721fe1..282cd7b2d 100644 --- a/lodash._baseintersection/README.md +++ b/lodash._baseintersection/README.md @@ -1,4 +1,4 @@ -# lodash._baseintersection v4.4.1 +# lodash._baseintersection v4.4.2 The internal [lodash](https://lodash.com/) function `baseIntersection` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var baseIntersection = require('lodash._baseintersection'); ``` -See the [package source](https://github.com/lodash/lodash/blob/4.4.1-npm-packages/lodash._baseintersection) for more details. +See the [package source](https://github.com/lodash/lodash/blob/4.4.2-npm-packages/lodash._baseintersection) for more details. diff --git a/lodash._baseintersection/index.js b/lodash._baseintersection/index.js index ef9e90748..32854ab11 100644 --- a/lodash._baseintersection/index.js +++ b/lodash._baseintersection/index.js @@ -1,5 +1,5 @@ /** - * lodash 4.4.1 (Custom Build) + * lodash 4.4.2 (Custom Build) * Build: `lodash modularize exports="npm" -o ./` * Copyright 2012-2016 The Dojo Foundation * Based on Underscore.js 1.8.3 diff --git a/lodash._baseintersection/package.json b/lodash._baseintersection/package.json index 4ed47edd9..f586f0380 100644 --- a/lodash._baseintersection/package.json +++ b/lodash._baseintersection/package.json @@ -1,6 +1,6 @@ { "name": "lodash._baseintersection", - "version": "4.4.1", + "version": "4.4.2", "description": "The internal lodash function `baseIntersection` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -14,6 +14,6 @@ "repository": "lodash/lodash", "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, "dependencies": { - "lodash._setcache": "^4.0.0" + "lodash._setcache": "~4.1.0" } } diff --git a/lodash.flattendepth/LICENSE b/lodash.flattendepth/LICENSE index bcbe13d67..e0c69d560 100644 --- a/lodash.flattendepth/LICENSE +++ b/lodash.flattendepth/LICENSE @@ -1,23 +1,47 @@ -The MIT License (MIT) +Copyright jQuery Foundation and other contributors -Copyright 2012-2016 The Dojo Foundation -Based on Underscore.js, copyright 2009-2016 Jeremy Ashkenas, +Based on Underscore.js, copyright 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: +This software consists of voluntary contributions made by many +individuals. For exact contribution history, see the revision history +available at https://github.com/lodash/lodash -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. +The following license applies to all parts of this software except as +documented below: -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. +==== + +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. + +==== + +Copyright and related rights for sample code are waived via CC0. Sample +code is defined as all source code displayed within the prose of the +documentation. + +CC0: http://creativecommons.org/publicdomain/zero/1.0/ + +==== + +Files located in the node_modules and vendor directories are externally +maintained libraries used by this software which have their own +licenses; we recommend you read them, as their terms may differ from the +terms above. diff --git a/lodash.flattendepth/README.md b/lodash.flattendepth/README.md index fc97163a6..27497e386 100644 --- a/lodash.flattendepth/README.md +++ b/lodash.flattendepth/README.md @@ -1,4 +1,4 @@ -# lodash.flattendepth v4.4.1 +# lodash.flattendepth v4.4.2 The [lodash](https://lodash.com/) method `_.flattenDepth` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var flattenDepth = require('lodash.flattendepth'); ``` -See the [documentation](https://lodash.com/docs#flattenDepth) or [package source](https://github.com/lodash/lodash/blob/4.4.1-npm-packages/lodash.flattendepth) for more details. +See the [documentation](https://lodash.com/docs#flattenDepth) or [package source](https://github.com/lodash/lodash/blob/4.4.2-npm-packages/lodash.flattendepth) for more details. diff --git a/lodash.flattendepth/index.js b/lodash.flattendepth/index.js index f32ce27d6..cd0834ea0 100644 --- a/lodash.flattendepth/index.js +++ b/lodash.flattendepth/index.js @@ -1,10 +1,10 @@ /** - * lodash 4.4.1 (Custom Build) + * lodash 4.4.2 (Custom Build) * Build: `lodash modularize exports="npm" -o ./` - * Copyright 2012-2016 The Dojo Foundation + * Copyright jQuery Foundation and other contributors + * Released under MIT license * Based on Underscore.js 1.8.3 - * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors - * Available under MIT license + * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors */ var baseFlatten = require('lodash._baseflatten'); @@ -15,7 +15,8 @@ var INFINITY = 1 / 0, /** `Object#toString` result references. */ var funcTag = '[object Function]', - genTag = '[object GeneratorFunction]'; + genTag = '[object GeneratorFunction]', + symbolTag = '[object Symbol]'; /** Used to match leading and trailing whitespace. */ var reTrim = /^\s+|\s+$/g; @@ -46,6 +47,7 @@ var objectToString = objectProto.toString; * * @static * @memberOf _ + * @since 4.4.0 * @category Array * @param {Array} array The array to flatten. * @param {number} [depth=1] The maximum recursion depth. @@ -74,9 +76,11 @@ function flattenDepth(array, depth) { * * @static * @memberOf _ + * @since 0.1.0 * @category Lang * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. + * @returns {boolean} Returns `true` if `value` is correctly classified, + * else `false`. * @example * * _.isFunction(_); @@ -99,6 +103,7 @@ function isFunction(value) { * * @static * @memberOf _ + * @since 0.1.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is an object, else `false`. @@ -122,12 +127,65 @@ function isObject(value) { } /** - * Converts `value` to an integer. - * - * **Note:** This function is loosely based on [`ToInteger`](http://www.ecma-international.org/ecma-262/6.0/#sec-tointeger). + * 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 _ + * @since 4.0.0 + * @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 _ + * @since 4.0.0 + * @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 _ + * @since 4.0.0 * @category Lang * @param {*} value The value to convert. * @returns {number} Returns the converted integer. @@ -163,6 +221,7 @@ function toInteger(value) { * * @static * @memberOf _ + * @since 4.0.0 * @category Lang * @param {*} value The value to process. * @returns {number} Returns the number. @@ -181,6 +240,12 @@ function toInteger(value) { * // => 3 */ function toNumber(value) { + if (typeof value == 'number') { + return value; + } + if (isSymbol(value)) { + return NAN; + } if (isObject(value)) { var other = isFunction(value.valueOf) ? value.valueOf() : value; value = isObject(other) ? (other + '') : other; diff --git a/lodash.flattendepth/package.json b/lodash.flattendepth/package.json index 1a357a1b4..bf4705faa 100644 --- a/lodash.flattendepth/package.json +++ b/lodash.flattendepth/package.json @@ -1,6 +1,6 @@ { "name": "lodash.flattendepth", - "version": "4.4.1", + "version": "4.4.2", "description": "The lodash method `_.flattenDepth` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", diff --git a/lodash.get/README.md b/lodash.get/README.md index 5802ad6f2..90796144c 100644 --- a/lodash.get/README.md +++ b/lodash.get/README.md @@ -1,4 +1,4 @@ -# lodash.get v4.4.1 +# lodash.get v4.4.2 The [lodash](https://lodash.com/) method `_.get` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var get = require('lodash.get'); ``` -See the [documentation](https://lodash.com/docs#get) or [package source](https://github.com/lodash/lodash/blob/4.4.1-npm-packages/lodash.get) for more details. +See the [documentation](https://lodash.com/docs#get) or [package source](https://github.com/lodash/lodash/blob/4.4.2-npm-packages/lodash.get) for more details. diff --git a/lodash.get/index.js b/lodash.get/index.js index 4c2a5a3a2..0eaadec50 100644 --- a/lodash.get/index.js +++ b/lodash.get/index.js @@ -29,7 +29,7 @@ var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, /** * Used to match `RegExp` - * [syntax characters](http://ecma-international.org/ecma-262/6.0/#sec-patterns). + * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns). */ var reRegExpChar = /[\\^$.*+?()[\]{}|]/g; @@ -81,6 +81,7 @@ function isHostObject(value) { /** Used for built-in method references. */ var arrayProto = Array.prototype, + funcProto = Function.prototype, objectProto = Object.prototype; /** Used to detect overreaching core-js shims. */ @@ -93,14 +94,14 @@ var maskSrcKey = (function() { }()); /** Used to resolve the decompiled source of functions. */ -var funcToString = Function.prototype.toString; +var funcToString = funcProto.toString; /** Used to check objects for own properties. */ var hasOwnProperty = objectProto.hasOwnProperty; /** * 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; @@ -431,7 +432,7 @@ MapCache.prototype.set = mapCacheSet; * Gets the index at which the `key` is found in `array` of key-value pairs. * * @private - * @param {Array} array The array to search. + * @param {Array} array The array to inspect. * @param {*} key The key to search for. * @returns {number} Returns the index of the matched value, else `-1`. */ @@ -650,7 +651,7 @@ function toSource(func) { * **Note:** The cache is exposed as the `cache` property on the memoized * function. Its creation may be customized by replacing the `_.memoize.Cache` * constructor with one whose instances implement the - * [`Map`](http://ecma-international.org/ecma-262/6.0/#sec-properties-of-the-map-prototype-object) + * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object) * method interface of `delete`, `get`, `has`, and `set`. * * @static @@ -709,7 +710,7 @@ memoize.Cache = MapCache; /** * 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 @@ -787,15 +788,14 @@ var isArray = Array.isArray; */ 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; } /** * 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 diff --git a/lodash.get/package.json b/lodash.get/package.json index 070eaaaf8..3dd8e77eb 100644 --- a/lodash.get/package.json +++ b/lodash.get/package.json @@ -1,6 +1,6 @@ { "name": "lodash.get", - "version": "4.4.1", + "version": "4.4.2", "description": "The lodash method `_.get` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", diff --git a/lodash.ismap/README.md b/lodash.ismap/README.md index 9ba5e001e..d9aeab6bd 100644 --- a/lodash.ismap/README.md +++ b/lodash.ismap/README.md @@ -1,4 +1,4 @@ -# lodash.ismap v4.4.1 +# lodash.ismap v4.4.2 The [lodash](https://lodash.com/) method `_.isMap` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var isMap = require('lodash.ismap'); ``` -See the [documentation](https://lodash.com/docs#isMap) or [package source](https://github.com/lodash/lodash/blob/4.4.1-npm-packages/lodash.ismap) for more details. +See the [documentation](https://lodash.com/docs#isMap) or [package source](https://github.com/lodash/lodash/blob/4.4.2-npm-packages/lodash.ismap) for more details. diff --git a/lodash.ismap/index.js b/lodash.ismap/index.js index a67284082..19ed0e492 100644 --- a/lodash.ismap/index.js +++ b/lodash.ismap/index.js @@ -20,7 +20,7 @@ var dataViewTag = '[object DataView]'; /** * Used to match `RegExp` - * [syntax characters](http://ecma-international.org/ecma-262/6.0/#sec-patterns). + * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns). */ var reRegExpChar = /[\\^$.*+?()[\]{}|]/g; @@ -103,7 +103,8 @@ function isHostObject(value) { } /** Used for built-in method references. */ -var objectProto = Object.prototype; +var funcProto = Function.prototype, + objectProto = Object.prototype; /** Used to detect overreaching core-js shims. */ var coreJsData = root['__core-js_shared__']; @@ -115,14 +116,14 @@ var maskSrcKey = (function() { }()); /** Used to resolve the decompiled source of functions. */ -var funcToString = Function.prototype.toString; +var funcToString = funcProto.toString; /** Used to check objects for own properties. */ var hasOwnProperty = objectProto.hasOwnProperty; /** * 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; @@ -208,7 +209,7 @@ function getNative(object, key) { var getTag = baseGetTag; // Fallback for data views, maps, sets, and weak maps in IE 11, -// for data views in Edge, and promises in Node.js. +// for data views in Edge < 14, and promises in Node.js. if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) || (Map && getTag(new Map) != mapTag) || (Promise && getTag(Promise.resolve()) != promiseTag) || @@ -281,15 +282,14 @@ function toSource(func) { */ 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; } /** * 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 diff --git a/lodash.ismap/package.json b/lodash.ismap/package.json index ad008888b..5c4ce5997 100644 --- a/lodash.ismap/package.json +++ b/lodash.ismap/package.json @@ -1,6 +1,6 @@ { "name": "lodash.ismap", - "version": "4.4.1", + "version": "4.4.2", "description": "The lodash method `_.isMap` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", diff --git a/lodash.isset/README.md b/lodash.isset/README.md index c1e848eaa..2c90ccafa 100644 --- a/lodash.isset/README.md +++ b/lodash.isset/README.md @@ -1,4 +1,4 @@ -# lodash.isset v4.4.1 +# lodash.isset v4.4.2 The [lodash](https://lodash.com/) method `_.isSet` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var isSet = require('lodash.isset'); ``` -See the [documentation](https://lodash.com/docs#isSet) or [package source](https://github.com/lodash/lodash/blob/4.4.1-npm-packages/lodash.isset) for more details. +See the [documentation](https://lodash.com/docs#isSet) or [package source](https://github.com/lodash/lodash/blob/4.4.2-npm-packages/lodash.isset) for more details. diff --git a/lodash.isset/index.js b/lodash.isset/index.js index ec3d617dc..1c5a10f0b 100644 --- a/lodash.isset/index.js +++ b/lodash.isset/index.js @@ -20,7 +20,7 @@ var dataViewTag = '[object DataView]'; /** * Used to match `RegExp` - * [syntax characters](http://ecma-international.org/ecma-262/6.0/#sec-patterns). + * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns). */ var reRegExpChar = /[\\^$.*+?()[\]{}|]/g; @@ -103,7 +103,8 @@ function isHostObject(value) { } /** Used for built-in method references. */ -var objectProto = Object.prototype; +var funcProto = Function.prototype, + objectProto = Object.prototype; /** Used to detect overreaching core-js shims. */ var coreJsData = root['__core-js_shared__']; @@ -115,14 +116,14 @@ var maskSrcKey = (function() { }()); /** Used to resolve the decompiled source of functions. */ -var funcToString = Function.prototype.toString; +var funcToString = funcProto.toString; /** Used to check objects for own properties. */ var hasOwnProperty = objectProto.hasOwnProperty; /** * 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; @@ -208,7 +209,7 @@ function getNative(object, key) { var getTag = baseGetTag; // Fallback for data views, maps, sets, and weak maps in IE 11, -// for data views in Edge, and promises in Node.js. +// for data views in Edge < 14, and promises in Node.js. if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) || (Map && getTag(new Map) != mapTag) || (Promise && getTag(Promise.resolve()) != promiseTag) || @@ -281,15 +282,14 @@ function toSource(func) { */ 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; } /** * 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 diff --git a/lodash.isset/package.json b/lodash.isset/package.json index 1e2f890b6..b69f8b45a 100644 --- a/lodash.isset/package.json +++ b/lodash.isset/package.json @@ -1,6 +1,6 @@ { "name": "lodash.isset", - "version": "4.4.1", + "version": "4.4.2", "description": "The lodash method `_.isSet` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", diff --git a/lodash.property/README.md b/lodash.property/README.md index 6f8d7edf0..c717deba1 100644 --- a/lodash.property/README.md +++ b/lodash.property/README.md @@ -1,4 +1,4 @@ -# lodash.property v4.4.1 +# lodash.property v4.4.2 The [lodash](https://lodash.com/) method `_.property` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var property = require('lodash.property'); ``` -See the [documentation](https://lodash.com/docs#property) or [package source](https://github.com/lodash/lodash/blob/4.4.1-npm-packages/lodash.property) for more details. +See the [documentation](https://lodash.com/docs#property) or [package source](https://github.com/lodash/lodash/blob/4.4.2-npm-packages/lodash.property) for more details. diff --git a/lodash.property/index.js b/lodash.property/index.js index add62bf49..8e3da5523 100644 --- a/lodash.property/index.js +++ b/lodash.property/index.js @@ -29,7 +29,7 @@ var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, /** * Used to match `RegExp` - * [syntax characters](http://ecma-international.org/ecma-262/6.0/#sec-patterns). + * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns). */ var reRegExpChar = /[\\^$.*+?()[\]{}|]/g; @@ -94,6 +94,7 @@ function isHostObject(value) { /** Used for built-in method references. */ var arrayProto = Array.prototype, + funcProto = Function.prototype, objectProto = Object.prototype; /** Used to detect overreaching core-js shims. */ @@ -106,14 +107,14 @@ var maskSrcKey = (function() { }()); /** Used to resolve the decompiled source of functions. */ -var funcToString = Function.prototype.toString; +var funcToString = funcProto.toString; /** Used to check objects for own properties. */ var hasOwnProperty = objectProto.hasOwnProperty; /** * 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; @@ -444,7 +445,7 @@ MapCache.prototype.set = mapCacheSet; * Gets the index at which the `key` is found in `array` of key-value pairs. * * @private - * @param {Array} array The array to search. + * @param {Array} array The array to inspect. * @param {*} key The key to search for. * @returns {number} Returns the index of the matched value, else `-1`. */ @@ -676,7 +677,7 @@ function toSource(func) { * **Note:** The cache is exposed as the `cache` property on the memoized * function. Its creation may be customized by replacing the `_.memoize.Cache` * constructor with one whose instances implement the - * [`Map`](http://ecma-international.org/ecma-262/6.0/#sec-properties-of-the-map-prototype-object) + * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object) * method interface of `delete`, `get`, `has`, and `set`. * * @static @@ -735,7 +736,7 @@ memoize.Cache = MapCache; /** * 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 @@ -813,15 +814,14 @@ var isArray = Array.isArray; */ 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; } /** * 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 diff --git a/lodash.property/package.json b/lodash.property/package.json index 140413649..c1476d616 100644 --- a/lodash.property/package.json +++ b/lodash.property/package.json @@ -1,6 +1,6 @@ { "name": "lodash.property", - "version": "4.4.1", + "version": "4.4.2", "description": "The lodash method `_.property` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", diff --git a/lodash.propertyof/README.md b/lodash.propertyof/README.md index 02f520dc1..96778005d 100644 --- a/lodash.propertyof/README.md +++ b/lodash.propertyof/README.md @@ -1,4 +1,4 @@ -# lodash.propertyof v4.4.1 +# lodash.propertyof v4.4.2 The [lodash](https://lodash.com/) method `_.propertyOf` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var propertyOf = require('lodash.propertyof'); ``` -See the [documentation](https://lodash.com/docs#propertyOf) or [package source](https://github.com/lodash/lodash/blob/4.4.1-npm-packages/lodash.propertyof) for more details. +See the [documentation](https://lodash.com/docs#propertyOf) or [package source](https://github.com/lodash/lodash/blob/4.4.2-npm-packages/lodash.propertyof) for more details. diff --git a/lodash.propertyof/index.js b/lodash.propertyof/index.js index 978f2a88f..5f65936f9 100644 --- a/lodash.propertyof/index.js +++ b/lodash.propertyof/index.js @@ -29,7 +29,7 @@ var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, /** * Used to match `RegExp` - * [syntax characters](http://ecma-international.org/ecma-262/6.0/#sec-patterns). + * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns). */ var reRegExpChar = /[\\^$.*+?()[\]{}|]/g; @@ -81,6 +81,7 @@ function isHostObject(value) { /** Used for built-in method references. */ var arrayProto = Array.prototype, + funcProto = Function.prototype, objectProto = Object.prototype; /** Used to detect overreaching core-js shims. */ @@ -93,14 +94,14 @@ var maskSrcKey = (function() { }()); /** Used to resolve the decompiled source of functions. */ -var funcToString = Function.prototype.toString; +var funcToString = funcProto.toString; /** Used to check objects for own properties. */ var hasOwnProperty = objectProto.hasOwnProperty; /** * 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; @@ -431,7 +432,7 @@ MapCache.prototype.set = mapCacheSet; * Gets the index at which the `key` is found in `array` of key-value pairs. * * @private - * @param {Array} array The array to search. + * @param {Array} array The array to inspect. * @param {*} key The key to search for. * @returns {number} Returns the index of the matched value, else `-1`. */ @@ -650,7 +651,7 @@ function toSource(func) { * **Note:** The cache is exposed as the `cache` property on the memoized * function. Its creation may be customized by replacing the `_.memoize.Cache` * constructor with one whose instances implement the - * [`Map`](http://ecma-international.org/ecma-262/6.0/#sec-properties-of-the-map-prototype-object) + * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object) * method interface of `delete`, `get`, `has`, and `set`. * * @static @@ -709,7 +710,7 @@ memoize.Cache = MapCache; /** * 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 @@ -787,15 +788,14 @@ var isArray = Array.isArray; */ 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; } /** * 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 diff --git a/lodash.propertyof/package.json b/lodash.propertyof/package.json index 6b321a623..f5d5a17f7 100644 --- a/lodash.propertyof/package.json +++ b/lodash.propertyof/package.json @@ -1,6 +1,6 @@ { "name": "lodash.propertyof", - "version": "4.4.1", + "version": "4.4.2", "description": "The lodash method `_.propertyOf` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", diff --git a/lodash.sortby/README.md b/lodash.sortby/README.md index 75d9b2b7b..fb343a1a5 100644 --- a/lodash.sortby/README.md +++ b/lodash.sortby/README.md @@ -1,4 +1,4 @@ -# lodash.sortby v4.4.1 +# lodash.sortby v4.4.2 The [lodash](https://lodash.com/) method `_.sortBy` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var sortBy = require('lodash.sortby'); ``` -See the [documentation](https://lodash.com/docs#sortBy) or [package source](https://github.com/lodash/lodash/blob/4.4.1-npm-packages/lodash.sortby) for more details. +See the [documentation](https://lodash.com/docs#sortBy) or [package source](https://github.com/lodash/lodash/blob/4.4.2-npm-packages/lodash.sortby) for more details. diff --git a/lodash.sortby/index.js b/lodash.sortby/index.js index 23cc97ea9..1426759ca 100644 --- a/lodash.sortby/index.js +++ b/lodash.sortby/index.js @@ -1,5 +1,5 @@ /** - * lodash 4.4.1 (Custom Build) + * lodash 4.4.2 (Custom Build) * Build: `lodash modularize exports="npm" -o ./` * Copyright jQuery Foundation and other contributors * Released under MIT license @@ -61,6 +61,19 @@ function baseSortBy(array, comparer) { return array; } +/** + * The base implementation of `_.unary` without support for storing wrapper metadata. + * + * @private + * @param {Function} func The function to cap arguments for. + * @returns {Function} Returns the new function. + */ +function baseUnary(func) { + return function(value) { + return func(value); + }; +} + /** * Compares values to sort them in ascending order. * @@ -187,7 +200,7 @@ function baseMap(collection, iteratee) { */ function baseOrderBy(collection, iteratees, orders) { var index = -1; - iteratees = arrayMap(iteratees.length ? iteratees : [identity], baseIteratee); + iteratees = arrayMap(iteratees.length ? iteratees : [identity], baseUnary(baseIteratee)); var result = baseMap(collection, function(value, key, collection) { var criteria = arrayMap(iteratees, function(iteratee) { @@ -227,6 +240,18 @@ function baseProperty(key) { */ var getLength = baseProperty('length'); +/** + * Checks if `value` is a flattenable array and not a `_.matchesProperty` + * iteratee shorthand. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is flattenable, else `false`. + */ +function isFlattenableIteratee(value) { + return isArray(value) && !(value.length == 2 && !isFunction(value[0])); +} + /** * Checks if the given arguments are from an iteratee call. * @@ -295,7 +320,11 @@ var sortBy = rest(function(collection, iteratees) { } else if (length > 2 && isIterateeCall(iteratees[0], iteratees[1], iteratees[2])) { iteratees = [iteratees[0]]; } - return baseOrderBy(collection, baseFlatten(iteratees, 1), []); + iteratees = (iteratees.length == 1 && isArray(iteratees[0])) + ? iteratees[0] + : baseFlatten(iteratees, 1, isFlattenableIteratee); + + return baseOrderBy(collection, iteratees, []); }); /** @@ -334,6 +363,33 @@ function eq(value, other) { return value === other || (value !== value && other !== other); } +/** + * Checks if `value` is classified as an `Array` object. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @type {Function} + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is correctly classified, + * else `false`. + * @example + * + * _.isArray([1, 2, 3]); + * // => true + * + * _.isArray(document.body.children); + * // => false + * + * _.isArray('abc'); + * // => false + * + * _.isArray(_.noop); + * // => false + */ +var isArray = Array.isArray; + /** * Checks if `value` is array-like. A value is considered array-like if it's * not a function and has a `value.length` that's an integer greater than or diff --git a/lodash.sortby/package.json b/lodash.sortby/package.json index 90db7a808..8cde54e18 100644 --- a/lodash.sortby/package.json +++ b/lodash.sortby/package.json @@ -1,6 +1,6 @@ { "name": "lodash.sortby", - "version": "4.4.1", + "version": "4.4.2", "description": "The lodash method `_.sortBy` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", diff --git a/lodash.split/README.md b/lodash.split/README.md index a406cbfa3..86d04cb00 100644 --- a/lodash.split/README.md +++ b/lodash.split/README.md @@ -1,4 +1,4 @@ -# lodash.split v4.4.1 +# lodash.split v4.4.2 The [lodash](https://lodash.com/) method `_.split` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var split = require('lodash.split'); ``` -See the [documentation](https://lodash.com/docs#split) or [package source](https://github.com/lodash/lodash/blob/4.4.1-npm-packages/lodash.split) for more details. +See the [documentation](https://lodash.com/docs#split) or [package source](https://github.com/lodash/lodash/blob/4.4.2-npm-packages/lodash.split) for more details. diff --git a/lodash.split/index.js b/lodash.split/index.js index b27d2cd04..2ce9a9220 100644 --- a/lodash.split/index.js +++ b/lodash.split/index.js @@ -47,10 +47,10 @@ var reOptMod = rsModifier + '?', rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')'; /** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */ -var reComplexSymbol = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g'); +var reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + 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 + rsComboMarksRange + rsComboSymbolsRange + rsVarRange + ']'); +var reHasUnicode = RegExp('[' + rsZWJ + rsAstralRange + rsComboMarksRange + rsComboSymbolsRange + rsVarRange + ']'); /** Detect free variable `global` from Node.js. */ var freeGlobal = typeof global == 'object' && global && global.Object === Object && global; @@ -84,16 +84,14 @@ var nodeUtil = (function() { var nodeIsRegExp = nodeUtil && nodeUtil.isRegExp; /** - * The base implementation of `_.property` without support for deep paths. + * Converts an ASCII `string` to an array. * * @private - * @param {string} key The key of the property to get. - * @returns {Function} Returns the new accessor function. + * @param {string} string The string to convert. + * @returns {Array} Returns the converted array. */ -function baseProperty(key) { - return function(object) { - return object == null ? undefined : object[key]; - }; +function asciiToArray(string) { + return string.split(''); } /** @@ -109,6 +107,17 @@ function baseUnary(func) { }; } +/** + * Checks if `string` contains Unicode symbols. + * + * @private + * @param {string} string The string to inspect. + * @returns {boolean} Returns `true` if a symbol is found, else `false`. + */ +function hasUnicode(string) { + return reHasUnicode.test(string); +} + /** * Converts `string` to an array. * @@ -117,16 +126,28 @@ function baseUnary(func) { * @returns {Array} Returns the converted array. */ function stringToArray(string) { - return string.match(reComplexSymbol); + return hasUnicode(string) + ? unicodeToArray(string) + : asciiToArray(string); +} + +/** + * Converts a Unicode `string` to an array. + * + * @private + * @param {string} string The string to convert. + * @returns {Array} Returns the converted array. + */ +function unicodeToArray(string) { + return string.match(reUnicode) || []; } /** Used for built-in method references. */ -var objectProto = Object.prototype, - stringProto = String.prototype; +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; @@ -134,9 +155,6 @@ var objectToString = objectProto.toString; /** Built-in value references. */ var Symbol = root.Symbol; -/* Built-in method references for those with the same name as other `lodash` methods. */ -var nativeSplit = stringProto.split; - /** Used to convert symbols to primitives and strings. */ var symbolProto = Symbol ? Symbol.prototype : undefined, symbolToString = symbolProto ? symbolProto.toString : undefined; @@ -217,19 +235,6 @@ function castSlice(array, start, end) { return (!start && end >= length) ? array : baseSlice(array, start, end); } -/** - * 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. * @@ -271,7 +276,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 @@ -331,7 +336,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); } /** @@ -353,8 +358,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; } @@ -362,16 +366,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); @@ -393,7 +396,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 @@ -548,11 +551,11 @@ function split(string, separator, limit) { (separator != null && !isRegExp(separator)) )) { separator = baseToString(separator); - if (separator == '' && reHasComplexSymbol.test(string)) { + if (!separator && hasUnicode(string)) { return castSlice(stringToArray(string), 0, limit); } } - return nativeSplit.call(string, separator, limit); + return string.split(separator, limit); } module.exports = split; diff --git a/lodash.split/package.json b/lodash.split/package.json index d0418b754..151fa5bd9 100644 --- a/lodash.split/package.json +++ b/lodash.split/package.json @@ -1,6 +1,6 @@ { "name": "lodash.split", - "version": "4.4.1", + "version": "4.4.2", "description": "The lodash method `_.split` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", diff --git a/lodash.truncate/README.md b/lodash.truncate/README.md index a5ac2ab7e..a2936e9af 100644 --- a/lodash.truncate/README.md +++ b/lodash.truncate/README.md @@ -1,4 +1,4 @@ -# lodash.truncate v4.4.1 +# lodash.truncate v4.4.2 The [lodash](https://lodash.com/) method `_.truncate` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var truncate = require('lodash.truncate'); ``` -See the [documentation](https://lodash.com/docs#truncate) or [package source](https://github.com/lodash/lodash/blob/4.4.1-npm-packages/lodash.truncate) for more details. +See the [documentation](https://lodash.com/docs#truncate) or [package source](https://github.com/lodash/lodash/blob/4.4.2-npm-packages/lodash.truncate) for more details. diff --git a/lodash.truncate/index.js b/lodash.truncate/index.js index 806996225..4f5449ecc 100644 --- a/lodash.truncate/index.js +++ b/lodash.truncate/index.js @@ -17,9 +17,7 @@ var INFINITY = 1 / 0, NAN = 0 / 0; /** `Object#toString` result references. */ -var funcTag = '[object Function]', - genTag = '[object GeneratorFunction]', - regexpTag = '[object RegExp]', +var regexpTag = '[object RegExp]', symbolTag = '[object Symbol]'; /** Used to match leading and trailing whitespace. */ @@ -61,10 +59,10 @@ var reOptMod = rsModifier + '?', rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')'; /** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */ -var reComplexSymbol = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g'); +var reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + 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 + rsComboMarksRange + rsComboSymbolsRange + rsVarRange + ']'); +var reHasUnicode = RegExp('[' + rsZWJ + rsAstralRange + rsComboMarksRange + rsComboSymbolsRange + rsVarRange + ']'); /** Built-in method references without a dependency on `root`. */ var freeParseInt = parseInt; @@ -100,6 +98,39 @@ var nodeUtil = (function() { /* Node.js helper references. */ var nodeIsRegExp = nodeUtil && nodeUtil.isRegExp; +/** + * Gets the size of an ASCII `string`. + * + * @private + * @param {string} string The string inspect. + * @returns {number} Returns the string size. + */ +var asciiSize = baseProperty('length'); + +/** + * Converts an ASCII `string` to an array. + * + * @private + * @param {string} string The string to convert. + * @returns {Array} Returns the converted array. + */ +function asciiToArray(string) { + return string.split(''); +} + +/** + * 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]; + }; +} + /** * The base implementation of `_.unary` without support for storing metadata. * @@ -113,6 +144,17 @@ function baseUnary(func) { }; } +/** + * Checks if `string` contains Unicode symbols. + * + * @private + * @param {string} string The string to inspect. + * @returns {boolean} Returns `true` if a symbol is found, else `false`. + */ +function hasUnicode(string) { + return reHasUnicode.test(string); +} + /** * Gets the number of symbols in `string`. * @@ -121,14 +163,9 @@ function baseUnary(func) { * @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; + return hasUnicode(string) + ? unicodeSize(string) + : asciiSize(string); } /** @@ -139,7 +176,35 @@ function stringSize(string) { * @returns {Array} Returns the converted array. */ function stringToArray(string) { - return string.match(reComplexSymbol); + return hasUnicode(string) + ? unicodeToArray(string) + : asciiToArray(string); +} + +/** + * Gets the size of a Unicode `string`. + * + * @private + * @param {string} string The string inspect. + * @returns {number} Returns the string size. + */ +function unicodeSize(string) { + var result = reUnicode.lastIndex = 0; + while (reUnicode.test(string)) { + result++; + } + return result; +} + +/** + * Converts a Unicode `string` to an array. + * + * @private + * @param {string} string The string to convert. + * @returns {Array} Returns the converted array. + */ +function unicodeToArray(string) { + return string.match(reUnicode) || []; } /** Used for built-in method references. */ @@ -147,7 +212,7 @@ 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; @@ -235,34 +300,9 @@ function castSlice(array, start, end) { return (!start && end >= length) ? array : baseSlice(array, start, end); } -/** - * Checks if `value` is classified as a `Function` object. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a function, 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 and weak map constructors, - // and PhantomJS 1.9 which returns 'function' for `NodeList` instances. - var tag = isObject(value) ? objectToString.call(value) : ''; - return tag == funcTag || tag == genTag; -} - /** * 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 +438,7 @@ function toFinite(value) { * Converts `value` to an integer. * * **Note:** This method is loosely based on - * [`ToInteger`](http://www.ecma-international.org/ecma-262/6.0/#sec-tointeger). + * [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger). * * @static * @memberOf _ @@ -458,7 +498,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') { @@ -545,7 +585,7 @@ function truncate(string, options) { string = toString(string); var strLength = string.length; - if (reHasComplexSymbol.test(string)) { + if (hasUnicode(string)) { var strSymbols = stringToArray(string); strLength = strSymbols.length; } diff --git a/lodash.truncate/package.json b/lodash.truncate/package.json index 0aca88280..2e2bd5313 100644 --- a/lodash.truncate/package.json +++ b/lodash.truncate/package.json @@ -1,6 +1,6 @@ { "name": "lodash.truncate", - "version": "4.4.1", + "version": "4.4.2", "description": "The lodash method `_.truncate` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", diff --git a/lodash.zipobjectdeep/README.md b/lodash.zipobjectdeep/README.md index b6e31aeef..e2131f5e5 100644 --- a/lodash.zipobjectdeep/README.md +++ b/lodash.zipobjectdeep/README.md @@ -1,4 +1,4 @@ -# lodash.zipobjectdeep v4.4.1 +# lodash.zipobjectdeep v4.4.2 The [lodash](https://lodash.com/) method `_.zipObjectDeep` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var zipObjectDeep = require('lodash.zipobjectdeep'); ``` -See the [documentation](https://lodash.com/docs#zipObjectDeep) or [package source](https://github.com/lodash/lodash/blob/4.4.1-npm-packages/lodash.zipobjectdeep) for more details. +See the [documentation](https://lodash.com/docs#zipObjectDeep) or [package source](https://github.com/lodash/lodash/blob/4.4.2-npm-packages/lodash.zipobjectdeep) for more details. diff --git a/lodash.zipobjectdeep/index.js b/lodash.zipobjectdeep/index.js index 38e13dda4..7b660b174 100644 --- a/lodash.zipobjectdeep/index.js +++ b/lodash.zipobjectdeep/index.js @@ -30,7 +30,7 @@ var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, /** * Used to match `RegExp` - * [syntax characters](http://ecma-international.org/ecma-262/6.0/#sec-patterns). + * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns). */ var reRegExpChar = /[\\^$.*+?()[\]{}|]/g; @@ -85,6 +85,7 @@ function isHostObject(value) { /** Used for built-in method references. */ var arrayProto = Array.prototype, + funcProto = Function.prototype, objectProto = Object.prototype; /** Used to detect overreaching core-js shims. */ @@ -97,14 +98,14 @@ var maskSrcKey = (function() { }()); /** Used to resolve the decompiled source of functions. */ -var funcToString = Function.prototype.toString; +var funcToString = funcProto.toString; /** Used to check objects for own properties. */ var hasOwnProperty = objectProto.hasOwnProperty; /** * 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; @@ -433,7 +434,7 @@ MapCache.prototype.set = mapCacheSet; /** * Assigns `value` to `key` of `object` if the existing value is not equivalent - * using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) + * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) * for equality comparisons. * * @private @@ -453,7 +454,7 @@ function assignValue(object, key, value) { * Gets the index at which the `key` is found in `array` of key-value pairs. * * @private - * @param {Array} array The array to search. + * @param {Array} array The array to inspect. * @param {*} key The key to search for. * @returns {number} Returns the index of the matched value, else `-1`. */ @@ -487,13 +488,16 @@ function baseIsNative(value) { * The base implementation of `_.set`. * * @private - * @param {Object} object The object to query. + * @param {Object} object The object to modify. * @param {Array|string} path The path of the property to set. * @param {*} value The value to set. * @param {Function} [customizer] The function to customize path creation. * @returns {Object} Returns `object`. */ function baseSet(object, path, value, customizer) { + if (!isObject(object)) { + return object; + } path = isKey(path, object) ? [path] : castPath(path); var index = -1, @@ -502,20 +506,19 @@ function baseSet(object, path, value, customizer) { nested = object; while (nested != null && ++index < length) { - var key = toKey(path[index]); - if (isObject(nested)) { - var newValue = value; - if (index != lastIndex) { - var objValue = nested[key]; - newValue = customizer ? customizer(objValue, key, nested) : undefined; - if (newValue === undefined) { - newValue = objValue == null - ? (isIndex(path[index + 1]) ? [] : {}) - : objValue; - } + var key = toKey(path[index]), + newValue = value; + + if (index != lastIndex) { + var objValue = nested[key]; + newValue = customizer ? customizer(objValue, key, nested) : undefined; + if (newValue === undefined) { + newValue = isObject(objValue) + ? objValue + : (isIndex(path[index + 1]) ? [] : {}); } - assignValue(nested, key, newValue); } + assignValue(nested, key, newValue); nested = nested[key]; } return object; @@ -746,7 +749,7 @@ function zipObjectDeep(props, values) { * **Note:** The cache is exposed as the `cache` property on the memoized * function. Its creation may be customized by replacing the `_.memoize.Cache` * constructor with one whose instances implement the - * [`Map`](http://ecma-international.org/ecma-262/6.0/#sec-properties-of-the-map-prototype-object) + * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object) * method interface of `delete`, `get`, `has`, and `set`. * * @static @@ -805,7 +808,7 @@ memoize.Cache = MapCache; /** * 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 @@ -883,15 +886,14 @@ var isArray = Array.isArray; */ 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; } /** * 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 diff --git a/lodash.zipobjectdeep/package.json b/lodash.zipobjectdeep/package.json index b71f3251d..3877850b3 100644 --- a/lodash.zipobjectdeep/package.json +++ b/lodash.zipobjectdeep/package.json @@ -1,6 +1,6 @@ { "name": "lodash.zipobjectdeep", - "version": "4.4.1", + "version": "4.4.2", "description": "The lodash method `_.zipObjectDeep` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg",