Skip to content

Latest commit

 

History

History
 
 

it-peekable

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 

it-peekable

Build status Coverage Status Dependencies Status

A peekable async iterator

Lets you look at the contents of an async iterator and decide what to do

Install

$ npm install --save it-peekable

Usage

const peekable = require('it-peekable')

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

const it = peekable(value)

const first = await it.peek()

console.info(first) // 0

it.push(first)

console.info([...it])
// [ 0, 1, 2, 3, 4 ]