MCPcopy Index your code
hub / github.com/deployd/deployd / trim

Function trim

test-app/public/sinon.js:25576–25590  ·  view source on GitHub ↗

* Removes leading and trailing whitespace or specified characters from `string`. * * @static * @memberOf _ * @since 3.0.0 * @category String * @param {string} [string=''] The string to trim. * @param {string} [chars=whitespace] The chara

(string, chars, guard)

Source from the content-addressed store, hash-verified

25574 * // => ['foo', 'bar']
25575 */
25576 function trim(string, chars, guard) {
25577 string = toString(string);
25578 if (string && (guard || chars === undefined)) {
25579 return string.replace(reTrim, '');
25580 }
25581 if (!string || !(chars = baseToString(chars))) {
25582 return string;
25583 }
25584 var strSymbols = stringToArray(string),
25585 chrSymbols = stringToArray(chars),
25586 start = charsStartIndex(strSymbols, chrSymbols),
25587 end = charsEndIndex(strSymbols, chrSymbols) + 1;
25588
25589 return castSlice(strSymbols, start, end).join('');
25590 }
25591
25592 /**
25593 * Removes trailing whitespace or specified characters from `string`.

Callers

nothing calls this directly

Calls 6

baseToStringFunction · 0.85
stringToArrayFunction · 0.85
charsStartIndexFunction · 0.85
charsEndIndexFunction · 0.85
castSliceFunction · 0.85
toStringFunction · 0.70

Tested by

no test coverage detected