Closed millermedeiros closed 12 years ago
Any idea of what to name the generic function? Maybe array/joinPath
(but this doesn't really emphasize that it can be used with other separators). I was thinking of working on this. Also, the isValidString
helper function in makePath
should probably be moved to a public module, maybe string/notEmpty
or string/isEmpty
.
unsure about the name, I was considering maybe just naming it join()
since it is basically the way I would like Array#join
to work on most cases, but joinPath()
and joinSegments()
would also make sense.
I didn't created a string/isEmpty()
since we can easily compare with str === ''
(easier to type). I think a generic lang/isEmpty()
would be more useful (which checked for empty arrays, empty objects and empty strings). For now I would probably keep the internal isValidString
or avoid the filter
altogether and just do a simple loop or change it to a reduce
.
makePath could be easily abstract to accept any kind of separator and not only
"/"
.Maybe it should be on the array package and accept a single array instead of multiple arguments. It would be an advanced
Array#join()
.