Skip to content

melkir/pairwise-iterator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pairwise-iterator Build Status codecov

Iterate by pairwise values in a list

Install

$ npm install pairwise-iterator

Usage

Array

const pairwiseIterator = require('pairwise-iterator');

const it = pairwiseIterator(['a', 'b', 'c']);

it.next(); // => { value: [ 'a', 'b' ], done: false }
it.next(); // => { value: [ 'b', 'c' ], done: false }
it.next(); // => { value: undefined, done: true }

Object

const it = pairwiseIterator({
  1: 'a',
  2: 'b',
  3: 'c'
});

it.next(); // => { value: [ 'a', 'b' ], done: false }
it.next(); // => { value: [ 'b', 'c' ], done: false }
it.next(); // => { value: undefined, done: true }

License

MIT © Thibaut Vieux

About

Iterate by pairwise values in a list

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published