trimEnd()
trimEnd(
str):string
Removes trailing whitespace from a string.
DEPRECATED
Use string.trimEnd() directly instead.
Parameters
str: string | null | undefined
The string to trim.
Returns: string
The trimmed string.
See Also
Since
2.0.0
Also known as
trimEnd (Lodash, es-toolkit, Effect, Modern Dash) · ❌ (Remeda, Radashi, Ramda, Antfu)
Example
// ❌ Deprecated approach
trimEnd(' hello '); // => ' hello'
// ✅ Recommended approach
' hello '.trimEnd(); // => ' hello'
How it works?
Removes whitespace from end of string.
Deprecated: Use string.trimEnd() directly (ES2019).
Native Equivalent
// ❌ trimEnd(str)
// ✅ str.trimEnd()
Use Cases
Trim trailing whitespace 📌
Remove trailing whitespace.
' hello '.trimEnd(); // ' hello'
Clean output
Remove trailing spaces from output.
const cleaned = output.trimEnd();