take-last
v0.1.4
Published
Returns a new shallow copy of the last n elements taken from the end of the given array. When list.length < n the list returned contain list.length elements.
Downloads
13
Maintainers
Readme
take-last
Returns a new shallow copy of the last n elements taken from the end of the given array. When list.length < n the list returned contain list.length elements.
npm install take-last --save
You can also use Duo, Bower or download the files manually.
npm stats
Overview
Returns expr1
if it can be converted to true; otherwise, returns expr2
. Thus, when used with Boolean values, || returns true if either operand is true; if both are false, returns false.
API Example
Pointful
var last = require('take-last')
last(2, ['a', 'b', 'c'])
//=> ['b', 'c']
Pointfree Style
var last = require('take-last')
var list = [ ['a', 'b', 'c'], ['d', 'e', 'f'], ['g', 'h', 'i'] ]
list.map(last(1))
//=> [['c'], ['f'], ['i']]
API
last(n, list)
arguments
n (number)
Number of elements to take from the end of the list.list (array)
Array to extract elements from.
returns
(array)
Returns copy of the lastn
elements taken from the end oflist
.
Related
Alternatives
Contributing
SEE: contributing.md