array-last icon indicating copy to clipboard operation
array-last copied to clipboard

why don`t judge the length of the second parameters

Open ddddderek opened this issue 7 years ago • 3 comments

When the length of the second parameters is greater than the length of the array,The undefined will be included in the result.

example:

 var last = require('array-last');

 var a = last(['a', 'b', 'c', 'd', 'e', 'f'],7);

result

[ undefined, 'a', 'b', 'c', 'd', 'e', 'f' ]

ddddderek avatar Apr 20 '18 02:04 ddddderek

suggest that the length of the first parameters as a loop condition or when the length of the second parameters is greater than the length of the array will return the array self

ddddderek avatar Apr 20 '18 02:04 ddddderek

want to do a pr?

jonschlinkert avatar Apr 20 '18 07:04 jonschlinkert

I'm afraid I can't do it well

ddddderek avatar Apr 25 '18 05:04 ddddderek