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

Function trimEnd

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

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

(string, chars, guard)

Source from the content-addressed store, hash-verified

25609 * // => '-_-abc'
25610 */
25611 function trimEnd(string, chars, guard) {
25612 string = toString(string);
25613 if (string && (guard || chars === undefined)) {
25614 return string.replace(reTrimEnd, '');
25615 }
25616 if (!string || !(chars = baseToString(chars))) {
25617 return string;
25618 }
25619 var strSymbols = stringToArray(string),
25620 end = charsEndIndex(strSymbols, stringToArray(chars)) + 1;
25621
25622 return castSlice(strSymbols, 0, end).join('');
25623 }
25624
25625 /**
25626 * Removes leading whitespace or specified characters from `string`.

Callers

nothing calls this directly

Calls 5

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

Tested by

no test coverage detected