import { array } from "https://deno.land/x/fun@v2.0.0-alpha.6/mod.ts";
const { update } = array;
Create a new array by replacing a value of an array at an index. If the index is out of range of the existing array then no change is made.
Examples
Example 1
Example 1
import * as A from "./array.ts";
import { pipe } from "./fn.ts";
const update = A.update(100); // Update the value 100
const arr = [1, 2, 3];
const result1 = pipe(arr, update(0)); // [100, 2, 3]
const result2 = pipe(arr, update(1)); // [1, 100, 3]
const result3 = pipe(arr, update(4)); // [1, 2, 3]
Parameters
value: A