# @writetome51/array-replace-first-of-all-of-each

> Functions that replace particular values found in array with new values

Latest version **1.0.0** (published 2019-04-15) · MIT license · 0 weekly downloads

## Install

```sh
npm install @writetome51/array-replace-first-of-all-of-each
pnpm add @writetome51/array-replace-first-of-all-of-each
yarn add @writetome51/array-replace-first-of-all-of-each
bun add @writetome51/array-replace-first-of-all-of-each
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2019-04-15 |
| First published | 2019-04-15 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 21.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Steve Thompson |
| Maintainers | writetome51 |
| Keywords | array, manipulation, find, search, replace, value, values, all, items, elements |

## Links

- npm: https://www.npmjs.com/package/@writetome51/array-replace-first-of-all-of-each
- Repository: https://github.com/writetome51/array-replace-first-of-all-of-each
- Homepage: https://github.com/writetome51/array-replace-first-of-all-of-each#readme
- Issues: https://github.com/writetome51/array-replace-first-of-all-of-each/issues
- npm.io page: https://npm.io/package/@writetome51/array-replace-first-of-all-of-each

## Dependencies (2)

- [error-if-not-populated-array](https://npm.io/package/error-if-not-populated-array.md) ~1.0.2
- [@writetome51/array-replace-first-of-all-of](https://npm.io/package/@writetome51/array-replace-first-of-all-of.md) ~2.0.0

## Alternatives

- [jsforce](https://npm.io/package/jsforce.md) — 851.2K weekly downloads
- [react-native-qrcode-svg](https://npm.io/package/react-native-qrcode-svg.md) — 693.5K weekly downloads
- [@salesforce/plugin-data](https://npm.io/package/@salesforce/plugin-data.md) — 394.9K weekly downloads
- [@backstage/plugin-search-common](https://npm.io/package/@backstage/plugin-search-common.md) — 308.5K weekly downloads
- [@chain-registry/types](https://npm.io/package/@chain-registry/types.md) — 38.4K weekly downloads

## Recent versions

- 1.0.0 (latest) — 2019-04-15

## README

# replaceFirstOfEach(<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;values,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;newValues,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;array<br>): void

First instance of `values[i]` found in `array` gets replaced with `newValues[i]`.  
This is repeated for each value in `values`.

# replaceAllOfEach(<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;values,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;newValues,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;array<br>): void

All instances of `values[i]` found in `array` get replaced with `newValues[i]`.   
This is repeated for each value in `values`.

NOTICE :  For both functions, any parameter called `values` cannot contain   
an object.  &nbsp;`values` can contain arrays, as long as those arrays do not contain objects.

## Installation
`npm i  @writetome51/array-replace-first-of-all-of-each`


## Examples
```
let arr = [1,2,3,1,2,3,1,2,3];  
replaceFirstOfEach([1,2,3], [10,20,30], arr);  
// arr is now [10,20,30,1,2,3,1,2,3]

let arr = [1,2,3,1,2,3,1,2,3];  
replaceAllOfEach([1,2,3], [10,20,30], arr);  
// arr is now [10,20,30,10,20,30,10,20,30]
```

## Loading
```
// if using TypeScript:
import {replaceFirstOfEach,  replaceAllOfEach}   
	from '@writetome51/array-replace-first-of-all-of-each';

// if using ES5 JavaScript:
var replaceFirstOfEach = 
	require('@writetome51/array-replace-first-of-all-of-each').replaceFirstOfEach;
var replaceAllOfEach = 
	require('@writetome51/array-replace-first-of-all-of-each').replaceAllOfEach;
```

---
_Source: https://npm.io/package/@writetome51/array-replace-first-of-all-of-each · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
