Negative arguments for take and drop are handled inconsistently
sharkdp opened this issue · 1 comments
sharkdp commented
Specifically, we currently have:
take (-2) "abcdef" == ""
drop (-2) "abcdef" == "ef"In my opinion, the take behavior is fine (same result as for take 0) while the drop behavior seems weird.
I would suggest replacing the current implementation
exports.drop = function (n) {
return function (s) {
return s.substr(n);
};
};with
exports.drop = function (n) {
return function (s) {
return s.substring(n);
};
};In this case, we would get:
drop (-2) "abcdef" == drop 0 "abcdef" == "abcdef"garyb commented
👍