Hi there! Are you looking for the official Deno documentation? Try docs.deno.com for all your Deno learning needs.

modify

import { modify } from "https://github.gh-proxy.cn/raw.githubusercontent.com/baetheus/fun/main/record.ts";

Modify a value A into a ReadonlyRecord at the key location. If the object does not hold the specified key then no change is made.

@example
import * as R from "./record.ts";
import { pipe } from "./fn.ts";

const addOne = R.modify((n: number) => n + 1);

const result1 = pipe(
  { one: 1, two: 2 },
  addOne('one'),
); // { one: 2, two: 2 }
const result2 = pipe(
  { two: 2 },
  addOne('one')
); // { two: 2 }
function modify<A>(modifyFn: (a: A) => A): (key: string) => (ua: ReadonlyRecord<A>) => ReadonlyRecord<A>;
§
modify<A>(modifyFn: (a: A) => A): (key: string) => (ua: ReadonlyRecord<A>) => ReadonlyRecord<A>
[src]

§Type Parameters

§Parameters

§
modifyFn: (a: A) => A
[src]

§Return Type

§
(key: string) => (ua: ReadonlyRecord<A>) => ReadonlyRecord<A>
[src]