Skip to content

Latest commit

 

History

History
 
 

it-take

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 

it-take

Build status Coverage Status Dependencies Status

Stop iteration after n items have been received.

For when you only want a few values out of an iterable.

Install

$ npm install --save it-take

Usage

const take = require('it-take')
const all = require('it-all')

// This can also be an iterator, async iterator, generator, etc
const values = [0, 1, 2, 3, 4]

const arr = await all(take(values, 2))

console.info(arr) // 0, 1