update

v0.9.6arrow_drop_down
v0.9.6
STATUS
Passing
DOWNLOADS
4
VISIBILITY
Public
PUBLISHED
5 years ago
SIZE
1 KB
Returns a new copy of the array with the element at the provided index replaced with the given value.
1 contributor
Install update as a package?
Copied
npm i @bit/justin-capalbo.ramda.update
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
update (
idx:Number,
x:*,
list:(Array | Arguments)
) : Array

Returns a new copy of the array with the element at the provided index replaced with the given value.

Example
R.update(1, '_', ['a', 'b', 'c']);      //=> ['a', '_', 'c']
     R.update(-1, '_', ['a', 'b', 'c']);     //=> ['a', 'b', '_']
Arguments
idx: Number

The index to update.

x: *

The value to exist at the given index of the returned array.

list: (Array | Arguments)

The source array-like object to be updated.

Returns
Array

A copy of `list` with the value at index `idx` replaced with `x`.

Help and resources