returnsArg
import { returnsArg } from "jsr:@ende/testing/mock";function
function returnsArg<Arg, Self = any>(idx: number): (this: Self, ...args: Arg[]) => Arg | undefinedCreates a function that returns one of its arguments.
idx: numberThe index of the arguments to use.
Returns
A function that returns one of its arguments.
Example: Usage
import { returnsArg } from "@ende/testing/mock";
import { assertEquals } from "@ende/assert";
const func = returnsArg(1);
assertEquals(func(1, 2, 3), 2);