File tree Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Original file line number Diff line number Diff line change @@ -20,12 +20,12 @@ import typescript from 'rollup-plugin-typescript2';
20
20
const getLastElement = array => {
21
21
return array [ array . length - 1 ] ;
22
22
} ;
23
- export const insertAt = ( arr , index , insertee ) => {
23
+ export const insertAt = ( arr , index , ... insertees ) => {
24
24
const newArr = [ ...arr ] ;
25
25
// Add 1 to the array length so that the inserted element ends up in the right spot with respect to the length of the
26
26
// new array (which will be one element longer), rather than that of the current array
27
27
const destinationIndex = index >= 0 ? index : arr . length + 1 + index ;
28
- newArr . splice ( destinationIndex , 0 , insertee ) ;
28
+ newArr . splice ( destinationIndex , 0 , ... insertees ) ;
29
29
return newArr ;
30
30
} ;
31
31
You can’t perform that action at this time.
0 commit comments