swc/bundler/tests/.cache/deno/0fa28d6816fcab5d11ba4ee1ede2a72680b8b6c0.ts
강동윤 bbaf619f63
fix(bundler): Fix bugs (#1437)
swc_bundler:
 - [x] Fix wrapped esms. (denoland/deno#9307)
 - [x] Make test secure.
2021-03-02 17:33:03 +09:00

35 lines
1.1 KiB
TypeScript

// Loaded from https://deno.land/x/ramda@v0.27.2/source/update.js
import _curry3 from './internal/_curry3.js';
import adjust from './adjust.js';
import always from './always.js';
/**
* Returns a new copy of the array with the element at the provided index
* replaced with the given value.
*
* @func
* @memberOf R
* @since v0.14.0
* @category List
* @sig Number -> a -> [a] -> [a]
* @param {Number} idx The index to update.
* @param {*} x The value to exist at the given index of the returned array.
* @param {Array|Arguments} list The source array-like object to be updated.
* @return {Array} A copy of `list` with the value at index `idx` replaced with `x`.
* @see R.adjust
* @example
*
* R.update(1, '_', ['a', 'b', 'c']); //=> ['a', '_', 'c']
* R.update(-1, '_', ['a', 'b', 'c']); //=> ['a', 'b', '_']
* @symb R.update(-1, a, [b, c]) = [b, a]
* @symb R.update(0, a, [b, c]) = [a, c]
* @symb R.update(1, a, [b, c]) = [b, a]
*/
var update = _curry3(function update(idx, x, list) {
return adjust(idx, always(x), list);
});
export default update;