MCPcopy
hub / github.com/lodash/lodash / trimEnd

Function trimEnd

lodash.js:15112–15124  ·  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 trim. * @param- {Object} [

(string, chars, guard)

Source from the content-addressed store, hash-verified

15110 * // => '-_-abc'
15111 */
15112 function trimEnd(string, chars, guard) {
15113 string = toString(string);
15114 if (string && (guard || chars === undefined)) {
15115 return string.slice(0, trimmedEndIndex(string) + 1);
15116 }
15117 if (!string || !(chars = baseToString(chars))) {
15118 return string;
15119 }
15120 var strSymbols = stringToArray(string),
15121 end = charsEndIndex(strSymbols, stringToArray(chars)) + 1;
15122
15123 return castSlice(strSymbols, 0, end).join('');
15124 }
15125
15126 /**
15127 * Removes leading whitespace or specified characters from `string`.

Callers

nothing calls this directly

Calls 6

toStringFunction · 0.85
trimmedEndIndexFunction · 0.85
baseToStringFunction · 0.85
stringToArrayFunction · 0.85
charsEndIndexFunction · 0.85
castSliceFunction · 0.85

Tested by

no test coverage detected