adjust

v0.9.6arrow_drop_down
v0.9.6
STATUS
Passing
DOWNLOADS
5
VISIBILITY
Public
PUBLISHED
5 years ago
SIZE
1 KB
Applies a function to the value at the given index of an array, returning a
1 contributor
Install adjust as a package?
Copied
npm i @bit/justin-capalbo.ramda.adjust
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
adjust (
idx:Number,
fn:Function,
list:(Array | Arguments)
) : Array

Applies a function to the value at the given index of an array, returning a new copy of the array with the element at the given index replaced with the result of the function application.

Example
R.adjust(1, R.toUpper, ['a', 'b', 'c', 'd']);      //=> ['a', 'B', 'c', 'd']
     R.adjust(-1, R.toUpper, ['a', 'b', 'c', 'd']);     //=> ['a', 'b', 'c', 'D']
Arguments
idx: Number

The index.

fn: Function

The function to apply.

list: (Array | Arguments)

An array-like object whose value at the supplied index will be replaced.

Returns
Array

A copy of the supplied array-like object with the element at index `idx` replaced with the value returned by applying `fn` to the existing element.

Help and resources