Share your code. Components are building blocks, you are the architect.

utils/adjust
v1.1.0
1.1.0
1.0.0
MIT
PUBLIC
3
Build: fail
BuildFail
Build Status: fail
Applies a function to the value at the given index of an array, returning a

Please configure Bit as a scoped registry to install components with NPM.Learn more

npm config set '@bit:registry' https://node.bitsrc.io
Use utils/adjust in your project
npm i @bit/bit.ramda.utils.adjust
Copied

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.