# @writetome51/array-replace-at

> Replaces 1 item in array at specified index

Latest version **1.1.2** (published 2019-03-03) · MIT license · 0 weekly downloads

## Install

```sh
npm install @writetome51/array-replace-at
pnpm add @writetome51/array-replace-at
yarn add @writetome51/array-replace-at
bun add @writetome51/array-replace-at
```

## 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.1.2 |
| Published | 2019-03-03 |
| First published | 2018-10-08 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 5.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Steve Thompson |
| Maintainers | writetome51 |
| Keywords | array, manipulation, replace, item, single, index |

## Links

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

## Dependencies (1)

- [@writetome51/array-replace-adjacent-items](https://npm.io/package/@writetome51/array-replace-adjacent-items.md) ~1.0.4

## Recent versions

- 1.1.2 (latest) — 2019-03-03
- 1.1.1 — 2018-11-20
- 1.1.0 — 2018-11-09
- 1.0.1 — 2018-10-10
- 1.0.0 — 2018-10-08

## README

# replaceAt(index, newValue, array): void

Replaces item at `index` with `newValue` in `array`.   
`index` can be negative or positive.

## Examples
```
let arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
    
replaceAt(1, 20, arr);
// arr is now [ 1, 20, 3, 4, 5, 6, 7, 8, 9, 10 ]
    
replaceAt(-1, 20, arr);  
// arr is now [ 1, 20, 3, 4, 5, 6, 7, 8, 9, 20 ]
    
replaceAt(0, 'hello', arr);  
// arr is now [ 'hello', 20, 3, 4, 5, 6, 7, 8, 9, 20 ]

replaceAt(-2, [21, 22], arr);  
// arr is now [ 'hello', 20, 3, 4, 5, 6, 7, 8, [21, 22], 20 ]
```

## Installation
`npm i  @writetome51/array-replace-at`

## Loading
```
import {replaceAt} from '@writetome51/array-replace-at';
var replaceAt = require('@writetome51/array-replace-at').replaceAt;
```

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