* 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)
| 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`. |
nothing calls this directly
no test coverage detected