diff --git a/README.md b/README.md index a8ab08d6c..da1533de7 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# lodash v3.3.5 +# lodash v3.3.6 The [lodash](https://lodash.com/) library exported as [npm packages](https://www.npmjs.com/browse/keyword/lodash-modularized) per method. diff --git a/lodash.fill/README.md b/lodash.fill/README.md index 8ceae630c..070c2eb8b 100644 --- a/lodash.fill/README.md +++ b/lodash.fill/README.md @@ -1,4 +1,4 @@ -# lodash.fill v3.3.5 +# lodash.fill v3.3.6 The [lodash](https://lodash.com/) method `_.fill` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var fill = require('lodash.fill'); ``` -See the [documentation](https://lodash.com/docs#fill) or [package source](https://github.com/lodash/lodash/blob/3.3.5-npm-packages/lodash.fill) for more details. +See the [documentation](https://lodash.com/docs#fill) or [package source](https://github.com/lodash/lodash/blob/3.3.6-npm-packages/lodash.fill) for more details. diff --git a/lodash.fill/index.js b/lodash.fill/index.js index 027da743d..440669d27 100644 --- a/lodash.fill/index.js +++ b/lodash.fill/index.js @@ -1,5 +1,5 @@ /** - * lodash 3.3.5 (Custom Build) + * lodash (Custom Build) * Build: `lodash modularize exports="npm" -o ./` * Copyright jQuery Foundation and other contributors * Released under MIT license @@ -103,7 +103,7 @@ function baseFill(array, value, start, end) { * * @private * @param {string} key The key of the property to get. - * @returns {Function} Returns the new function. + * @returns {Function} Returns the new accessor function. */ function baseProperty(key) { return function(object) { @@ -408,6 +408,41 @@ function isSymbol(value) { (isObjectLike(value) && objectToString.call(value) == symbolTag); } +/** + * Converts `value` to a finite number. + * + * @static + * @memberOf _ + * @since 4.12.0 + * @category Lang + * @param {*} value The value to convert. + * @returns {number} Returns the converted number. + * @example + * + * _.toFinite(3.2); + * // => 3.2 + * + * _.toFinite(Number.MIN_VALUE); + * // => 5e-324 + * + * _.toFinite(Infinity); + * // => 1.7976931348623157e+308 + * + * _.toFinite('3.2'); + * // => 3.2 + */ +function toFinite(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; + } + return value === value ? value : 0; +} + /** * Converts `value` to an integer. * @@ -422,7 +457,7 @@ function isSymbol(value) { * @returns {number} Returns the converted integer. * @example * - * _.toInteger(3); + * _.toInteger(3.2); * // => 3 * * _.toInteger(Number.MIN_VALUE); @@ -431,20 +466,14 @@ function isSymbol(value) { * _.toInteger(Infinity); * // => 1.7976931348623157e+308 * - * _.toInteger('3'); + * _.toInteger('3.2'); * // => 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; + var result = toFinite(value), + remainder = result % 1; + + return result === result ? (remainder ? result - remainder : result) : 0; } /** @@ -462,7 +491,7 @@ function toInteger(value) { * @returns {number} Returns the converted integer. * @example * - * _.toLength(3); + * _.toLength(3.2); * // => 3 * * _.toLength(Number.MIN_VALUE); @@ -471,7 +500,7 @@ function toInteger(value) { * _.toLength(Infinity); * // => 4294967295 * - * _.toLength('3'); + * _.toLength('3.2'); * // => 3 */ function toLength(value) { @@ -489,8 +518,8 @@ function toLength(value) { * @returns {number} Returns the number. * @example * - * _.toNumber(3); - * // => 3 + * _.toNumber(3.2); + * // => 3.2 * * _.toNumber(Number.MIN_VALUE); * // => 5e-324 @@ -498,8 +527,8 @@ function toLength(value) { * _.toNumber(Infinity); * // => Infinity * - * _.toNumber('3'); - * // => 3 + * _.toNumber('3.2'); + * // => 3.2 */ function toNumber(value) { if (typeof value == 'number') { diff --git a/lodash.fill/package.json b/lodash.fill/package.json index d61315f24..4fdc2925f 100644 --- a/lodash.fill/package.json +++ b/lodash.fill/package.json @@ -1,6 +1,6 @@ { "name": "lodash.fill", - "version": "3.3.5", + "version": "3.3.6", "description": "The lodash method `_.fill` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", diff --git a/lodash.inrange/README.md b/lodash.inrange/README.md index ffc7d1eb7..6a2095ba5 100644 --- a/lodash.inrange/README.md +++ b/lodash.inrange/README.md @@ -1,4 +1,4 @@ -# lodash.inrange v3.3.5 +# lodash.inrange v3.3.6 The [lodash](https://lodash.com/) method `_.inRange` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var inRange = require('lodash.inrange'); ``` -See the [documentation](https://lodash.com/docs#inRange) or [package source](https://github.com/lodash/lodash/blob/3.3.5-npm-packages/lodash.inrange) for more details. +See the [documentation](https://lodash.com/docs#inRange) or [package source](https://github.com/lodash/lodash/blob/3.3.6-npm-packages/lodash.inrange) for more details. diff --git a/lodash.inrange/index.js b/lodash.inrange/index.js index 3990fbc9f..6219ee1d6 100644 --- a/lodash.inrange/index.js +++ b/lodash.inrange/index.js @@ -13,9 +13,7 @@ var INFINITY = 1 / 0, NAN = 0 / 0; /** `Object#toString` result references. */ -var funcTag = '[object Function]', - genTag = '[object GeneratorFunction]', - symbolTag = '[object Symbol]'; +var symbolTag = '[object Symbol]'; /** Used to match leading and trailing whitespace. */ var reTrim = /^\s+|\s+$/g; @@ -37,7 +35,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; @@ -59,34 +57,9 @@ function baseInRange(number, start, end) { return number >= nativeMin(start, end) && number < nativeMax(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 @@ -230,7 +203,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.inrange/package.json b/lodash.inrange/package.json index da310a4cf..7bce517d1 100644 --- a/lodash.inrange/package.json +++ b/lodash.inrange/package.json @@ -1,6 +1,6 @@ { "name": "lodash.inrange", - "version": "3.3.5", + "version": "3.3.6", "description": "The lodash method `_.inRange` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg",