mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-05 17:37:50 +00:00
Bump to v4.17.21
This commit is contained in:
6
trim.js
6
trim.js
@@ -1,13 +1,11 @@
|
||||
import baseToString from './_baseToString.js';
|
||||
import baseTrim from './_baseTrim.js';
|
||||
import castSlice from './_castSlice.js';
|
||||
import charsEndIndex from './_charsEndIndex.js';
|
||||
import charsStartIndex from './_charsStartIndex.js';
|
||||
import stringToArray from './_stringToArray.js';
|
||||
import toString from './toString.js';
|
||||
|
||||
/** Used to match leading and trailing whitespace. */
|
||||
var reTrim = /^\s+|\s+$/g;
|
||||
|
||||
/**
|
||||
* Removes leading and trailing whitespace or specified characters from `string`.
|
||||
*
|
||||
@@ -33,7 +31,7 @@ var reTrim = /^\s+|\s+$/g;
|
||||
function trim(string, chars, guard) {
|
||||
string = toString(string);
|
||||
if (string && (guard || chars === undefined)) {
|
||||
return string.replace(reTrim, '');
|
||||
return baseTrim(string);
|
||||
}
|
||||
if (!string || !(chars = baseToString(chars))) {
|
||||
return string;
|
||||
|
||||
Reference in New Issue
Block a user