UNPKG

es-toolkit

Version:

A state-of-the-art, high-performance JavaScript utility library with a small bundle size and strong type annotations.

22 lines (21 loc) 616 B
//#region src/fp/math/multiply.ts /** * Creates a function that multiplies its input by `multiplicand`. Use it with * {@link pipe}, or as the callback of a function such as {@link map}. * * @param multiplicand - The number to multiply the input by. * @returns A function that maps a `number` to `value * multiplicand`. * * @example * import { pipe, map, multiply } from 'es-toolkit/fp'; * * pipe(3, multiply(2)); // => 6 * pipe([1, 2, 3], map(multiply(3))); // => [3, 6, 9] */ function multiply(multiplicand) { return function(value) { return value * multiplicand; }; } //#endregion exports.multiply = multiply;