Skip to main content
Module

x/fun/mod.ts>optic.record

A collection of algebraic data types, lenses, and schemables based on a light weight higher kinded type implementation. Written for deno.
Latest
variable optic.record
import { optic } from "https://deno.land/x/fun@v2.0.0/mod.ts";
const { record } = optic;

A preconstructed traversal that focuses the values of a ReadonlyRecord.

Examples

Example 1

import * as O from "./optic.ts";
import { pipe } from "./fn.ts";

const result = pipe(
  O.id<Readonly<Record<string, number>>>(),
  O.record,
  O.view({ one: 1, two: 2 }),
); // [1, 2]

type

<U extends Tag, S, A>(first: Optic<U, S, ReadonlyRecord<A>>) => Optic<Align<U, FoldTag>, S, A>