# @writetome51/array-insert-at

> Function that inserts new items at a specified index in the array

Latest version **4.0.2** (published 2021-11-14) · MIT license · 0 weekly downloads

## Install

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

## Health

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

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 4.0.2 |
| Published | 2021-11-14 |
| First published | 2018-10-08 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 2 |
| Unpacked size | 3.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Steve Thompson |
| Maintainers | writetome51 |
| Keywords | array, manipulation, mutate, modify, insert, splice, new, items |

## Links

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

## Dependencies (2)

- [error-if-index-not-valid](https://npm.io/package/error-if-index-not-valid.md) >=2.0.0
- [@writetome51/array-append-prepend-many](https://npm.io/package/@writetome51/array-append-prepend-many.md) >=0.0.1

## Recent versions

- 4.0.2 (latest) — 2021-11-14
- 4.0.1 — 2021-11-02
- 4.0.0 — 2021-04-28
- 3.0.0 — 2020-08-06
- 2.0.3 — 2019-04-12
- 2.0.2 — 2019-02-27
- 2.0.1 — 2019-02-09
- 2.0.0 — 2018-12-11
- 1.0.2 — 2018-11-17
- 1.0.1 — 2018-11-06
- 1.0.0 — 2018-10-08

## README

# insertAt\<T\>(<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;index,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;values: T[],<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;array: T[]<br>): void

At `index`, `values` are inserted in `array`.   
`index` can be negative or positive.  If positive, existing items beginning at that index   
will be pushed to the right to make room.  If negative, existing items ending at that  
index will be pushed to the left to make room.  No items get removed.

## Examples
```js
let arr = [1,2,3,4];   
insertAt(2, [7, 8], arr);  
// arr is now [1,2,7,8,3,4]

let arr = [1,2,3,4];   
insertAt(-1, [7, 8], arr);  
// arr is now [1,2,3,4,7,8]

let arr = [1,2,3,4];   
insertAt(-4, [7, 8], arr);  
// arr is now [1,7,8,2,3,4]
```

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


## Loading
```js
import { insertAt } from '@writetome51/array-insert-at';
```

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