mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-06 17:47:49 +00:00
Bump to v4.2.0.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
# lodash.trimstart v4.1.1
|
||||
# lodash.trimstart v4.2.0
|
||||
|
||||
The [lodash](https://lodash.com/) method `_.trimStart` exported as a [Node.js](https://nodejs.org/) module.
|
||||
|
||||
@@ -15,4 +15,4 @@ In Node.js:
|
||||
var trimStart = require('lodash.trimstart');
|
||||
```
|
||||
|
||||
See the [documentation](https://lodash.com/docs#trimStart) or [package source](https://github.com/lodash/lodash/blob/4.1.1-npm-packages/lodash.trimstart) for more details.
|
||||
See the [documentation](https://lodash.com/docs#trimStart) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.trimstart) for more details.
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
/**
|
||||
* lodash 4.1.1 (Custom Build) <https://lodash.com/>
|
||||
* lodash 4.2.0 (Custom Build) <https://lodash.com/>
|
||||
* Build: `lodash modularize exports="npm" -o ./`
|
||||
* Copyright 2012-2016 The Dojo Foundation <http://dojofoundation.org/>
|
||||
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
||||
* Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
||||
* Available under MIT license <https://lodash.com/license>
|
||||
*/
|
||||
var charsStartIndex = require('lodash._charsstartindex'),
|
||||
toString = require('lodash.tostring');
|
||||
var toString = require('lodash.tostring');
|
||||
|
||||
/** Used to match leading and trailing whitespace. */
|
||||
var reTrimStart = /^\s+/;
|
||||
@@ -38,6 +37,69 @@ var reOptMod = rsModifier + '?',
|
||||
/** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */
|
||||
var reComplexSymbol = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g');
|
||||
|
||||
/**
|
||||
* The base implementation of `_.indexOf` without `fromIndex` bounds checks.
|
||||
*
|
||||
* @private
|
||||
* @param {Array} array The array to search.
|
||||
* @param {*} value The value to search for.
|
||||
* @param {number} fromIndex The index to search from.
|
||||
* @returns {number} Returns the index of the matched value, else `-1`.
|
||||
*/
|
||||
function baseIndexOf(array, value, fromIndex) {
|
||||
if (value !== value) {
|
||||
return indexOfNaN(array, fromIndex);
|
||||
}
|
||||
var index = fromIndex - 1,
|
||||
length = array.length;
|
||||
|
||||
while (++index < length) {
|
||||
if (array[index] === value) {
|
||||
return index;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Used by `_.trim` and `_.trimStart` to get the index of the first string symbol
|
||||
* that is not found in the character symbols.
|
||||
*
|
||||
* @private
|
||||
* @param {Array} strSymbols The string symbols to inspect.
|
||||
* @param {Array} chrSymbols The character symbols to find.
|
||||
* @returns {number} Returns the index of the first unmatched string symbol.
|
||||
*/
|
||||
function charsStartIndex(strSymbols, chrSymbols) {
|
||||
var index = -1,
|
||||
length = strSymbols.length;
|
||||
|
||||
while (++index < length && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}
|
||||
return index;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the index at which the first occurrence of `NaN` is found in `array`.
|
||||
*
|
||||
* @private
|
||||
* @param {Array} array The array to search.
|
||||
* @param {number} fromIndex The index to search from.
|
||||
* @param {boolean} [fromRight] Specify iterating from right to left.
|
||||
* @returns {number} Returns the index of the matched `NaN`, else `-1`.
|
||||
*/
|
||||
function indexOfNaN(array, fromIndex, fromRight) {
|
||||
var length = array.length,
|
||||
index = fromIndex + (fromRight ? 0 : -1);
|
||||
|
||||
while ((fromRight ? index-- : ++index < length)) {
|
||||
var other = array[index];
|
||||
if (other !== other) {
|
||||
return index;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts `string` to an array.
|
||||
*
|
||||
@@ -54,10 +116,11 @@ function stringToArray(string) {
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @since 4.0.0
|
||||
* @category String
|
||||
* @param {string} [string=''] The string to trim.
|
||||
* @param {string} [chars=whitespace] The characters to trim.
|
||||
* @param- {Object} [guard] Enables use as an iteratee for functions like `_.map`.
|
||||
* @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
|
||||
* @returns {string} Returns the trimmed string.
|
||||
* @example
|
||||
*
|
||||
@@ -80,7 +143,9 @@ function trimStart(string, chars, guard) {
|
||||
return string;
|
||||
}
|
||||
var strSymbols = stringToArray(string);
|
||||
return strSymbols.slice(charsStartIndex(strSymbols, stringToArray(chars))).join('');
|
||||
return strSymbols
|
||||
.slice(charsStartIndex(strSymbols, stringToArray(chars)))
|
||||
.join('');
|
||||
}
|
||||
|
||||
module.exports = trimStart;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "lodash.trimstart",
|
||||
"version": "4.1.1",
|
||||
"version": "4.2.0",
|
||||
"description": "The lodash method `_.trimStart` exported as a module.",
|
||||
"homepage": "https://lodash.com/",
|
||||
"icon": "https://lodash.com/icon.svg",
|
||||
@@ -15,7 +15,6 @@
|
||||
"repository": "lodash/lodash",
|
||||
"scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" },
|
||||
"dependencies": {
|
||||
"lodash._charsstartindex": "^4.0.0",
|
||||
"lodash.tostring": "^4.0.0"
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user