lodash.trim
Advanced tools
Comparing version 4.2.0 to 4.3.0
40
index.js
/** | ||
* lodash 4.2.0 (Custom Build) <https://lodash.com/> | ||
* lodash 4.3.0 (Custom Build) <https://lodash.com/> | ||
* Build: `lodash modularize exports="npm" -o ./` | ||
* Copyright 2012-2016 The Dojo Foundation <http://dojofoundation.org/> | ||
* Copyright jQuery Foundation and other contributors <https://jquery.org/> | ||
* Released under MIT license <https://lodash.com/license> | ||
* 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> | ||
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors | ||
*/ | ||
var toString = require('lodash.tostring'); | ||
var baseSlice = require('lodash._baseslice'), | ||
toString = require('lodash.tostring'); | ||
@@ -131,2 +132,17 @@ /** Used to match leading and trailing whitespace. */ | ||
/** | ||
* Casts `array` to a slice if it's needed. | ||
* | ||
* @private | ||
* @param {Array} array The array to inspect. | ||
* @param {number} start The start position. | ||
* @param {number} [end=array.length] The end position. | ||
* @returns {Array} Returns the cast slice. | ||
*/ | ||
function castSlice(array, start, end) { | ||
var length = array.length; | ||
end = end === undefined ? length : end; | ||
return (!start && end >= length) ? array : baseSlice(array, start, end); | ||
} | ||
/** | ||
* Removes leading and trailing whitespace or specified characters from `string`. | ||
@@ -136,6 +152,7 @@ * | ||
* @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. | ||
@@ -161,14 +178,13 @@ * @example | ||
} | ||
chars = (chars + ''); | ||
if (!chars) { | ||
if (!(chars += '')) { | ||
return string; | ||
} | ||
var strSymbols = stringToArray(string), | ||
chrSymbols = stringToArray(chars); | ||
chrSymbols = stringToArray(chars), | ||
start = charsStartIndex(strSymbols, chrSymbols), | ||
end = charsEndIndex(strSymbols, chrSymbols) + 1; | ||
return strSymbols | ||
.slice(charsStartIndex(strSymbols, chrSymbols), charsEndIndex(strSymbols, chrSymbols) + 1) | ||
.join(''); | ||
return castSlice(strSymbols, start, end).join(''); | ||
} | ||
module.exports = trim; |
{ | ||
"name": "lodash.trim", | ||
"version": "4.2.0", | ||
"version": "4.3.0", | ||
"description": "The lodash method `_.trim` exported as a module.", | ||
@@ -12,3 +12,3 @@ "homepage": "https://lodash.com/", | ||
"John-David Dalton <john.david.dalton@gmail.com> (http://allyoucanleet.com/)", | ||
"Blaine Bublitz <blaine@iceddev.com> (https://github.com/phated)", | ||
"Blaine Bublitz <blaine.bublitz@gmail.com> (https://github.com/phated)", | ||
"Mathias Bynens <mathias@qiwi.be> (https://mathiasbynens.be/)" | ||
@@ -19,4 +19,5 @@ ], | ||
"dependencies": { | ||
"lodash._baseslice": "~4.0.0", | ||
"lodash.tostring": "^4.0.0" | ||
} | ||
} |
@@ -1,2 +0,2 @@ | ||
# lodash.trim v4.2.0 | ||
# lodash.trim v4.3.0 | ||
@@ -18,2 +18,2 @@ The [lodash](https://lodash.com/) method `_.trim` exported as a [Node.js](https://nodejs.org/) module. | ||
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. | ||
See the [documentation](https://lodash.com/docs#trim) or [package source](https://github.com/lodash/lodash/blob/4.3.0-npm-packages/lodash.trim) for more details. |
Sorry, the diff of this file is not supported yet
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
Mixed license
License(Experimental) Package contains multiple licenses.
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
9077
169
2
1
+ Addedlodash._baseslice@~4.0.0
+ Addedlodash._baseslice@4.0.0(transitive)