PIbd-22.-Stroev-V.M.-Intern.../Lab2/node_modules/lodash/_baseTrim.js

20 lines
444 B
JavaScript
Raw Normal View History

2023-10-28 01:49:09 +04:00
var trimmedEndIndex = require('./_trimmedEndIndex');
/** 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;
}
module.exports = baseTrim;