0.1.4 • Published 10 years ago
take-last v0.1.4
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 --saveYou 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 lastnelements taken from the end oflist.
Related
Alternatives
Contributing
SEE: contributing.md