1.0.0 • Published 4 years ago

add-index v1.0.0

Weekly downloads
4
License
MIT
Repository
github
Last release
4 years ago

add-index Travis CI Build Status

Add an item to an array and get its index.

NPM Badge

Install

npm install add-index

Usage

const addIndex = require("add-index");

const array = [1, 2, 3, 4, 5];

addIndex(array, 6);
//=> 5

console.log(array);
//=> [1, 2, 3, 4, 5, 6]

API

addIndex(array, item)

array

Type: array

The array to add to.

item

Type: any

The item to add.