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
Having just added an optional parameter to _.last—to enable plucking the last n elements from an array in #5842, I also propose that _.tail be aliased to _.last, so that we have better consistency between _.head/_.first, and _.tail/_.last methods. The existing functionality of _.tail—to return all but the first array element—could instead now be done like this:
constarray=[1,2,3,4]_.tail(array,-1)// [2, 3, 4]
This might be a breaking change, so maybe one for v5… But could also exist as something like this wrapper function in the meantime…
Having just added an optional parameter to
_.last
—to enable plucking the last n elements from an array in #5842, I also propose that_.tail
be aliased to_.last
, so that we have better consistency between_.head
/_.first
, and_.tail
/_.last
methods. The existing functionality of_.tail
—toreturn
all but the first array element—could instead now be done like this:This might be a breaking change, so maybe one for v5… But could also exist as something like this wrapper
function
in the meantime…See also #5841, which adds similar functionality to
_.head
/_.first
.The text was updated successfully, but these errors were encountered: