node package manager

iterable-transform-replace

iterable-transform-replace

An iterable transform that replace specified item

background details relevant to understanding what this module does

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 Code Climate Coverage Status NPM downloads

API

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

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

Install

With npm installed, run

$ npm install iterable-transform-replace

See Also

License

MIT