Bump to v4.2.0.

This commit is contained in:
John-David Dalton
2016-04-07 23:43:26 -07:00
parent 3c2a06a119
commit fdf249c94e
562 changed files with 23863 additions and 21738 deletions

View File

@@ -1,4 +1,4 @@
# lodash.trim v4.1.1
# lodash.trim v4.2.0
The [lodash](https://lodash.com/) method `_.trim` exported as a [Node.js](https://nodejs.org/) module.
@@ -15,4 +15,4 @@ In Node.js:
var trim = require('lodash.trim');
```
See the [documentation](https://lodash.com/docs#trim) or [package source](https://github.com/lodash/lodash/blob/4.1.1-npm-packages/lodash.trim) for more details.
See the [documentation](https://lodash.com/docs#trim) or [package source](https://github.com/lodash/lodash/blob/4.2.0-npm-packages/lodash.trim) for more details.

View File

@@ -1,14 +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 charsEndIndex = require('lodash._charsendindex'),
charsStartIndex = require('lodash._charsstartindex'),
toString = require('lodash.tostring');
var toString = require('lodash.tostring');
/** Used to match leading and trailing whitespace. */
var reTrim = /^\s+|\s+$/g;
@@ -39,6 +37,85 @@ 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;
}
/**
* Used by `_.trim` and `_.trimEnd` to get the index of the last 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 last unmatched string symbol.
*/
function charsEndIndex(strSymbols, chrSymbols) {
var index = strSymbols.length;
while (index-- && 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.
*
@@ -55,10 +132,11 @@ function stringToArray(string) {
*
* @static
* @memberOf _
* @since 3.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
*
@@ -86,7 +164,9 @@ function trim(string, chars, guard) {
var strSymbols = stringToArray(string),
chrSymbols = stringToArray(chars);
return strSymbols.slice(charsStartIndex(strSymbols, chrSymbols), charsEndIndex(strSymbols, chrSymbols) + 1).join('');
return strSymbols
.slice(charsStartIndex(strSymbols, chrSymbols), charsEndIndex(strSymbols, chrSymbols) + 1)
.join('');
}
module.exports = trim;

View File

@@ -1,6 +1,6 @@
{
"name": "lodash.trim",
"version": "4.1.1",
"version": "4.2.0",
"description": "The lodash method `_.trim` exported as a module.",
"homepage": "https://lodash.com/",
"icon": "https://lodash.com/icon.svg",
@@ -15,8 +15,6 @@
"repository": "lodash/lodash",
"scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" },
"dependencies": {
"lodash._charsendindex": "^4.0.0",
"lodash._charsstartindex": "^4.0.0",
"lodash.tostring": "^4.0.0"
}
}