I searched my js code for .slice, and I think in every single case it could have been replaced by a single one of the take/takeLast/drop/dropLast operations.
Ie. there wasn't even one case where I actually dropped both the beginning and end of a String or Array, the thing that slice is optimized for.
And having to use Array.length is especially ugly indeed.
Btw, if/when you do make this change, it'd be nice to make the APIs of Array, List and String match more (String currently has left/right/dropLeft/dropRight for example.)
They are all lists of stuff after all!
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
I searched my js code for
.slice
, and I think in every single case it could have been replaced by a single one of the take/takeLast/drop/dropLast operations.Ie. there wasn't even one case where I actually dropped both the beginning and end of a String or Array, the thing that slice is optimized for.
And having to use Array.length is especially ugly indeed.
Btw, if/when you do make this change, it'd be nice to make the APIs of Array, List and String match more (String currently has left/right/dropLeft/dropRight for example.)
They are all lists of stuff after all!