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

method

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

Create a Comparable for method types.

@example
import { method, number } from "./comparable.ts";

// This eq will work for date, but also for any objects that have
// a valueOf method that returns a number.
const date = method("valueOf", number);

const now = new Date();
const alsoNow = new Date(Date.now());
const later = new Date(Date.now() + 60 * 60 * 1000);

const result1 = date.compare(now)(alsoNow); // true
const result2 = date.compare(now)(later); // false
function method<M extends string, A>(method: M, { compare }: Comparable<A>): Comparable<readonly [K in M]: () => A>;
§
method<M extends string, A>(method: M, { compare }: Comparable<A>): Comparable<readonly [K in M]: () => A>
[src]

§Type Parameters

§
M extends string
[src]

§Parameters

§
method: M
[src]
§
{ compare }: Comparable<A>
[src]

§Return Type

§
Comparable<readonly [K in M]: () => A>
[src]