trimEnd es-toolkit
Removes whitespace or specified characters from the end of a string.
Usage
trimEnd(str, chars?)
Use trimEnd when you want to remove unnecessary characters from the end of a string. If no specific characters are specified, it removes whitespace characters.
When you specify multiple characters as an array, all characters that match any of them will be removed.
Parameters
The string from which to remove characters from the end.
The characters to remove. Can be a string or an array of characters. Defaults to whitespace characters.
Returns
Returns a new string with the specified characters removed from the end.
Errors
Throws an error if chars is a string with a length other than 1.
Source: es-toolkit
Re-exported verbatim from es-toolkit. Implementation, edge cases, and performance behavior are owned upstream. This page mirrors the documentation at the pinned version; the linked source is authoritative.