Miss any of our Open RFC calls?Watch the recordings here! »

array-insertat

2.0.0 • Public • Published

array-insertAt Build Status

Inserts an item at a specific position.

Returns a new array, where an item is inserted at a specific position. The original array will not be modified.

Install

$ npm install --save array-insertat

Usage

const insertAt = require('array-insertat')
insertAt([1, 2], 1, 3)
// => [1, 3, 2]

API

insertAt(array, index, item)

Returns the modified array.

array

Type: array

The array to modify.

index

Type: index

Position where to modify the array.

item

Type: item

The item to add.

License

MIT © Emil Johansson

Install

npm i array-insertat

DownloadsWeekly Downloads

5

Version

2.0.0

License

MIT

Last publish

Collaborators

  • avatar