JSPM

array-replace

1.0.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 2
  • Score
    100M100P100Q16368F
  • License MIT

Replace array values with String.prototype.replace

Package Exports

  • array-replace

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (array-replace) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

array-replace Build Status

Replace array values with String.prototype.replace

Install

$ npm install --save array-replace

Usage

const arrayReplace = require('array-replace');
const arr = [
    'foo',
    'bar'
];

arrayReplace(arr, 'fo', 'y');
//=> ['yo', 'bar']

arrayReplace(arr, 'fo', str => str.toUpperCase());
//=> ['FOo', 'bar']

API

arrayReplace(input, search, replace)

Returns a new array.

input

Required
Type: array

The array to replace values in.

Required
Type: string or regexp

Search for matching substring that will be replaced.

replace

Required
Type: string or function

Replacing the matching substring.

  • key-replace - Replace object keys with String.prototype.replace

License

MIT © Andreas Gillström