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

createBindTo

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

Create a bindTo function from a structure with an instance of Mappable. A bindTo function takes the inner value of the structure and maps it to the value of a struct with the given name. It is useful for lifting the value such that it can then be used with a bind function, effectively allowing for Do-like notation in typescript.

@example
import { createBindTo } from "./mappable.ts";
import * as O from "./option.ts";
import { pipe } from "./fn.ts";

const bindTo = createBindTo(O.MappableOption);
const option = O.some(5);

const result = pipe(
  option,
  bindTo("value")
);

console.log(result); // Some({ value: 5 })
function createBindTo<U extends Kind>({ map }: Mappable<U>): <N extends string>(name: N) => <A, B = never, C = never, D = unknown, E = unknown>(ua: $<U, [A, B, C], [D], [E]>) => $<U, [readonly [K in N]: A, B, C], [D], [E]>;
§
createBindTo<U extends Kind>({ map }: Mappable<U>): <N extends string>(name: N) => <A, B = never, C = never, D = unknown, E = unknown>(ua: $<U, [A, B, C], [D], [E]>) => $<U, [readonly [K in N]: A, B, C], [D], [E]>
[src]

§Type Parameters

§
U extends Kind
[src]

§Parameters

§
{ map }: Mappable<U>
[src]

§Return Type

§
<N extends string>(name: N) => <A, B = never, C = never, D = unknown, E = unknown>(ua: $<U, [A, B, C], [D], [E]>) => $<U, [readonly [K in N]: A, B, C], [D], [E]>
[src]