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

apply

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

Create a new Promise from a Promise<(a: A) => I> and a Promise. Although Promises encapsulate asynchrony, there is no way defer a Promise once created, thus this ap function always evaluates both input Promises in parallel.

@example
import { wrap, apply } from "./promise.ts";
import { pipe } from "./fn.ts";

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

const person = (name: string) => (age: number): Person => ({ name, age });

const result = pipe(
  wrap(person),
  apply(wrap("Brandon")),
  apply(wrap(37)),
); // Promise<Person>
function apply<A>(ua: Promise<A>): <I>(ufai: Promise<(a: A) => I>) => Promise<I>;
§
apply<A>(ua: Promise<A>): <I>(ufai: Promise<(a: A) => I>) => Promise<I>
[src]

§Type Parameters

§Parameters

§
ua: Promise<A>
[src]

§Return Type

§
<I>(ufai: Promise<(a: A) => I>) => Promise<I>
[src]