function.ts

view source

Declarations
#

6 declarations

identity
#

function.ts view source

<T>(t: T): T import {identity} from '@fuzdev/fuz_util/function.js';

Returns the first arg.

t

type T

returns

T

generics

identity<T>
T

noop
#

function.ts view source

(...args: any[]): any import {noop} from '@fuzdev/fuz_util/function.js';

Does nothing when called.

args

type any[]

returns

any

noop_async
#

function.ts view source

(...args: any[]): Promise<any> import {noop_async} from '@fuzdev/fuz_util/function.js';

Async function that returns a resolved promise.

args

type any[]

returns

Promise<any>

resolved
#

function.ts view source

Promise<void> import {resolved} from '@fuzdev/fuz_util/function.js';

A singleton resolved Promise.

Thunk
#

function.ts view source

Thunk<T> import type {Thunk} from '@fuzdev/fuz_util/function.js';

Represents a value wrapped in a function. Useful for lazy values and bridging reactive boundaries in Svelte.

generics

Thunk<T>
T

(call)

type (): T

returns T

unthunk
#

function.ts view source

<T>(value: T | Thunk<T>): T import {unthunk} from '@fuzdev/fuz_util/function.js';

Returns the result of calling value if it's a function, otherwise it's like the identity function and passes it through.

value

type T | Thunk<T>

returns

T

generics

unthunk<T>
T

Imported by
#