js-take
v1.0.0
Published
A function to extract an array sequence of the first n items from another array.
Downloads
6
Readme
js-take
A function to extract an array sequence of the first n items from another array, or all items if there are fewer than n. Similar to Clojure's take, but without laziness.
Installation
npm i -S js-take
Usage
import range from 'js-take';
take(2, [1, 2, 3, 4]]); // [1, 2]
take(3, [1, 2]); // [1, 2]