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
/
push.js
8 lines
(7 loc)
•
190 B
JavaScript
View Raw
1
2
3
4
5
6
7
8
'use strict'
const
push =
module
.
exports
=
(
array, head, ...tail
) =>
const
result = array.
slice
(
0
) result.
push
(head)
if
(tail.
length
>
0
) result.
push
(...tail)
return
result }