Skip to content

ulrikstrid/array-insert

Repository files navigation

array-insert Build Status

Return a new array with a inserted item at index

Install

$ npm install --save array-insert

Usage

var arrayInsert = require('array-insert');

arrayInsert([1, 2, 4], 2, 3);
//=> [1, 2, 3, 4]

API

arrayInsert(arr, pos, item)

arr

Required
Type: array

[1, 2, 3]

pos

Required
Type: number

2

item

Required
Type: any

4

License

MIT © Ulrik Augustsson

About

Return a new array with a inserted item at index.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published