returnsArgs

import { returnsArgs } from "jsr:@ende/testing/mock";

function

function returnsArgs<Args extends unknown[], Self = any>(start: number = 0, end?: number): (this: Self, ...args: Args) => Args

Creates a function that returns its arguments or a subset of them. If end is specified, it will return arguments up to but not including the end.

start: number = 0

The start index of the arguments to return. Default is 0.

end?: number

The end index of the arguments to return.

Returns

A function that returns its arguments or a subset of them.

Example: Usage

import { returnsArgs } from "@ende/testing/mock";
import { assertEquals } from "@ende/assert";

const func = returnsArgs();
assertEquals(func(1, 2, 3), [1, 2, 3]);

Source