Skip to main content

Built and signed on GitHub Actions

A modern JavaScript utility library that's 2-3 times faster and up to 97% smaller—a major upgrade to lodash.

This package works with Cloudflare Workers, Node.js, Deno, Bun, Browsers
This package works with Cloudflare Workers
This package works with Node.js
This package works with Deno
This package works with Bun
This package works with Browsers
JSR Score
100%
Published
2 weeks ago (1.17.0)
function ary
ary<F extends (...args: any[]) => any>(
func: F,
n?: number,
guard?: unknown,
): (...args: any[]) => ReturnType<F>

Creates a function that invokes func, with up to n arguments, ignoring any additional arguments.

Type Parameters

F extends (...args: any[]) => any
  • The type of the function.

Parameters

func: F
  • The function to cap arguments for.
optional
n: number = [func.length]
  • The arity cap.
optional
guard: unknown
  • The value to guard the arity cap.

Return Type

(...args: any[]) => ReturnType<F>

Returns the new capped function.

Add Package

deno add @es-toolkit/es-toolkit

Import symbol

import { ary } from "@es-toolkit/es-toolkit/compat";

---- OR ----

Import directly with a jsr specifier

import { ary } from "jsr:@es-toolkit/es-toolkit/compat";

Add Package

npx jsr add @es-toolkit/es-toolkit

Import symbol

import { ary } from "@es-toolkit/es-toolkit/compat";

Add Package

yarn dlx jsr add @es-toolkit/es-toolkit

Import symbol

import { ary } from "@es-toolkit/es-toolkit/compat";

Add Package

pnpm dlx jsr add @es-toolkit/es-toolkit

Import symbol

import { ary } from "@es-toolkit/es-toolkit/compat";

Add Package

bunx jsr add @es-toolkit/es-toolkit

Import symbol

import { ary } from "@es-toolkit/es-toolkit/compat";