-
Notifications
You must be signed in to change notification settings - Fork 194
Open
Description
From an API point of view, I think the current signature of trim is misleading. Per the documentation:
Trim also handles more than one character to trim.
trim('222__hello__111', '12_') // => helloAt first, I thought that using '12_' as the second argument would trim the target string if it starts and/or ends with the substring 12_; not that every character from '12_' are trimmed from the target. I'd found if more logical that the second argument is an array of potential character/string to be trimmed.
For example:
trim('222__hello__111', ['1', '2', '_']) // => hello
// Or
trim('222__hello__111', Array.from('12_')) // => helloI know that this would break the current API and would need to deprecate the current signature but this looks more natural/logical.
What do you think?
Metadata
Metadata
Assignees
Labels
No labels