Socket
Socket
Sign inDemoInstall

array-replace

Package Overview
Dependencies
0
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    array-replace

Replace array values with String.prototype.replace


Version published
Weekly downloads
2
decreased by-60%
Maintainers
1
Install size
3.11 kB
Created
Weekly downloads
 

Readme

Source

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

Keywords

FAQs

Last updated on 16 Dec 2015

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc