You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
442 B
20 lines
442 B
1 month ago
|
import trimmedEndIndex from './_trimmedEndIndex.js';
|
||
|
|
||
|
/** Used to match leading whitespace. */
|
||
|
var reTrimStart = /^\s+/;
|
||
|
|
||
|
/**
|
||
|
* The base implementation of `_.trim`.
|
||
|
*
|
||
|
* @private
|
||
|
* @param {string} string The string to trim.
|
||
|
* @returns {string} Returns the trimmed string.
|
||
|
*/
|
||
|
function baseTrim(string) {
|
||
|
return string
|
||
|
? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart, '')
|
||
|
: string;
|
||
|
}
|
||
|
|
||
|
export default baseTrim;
|