UNPKG

imma

Version:

A collection of functions for dealing with native arrays and objects immutably

8 lines (7 loc) 198 B
'use strict' const insert = module.exports = (array, index, value) => { const head = array.slice(0, index) const tail = array.slice(index) head.push(value) return head.concat(tail) }