lodash.random
Advanced tools
Comparing version 3.1.6 to 3.1.7
43
index.js
@@ -11,3 +11,5 @@ /** | ||
/** Used as references for various `Number` constants. */ | ||
var MAX_SAFE_INTEGER = 9007199254740991, | ||
var INFINITY = 1 / 0, | ||
MAX_SAFE_INTEGER = 9007199254740991, | ||
MAX_INTEGER = 1.7976931348623157e+308, | ||
NAN = 0 / 0; | ||
@@ -335,2 +337,37 @@ | ||
/** | ||
* 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 a number. | ||
@@ -429,3 +466,3 @@ * | ||
else { | ||
lower = toNumber(lower) || 0; | ||
lower = toFinite(lower); | ||
if (upper === undefined) { | ||
@@ -435,3 +472,3 @@ upper = lower; | ||
} else { | ||
upper = toNumber(upper) || 0; | ||
upper = toFinite(upper); | ||
} | ||
@@ -438,0 +475,0 @@ } |
{ | ||
"name": "lodash.random", | ||
"version": "3.1.6", | ||
"version": "3.1.7", | ||
"description": "The lodash method `_.random` exported as a module.", | ||
@@ -5,0 +5,0 @@ "homepage": "https://lodash.com/", |
@@ -1,2 +0,2 @@ | ||
# lodash.random v3.1.6 | ||
# lodash.random v3.1.7 | ||
@@ -18,2 +18,2 @@ The [lodash](https://lodash.com/) method `_.random` exported as a [Node.js](https://nodejs.org/) module. | ||
See the [documentation](https://lodash.com/docs#random) or [package source](https://github.com/lodash/lodash/blob/3.1.6-npm-packages/lodash.random) for more details. | ||
See the [documentation](https://lodash.com/docs#random) or [package source](https://github.com/lodash/lodash/blob/3.1.7-npm-packages/lodash.random) for more details. |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
15398
457