lodash.startswith
Advanced tools
Comparing version 4.0.1 to 4.1.0
76
index.js
/** | ||
* lodash 4.0.1 (Custom Build) <https://lodash.com/> | ||
* lodash (Custom Build) <https://lodash.com/> | ||
* Build: `lodash modularize exports="npm" -o ./` | ||
@@ -9,3 +9,4 @@ * Copyright jQuery Foundation and other contributors <https://jquery.org/> | ||
*/ | ||
var toString = require('lodash.tostring'); | ||
var baseToString = require('lodash._basetostring'), | ||
toString = require('lodash.tostring'); | ||
@@ -41,3 +42,4 @@ /** Used as references for various `Number` constants. */ | ||
/** | ||
* Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) | ||
* Used to resolve the | ||
* [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) | ||
* of values. | ||
@@ -95,4 +97,5 @@ */ | ||
/** | ||
* 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('')`) | ||
* Checks if `value` is the | ||
* [language type](http://www.ecma-international.org/ecma-262/6.0/#sec-ecmascript-language-types) | ||
* of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) | ||
* | ||
@@ -176,2 +179,37 @@ * @static | ||
/** | ||
* 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. | ||
@@ -190,3 +228,3 @@ * | ||
* | ||
* _.toInteger(3); | ||
* _.toInteger(3.2); | ||
* // => 3 | ||
@@ -200,16 +238,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; | ||
} | ||
@@ -228,4 +260,4 @@ | ||
* | ||
* _.toNumber(3); | ||
* // => 3 | ||
* _.toNumber(3.2); | ||
* // => 3.2 | ||
* | ||
@@ -238,4 +270,4 @@ * _.toNumber(Number.MIN_VALUE); | ||
* | ||
* _.toNumber('3'); | ||
* // => 3 | ||
* _.toNumber('3.2'); | ||
* // => 3.2 | ||
*/ | ||
@@ -289,5 +321,5 @@ function toNumber(value) { | ||
position = baseClamp(toInteger(position), 0, string.length); | ||
return string.lastIndexOf(target, position) == position; | ||
return string.lastIndexOf(baseToString(target), position) == position; | ||
} | ||
module.exports = startsWith; |
{ | ||
"name": "lodash.startswith", | ||
"version": "4.0.1", | ||
"version": "4.1.0", | ||
"description": "The lodash method `_.startsWith` exported as a module.", | ||
@@ -18,4 +18,5 @@ "homepage": "https://lodash.com/", | ||
"dependencies": { | ||
"lodash._basetostring": "~4.12.0", | ||
"lodash.tostring": "^4.0.0" | ||
} | ||
} |
@@ -1,2 +0,2 @@ | ||
# lodash.startswith v4.0.1 | ||
# lodash.startswith v4.1.0 | ||
@@ -18,2 +18,2 @@ The [lodash](https://lodash.com/) method `_.startsWith` exported as a [Node.js](https://nodejs.org/) module. | ||
See the [documentation](https://lodash.com/docs#startsWith) or [package source](https://github.com/lodash/lodash/blob/4.0.1-npm-packages/lodash.startswith) for more details. | ||
See the [documentation](https://lodash.com/docs#startsWith) or [package source](https://github.com/lodash/lodash/blob/4.1.0-npm-packages/lodash.startswith) for more details. |
10936
296
2
+ Addedlodash._basetostring@~4.12.0
+ Addedlodash._basetostring@4.12.0(transitive)