import { update } from "https://deno.land/x/fun@v2.0.0/record.ts";
Update a ReadonlyRecord at key with a value A. The record will only be updated if it already holds the specified key, otherwise no changes are made.
Examples
Example 1
Example 1
import * as R from "./record.ts";
import { pipe } from "./fn.ts";
const to2 = R.update(2);
const result1 = pipe(
{ one: 1, two: 2 },
to2('one'),
); // { one: 2, two: 2 }
const result2 = pipe(
{ two: 2 },
to2('one'),
); // No change { two: 2 }
Parameters
value: A