lodash.pad
Advanced tools
Comparing version 4.3.0 to 4.4.0
66
index.js
/** | ||
* lodash 4.3.0 (Custom Build) <https://lodash.com/> | ||
* lodash (Custom Build) <https://lodash.com/> | ||
* Build: `lodash modularize exports="npm" -o ./` | ||
@@ -10,2 +10,3 @@ * Copyright jQuery Foundation and other contributors <https://jquery.org/> | ||
var baseSlice = require('lodash._baseslice'), | ||
baseToString = require('lodash._basetostring'), | ||
toString = require('lodash.tostring'); | ||
@@ -164,3 +165,3 @@ | ||
function createPadding(length, chars) { | ||
chars = chars === undefined ? ' ' : (chars + ''); | ||
chars = chars === undefined ? ' ' : baseToString(chars); | ||
@@ -285,2 +286,37 @@ var charsLength = chars.length; | ||
/** | ||
* 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. | ||
@@ -299,3 +335,3 @@ * | ||
* | ||
* _.toInteger(3); | ||
* _.toInteger(3.2); | ||
* // => 3 | ||
@@ -309,16 +345,10 @@ * | ||
* | ||
* _.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; | ||
} | ||
@@ -337,4 +367,4 @@ | ||
* | ||
* _.toNumber(3); | ||
* // => 3 | ||
* _.toNumber(3.2); | ||
* // => 3.2 | ||
* | ||
@@ -347,4 +377,4 @@ * _.toNumber(Number.MIN_VALUE); | ||
* | ||
* _.toNumber('3'); | ||
* // => 3 | ||
* _.toNumber('3.2'); | ||
* // => 3.2 | ||
*/ | ||
@@ -351,0 +381,0 @@ function toNumber(value) { |
{ | ||
"name": "lodash.pad", | ||
"version": "4.3.0", | ||
"version": "4.4.0", | ||
"description": "The lodash method `_.pad` exported as a module.", | ||
@@ -19,4 +19,5 @@ "homepage": "https://lodash.com/", | ||
"lodash._baseslice": "~4.0.0", | ||
"lodash._basetostring": "~4.12.0", | ||
"lodash.tostring": "^4.0.0" | ||
} | ||
} |
@@ -1,2 +0,2 @@ | ||
# lodash.pad v4.3.0 | ||
# lodash.pad v4.4.0 | ||
@@ -18,2 +18,2 @@ The [lodash](https://lodash.com/) method `_.pad` exported as a [Node.js](https://nodejs.org/) module. | ||
See the [documentation](https://lodash.com/docs#pad) or [package source](https://github.com/lodash/lodash/blob/4.3.0-npm-packages/lodash.pad) for more details. | ||
See the [documentation](https://lodash.com/docs#pad) or [package source](https://github.com/lodash/lodash/blob/4.4.0-npm-packages/lodash.pad) for more details. |
14800
401
3
+ Addedlodash._basetostring@~4.12.0
+ Addedlodash._basetostring@4.12.0(transitive)