Skip to main content
Module

x/froebel/unary.ts>default

A strictly typed utility library.
Go to Latest
variable default
import { default } from "https://deno.land/x/froebel@v0.22.0/unary.ts";

Turns fun into a unary function (a function that only accepts one argument).

Note: fun must accept at least one argument and must not require more than one argument.

Examples

Example 1

['1', '2', '3'].map(unary(parseInt))  // -> [1, 2, 3]

type

<T extends λ<[any]>>(fun: Parameters<T> extends [] ? never : T) => Unary<T>