Change trim
to require its 2nd argument
#68
aleclarson
announced in
RFCs
Replies: 1 comment
-
Radashi First of all it could accept null and undefined as first argument which makes this function also a typecasting function which is wierd. trim(undefined) // '' Second thing is that it does not behave like trim in all other languages/libraries. This is related to what you are talking about. The second argument must be In my opinion default to |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
The implicit behavior could be misinterpreted as doing exactly what
String.prototype.trim
does or just confuse someone who isn't familiar with Radashi. Most of the time, if you're trimming" "
characters, you're also trimming other whitespace (\r
,\t
,\n
).The bottom line is: Explicit is better.
Beta Was this translation helpful? Give feedback.
All reactions