insert

v0.9.6arrow_drop_down
v0.9.6
STATUS
Passing
DOWNLOADS
2
VISIBILITY
Public
PUBLISHED
5 years ago
SIZE
960 B
Inserts the supplied element into the list, at the specified `index`.
1 contributor
Install insert as a package?
Copied
npm i @bit/justin-capalbo.ramda.insert
Set Bit as a scoped registryLearn more
npm config set '@bit:registry' https://node.bit.cloud
Component Example
React
React
Vue
Angular
React Native
Add dependency... help_outline
Just
import
any of the 1 million components
and packages in Bit or NPM to the example.
import Button from '@bit/grommet.grommet.button';
import Lodash from 'lodash';
toggle layout
No preview available
modifieddraft
chevron_left
chevron_right
insert (
index:Number,
elt:*,
list:Array
) : Array

Inserts the supplied element into the list, at the specified index. _Note that

this is not destructive_: it returns a copy of the list with the changes. No lists have been harmed in the application of this function.

Example
R.insert(2, 'x', [1,2,3,4]); //=> [1,2,'x',3,4]
Arguments
index: Number

The position to insert the element

elt: *

The element to insert into the Array

list: Array

The list to insert into

Returns
Array

A new Array with `elt` inserted at `index`.

Help and resources