Something went wrong. Try again.
[READ-ONLY] Mirror of https://github.com/Aquaticat/Monochromatic. TypeScript and Rust monorepo: Claude Code and Pi coding-agent plugins, a m
Something went wrong. Try again.
12345678910111213141516171819202122232425262728/** Wraps callback so only first positional argument reaches wrapped function. Useful when host APIs pass extra arguments that have different meanings for existing functions. `Array.prototype.map(Number.parseInt)` treats index as radix; `array.map(unary(Number.parseInt))` always calls `Number.parseInt` with just value. @param fn - callback that can run from first positional argument alone @returns wrapper forwarding only first positional argument @example ```ts import { unary, } from '\@monochromatic-dev/module-function-arity'; const parsed = ['10', '10', '10'].map(unary(Number.parseInt,)); // [10, 10, 10] ``` */export function unary<const TArgument, const TReturn,>( fn: (argument: TArgument,) => TReturn,): (argument: TArgument,) => TReturn { return (function unaryWrapper(argument: TArgument,): TReturn { return fn(argument,); });}