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

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

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

## Install

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

## 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 | 2.0.0 |
| Published | 2019-04-15 |
| First published | 2018-10-08 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 6 |
| Unpacked size | 27.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| 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
- Repository: https://github.com/writetome51/array-replace-first-of-all-of
- Homepage: https://github.com/writetome51/array-replace-first-of-all-of#readme
- Issues: https://github.com/writetome51/array-replace-first-of-all-of/issues
- npm.io page: https://npm.io/package/@writetome51/array-replace-first-of-all-of

## Dependencies (6)

- [@writetome51/array-has](https://npm.io/package/@writetome51/array-has.md) ~1.0.8
- [@writetome51/arrays-match](https://npm.io/package/@writetome51/arrays-match.md) ~1.0.6
- [error-if-index-is-negative](https://npm.io/package/error-if-index-is-negative.md) ~1.0.1
- [@writetome51/array-replace-at](https://npm.io/package/@writetome51/array-replace-at.md) ~1.1.2
- [@writetome51/array-get-indexes](https://npm.io/package/@writetome51/array-get-indexes.md) ~1.0.2
- [@writetome51/is-array-not-array](https://npm.io/package/@writetome51/is-array-not-array.md) ~1.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

- 2.0.0 (latest) — 2019-04-15
- 1.1.3 — 2019-03-03
- 1.1.2 — 2018-11-20
- 1.1.1 — 2018-11-11
- 1.1.0 — 2018-11-10
- 1.0.0 — 2018-10-08

## README

# replaceFirstOf(<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;value,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;newValue,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;array<br>): void

Replaces first instance of `value` with `newValue` in `array`.

# replaceAllOf(<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;value,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;newValue,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;array<br>): void

Replaces all instances of `value` with `newValue` in `array`.

NOTICE :  For both functions, any parameter called `value` cannot be an  
object.  It can be an array, as long as the array does not contain an object.

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


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

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

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

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

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