node_modules/lodash/trimEnd.js in trusty-cms-4.2.2 vs node_modules/lodash/trimEnd.js in trusty-cms-4.2.3
- old
+ new
@@ -1,14 +1,12 @@
var baseToString = require('./_baseToString'),
castSlice = require('./_castSlice'),
charsEndIndex = require('./_charsEndIndex'),
stringToArray = require('./_stringToArray'),
- toString = require('./toString');
+ toString = require('./toString'),
+ trimmedEndIndex = require('./_trimmedEndIndex');
-/** Used to match leading and trailing whitespace. */
-var reTrimEnd = /\s+$/;
-
/**
* Removes trailing whitespace or specified characters from `string`.
*
* @static
* @memberOf _
@@ -27,10 +25,10 @@
* // => '-_-abc'
*/
function trimEnd(string, chars, guard) {
string = toString(string);
if (string && (guard || chars === undefined)) {
- return string.replace(reTrimEnd, '');
+ return string.slice(0, trimmedEndIndex(string) + 1);
}
if (!string || !(chars = baseToString(chars))) {
return string;
}
var strSymbols = stringToArray(string),