You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
Returns a string made by inserting the separator between each element and concatenating all the elements into a single string. Before the concatenation happens, the values as compacted using using RA.compact.
Describe the solution you'd like
RA.compactJoin(', '['a','','b',null,'c',undefined,'d']);//=> 'a, b, c, d'
Describe alternatives you've considered
ad-hoc composition
Additional context Original issue description: join currently joins all values, even if undefined (or NaN, or null). How about a safe version that rejects undefined values before joining? Perhaps it could follow the same blacklist as compact, or could allow the blacklist to be configured.
We have already discussed about safe* functions with @guillaumearm in #38 (comment). I think these kind of functions may hide nasty errors because items from the array are implicitly lost before transformation. But safe doesn't tell us anything about this filtering. I can imagine having compactJoin, but would have to see more real world usecases and support for this. For more than 5 years I don't remember having to need something like this, because before I return from function I compact the result of the function and then pass it to higher levels of the app where join can transform them to string.
I would argue that is is just a way of being defensive if you don't entirely trust the values you want to joint, but I agree compactJoin is a better name. I'll leave open for now and try and dig up a usecase that will convince you.
Is your feature request related to a problem? Please describe.
Returns a string made by inserting the separator between each element and concatenating all the elements into a single string. Before the concatenation happens, the values as compacted using using RA.compact.
Describe the solution you'd like
Describe alternatives you've considered
ad-hoc composition
Additional context
Original issue description:
join
currently joins all values, even ifundefined
(orNaN
, ornull
). How about a safe version that rejects undefined values before joining? Perhaps it could follow the same blacklist as compact, or could allow the blacklist to be configured.REPL
The text was updated successfully, but these errors were encountered: