parro-it/iterable-transform-replace

View on GitHub
main.js

Summary

Maintainability
A
0 mins
Test Coverage
import curry from 'curry';

function replace(oldItem, newItem, array) {
    return array.map(item => {
        if (item === oldItem) {
            return newItem;
        }

        return item;
    });
}

export default curry(replace);