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

dual

import { dual } from "https://raw.githubusercontent.com/baetheus/fun/main/combinable.ts";

Get the "Dual" of an existing Combinable. This effectively reverses the order of the input combinable's application. For example, the dual of the "first" combinable is the "last" combinable. The dual of (boolean, ||) is itself.

@example
import * as SG from "./combinable.ts";
import { pipe } from "./fn.ts";

type Person = { name: string, age: number };

const last = SG.last<Person>();
const dual = SG.dual(last);

const octavia: Person = { name: "Octavia", age: 42 };
const kimbra: Person = { name: "Kimbra", age: 32 };
const brandon: Person = { name: "Brandon", age: 37 };

const dualPerson = pipe(
  octavia,
  dual.combine(kimbra),
  dual.combine(brandon),
); // dualPerson === octavia
function dual<A>({ combine }: Combinable<A>): Combinable<A>;
§
dual<A>({ combine }: Combinable<A>): Combinable<A>
[src]

§Type Parameters

§Parameters

§
{ combine }: Combinable<A>
[src]

§Return Type