Skip to main content
Home

Built and signed on GitHub Actions

Works with
This package works with Node.js, DenoIt is unknown whether this package works with Cloudflare Workers, Bun, Browsers
It is unknown whether this package works with Cloudflare Workers
This package works with Node.js
This package works with Deno
It is unknown whether this package works with Bun
It is unknown whether this package works with Browsers
JSR Score100%
Published10 months ago (0.1.3)

Manipulates JavaScript functions' parameters, timing, and behavior.

Functions

f
after(
x: Function,
n: number
): Function

Restrict a function to be used only after a certain number of calls.

f
apply(
x: Function,
ths?: unknown,
args: unknown[]
): unknown

Invoke a function with specified this-object, and arguments provided as an array.

f
ARGUMENTS(...args: unknown[]): unknown[]

Return the arguments passed as a array.

f
arity(x: Function): number

Get the number of parameters of a function.

f
attach(
x: Function,
...prefix: unknown[]
): Function

Attach prefix arguments to leftmost parameters of a function.

f
attachRight(
x: Function,
...suffix: unknown[]
): Function

Attach suffix arguments to rightmost parameters of a function.

f
before(
x: Function,
n: number
): Function

Restrict a function to be used only upto a certain number of calls.

f
bind(
x: Function,
ths: unknown,
...prefix: unknown[]
): Function

Bind this-object, and optional prefix arguments to a function.

f
call(
x: Function,
ths?: unknown,
...args: unknown[]
): unknown

Invoke a function with specified this-object, and arguments provided individually.

f
COMPARE<T>(
a: T,
b: T
): number

Compare two values.

f
compose(...xs: Function[]): Function

Compose functions together, in applicative order.

f
composeRight(...xs: Function[]): Function

Compose functions together, such that result is piped forward.

f
contextify(x: Function): Function

Contextify a function by accepting the first parameter as this-object.

f
curry(
x: Function,
n?: number
): Function

Generate curried version of a function.

f
curryRight(
x: Function,
n?: number
): Function

Generate right-curried version of a function.

f
debounce(
x: Function,
t: number,
T?: number
): Function

Generate debounced version of a function.

f
debounceEarly(
x: Function,
t: number,
T?: number
): Function

Generate leading-edge debounced version of a function.

f
decontextify(x: Function): Function

Decontextify a function by accepting this-object as the first argument.

f
defer(x: Function): Function

Generate deferred version of a function, that executes after the current stack has cleared.

f
delay(
x: Function,
t: number
): Function

Generate delayed version of a function.

f
FALSE(..._args: unknown[]): false

Return false.

f
flip(x: Function): Function

Generate a parameter-reversed version of a function.

f
IDENTITY<T>(v: T): T

Return the same (first) value.

f
is(v: unknown): v is Function

Check if value is a function.

f
isAsync(v: unknown): boolean

Check if value is an async function.

f
isGenerator(v: unknown): v is GeneratorFunction

Check if value is a generator function.

f
length(x: Function): number

Get the number of parameters of a function.

f
memoize(
x: Function,
fr?: Resolver | null,
cache?: Map<unknown, unknown> | null
): Function

Generate result-cached version of a function.

f
name(x: Function): string

Get the name of a function.

f
negate(x: Function): Function

Generate a result-negated version of a function.

f
NOOP(..._args: unknown[]): void

Do nothing.

f
once(x: Function): Function

Restrict a function to be used only once.

f
partial(
x: Function,
...prefix: unknown[]
): Function

Attach prefix arguments to leftmost parameters of a function.

f
partialRight(
x: Function,
...suffix: unknown[]
): Function

Attach suffix arguments to rightmost parameters of a function.

f
restrict(
x: Function,
start: number,
end?: number
): Function

Generate restricted-use version of a function.

f
restrictAfter(
x: Function,
n: number
): Function

Restrict a function to be used only after a certain number of calls.

f
restrictBefore(
x: Function,
n: number
): Function

Restrict a function to be used only upto a certain number of calls.

f
restrictOnce(x: Function): Function

Restrict a function to be used only once.

f
reverse(x: Function): Function

Generate a parameter-reversed version of a function.

f
spread(x: Function): Function

Generate a (first) parameter-spreaded version of a function.

f
throttle(
x: Function,
t: number
): Function

Generate throttled version of a function.

f
throttleEarly(
x: Function,
t: number
): Function

Generate leading-edge throttled version of a function.

f
TRUE(..._args: unknown[]): true

Return true.

f
unspread(x: Function): Function

Generate a (first) parameter-collapsed version of a function.

Interfaces

I

Invocation control for time/rate-controlled functions.

  • clear: () => void

    Disable invoking of target function.

  • flush: () => void

    Immediately invoke target function.

Type Aliases

T
Function = (...args: unknown[]) => unknown

unknown function type.

T
Resolver = (...args: unknown[]) => unknown

Resolve arguments into a unique key.

Report package

Please provide a reason for reporting this package. We will review your report and take appropriate action.

Please review the JSR usage policy before submitting a report.