node package manager

transform-spread-iterable

transform-spread-iterable

An iterable transform that spread each iterable received and emit its items

background details relevant to understanding what this module does

Usage

Let's spread the arr array, each item of arr will became an item of resulting iterable:

const spread = require('transform-spread-iterable');
 
const arr = [1, 2, 3];
 
for (const item of spread([arr, 42, 43])) {
    console.log({item});
}

This will output

{item :1}
{item :2}
{item :3}
{item :42}
{item :43}

Travis Build Status Code Climate Coverage Status

NPM downloads

API

const spread = (iterable: Iterable): Iterable

Given a source iterable, return an iterable with all source item that are iterable spreaded.

Install

With npm installed, run

$ npm install transform-spread-iterable

See Also

License

MIT