Skip to content

partob

Like partial but for unary functions that accept a single object argument

Usage

const add = ({ a = 0, b = 0, c = 0 }: { a?: number; b?: number; c?: number }) =>
a + b + c;
const addPartial = partob(add, { a: 1 });
addPartial({ b: 2 }); // 3
addPartial({ b: 1, c: 5 }); // 7

Installation

Terminal window
npx atmx add helper partob