iterable-transform-replace

1.2.0 • Public • Published

iterable-transform-replace

Greenkeeper badge

An iterable transform that apply replace to all items

Usage

This example replace response with 42:

const replace = require('iterable-transform-replace');
 
const source = [1, 2, 'response', 3];
console.log(Array.from(replace('response', 42, source)));

This will output

[1, 2, 42, 3]

Travis Build Status NPM downloads

API

const iterableTransformReplace = (oldItem: any, newItem: any, source: Iterable): Iterable

Given an iterable source object, return another iterable with all items equal to oldItem replaced with newItem.

Install

With npm installed, run

$ npm install iterable-transform-replace

See Also

License

MIT

/iterable-transform-replace/

    Package Sidebar

    Install

    npm i iterable-transform-replace

    Weekly Downloads

    3,419

    Version

    1.2.0

    License

    MIT

    Last publish

    Collaborators

    • parroit