Function: dub()

dub<F>(name: string, f: F): F

Defined in: pkg/dub/src/index.ts:24

Assigns the name to the displayName property of the given function. Note that this is a mutating operation!

Type Parameters

Type Parameter
F extends AnyFunction

Parameters

Parameter Type
name string
f F

Returns

F

Example

import {dub} from "@longlast/dub";
import {curry} from "@longlast/curry";
import {functionName} from "@longlast/functionName";

const add = dub(
    "add",
    curry((a: number, b: number) => a + b),
);

functionName(add); // => "add"