UNPKG
imma
Version:
latest (0.0.1)
0.0.1
A collection of functions for dealing with native arrays and objects immutably
imma
/
lib
/
array
/
insert.js
8 lines
(7 loc)
•
198 B
JavaScript
View Raw
1
2
3
4
5
6
7
8
'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) }