UNPKG

remeda

Version:

A utility library for JavaScript and Typescript.

1 lines 1.58 kB
{"version":3,"file":"multiply.cjs","names":["purry"],"sources":["../src/multiply.ts"],"sourcesContent":["import { purry } from \"./purry\";\n\n/**\n * Multiplies two numbers.\n *\n * @param value - The number.\n * @param multiplicand - The number to multiply the value by.\n * @signature\n * R.multiply(value, multiplicand);\n * @example\n * R.multiply(3, 4) // => 12\n * R.reduce([1, 2, 3, 4], R.multiply, 1) // => 24\n * @dataFirst\n * @category Number\n */\nexport function multiply(value: bigint, multiplicand: bigint): bigint;\nexport function multiply(value: number, multiplicand: number): number;\n\n/**\n * Multiplies two numbers.\n *\n * @param multiplicand - The number to multiply the value by.\n * @signature\n * R.multiply(multiplicand)(value);\n * @example\n * R.multiply(4)(3) // => 12\n * R.map([1, 2, 3, 4], R.multiply(2)) // => [2, 4, 6, 8]\n * @dataLast\n * @category Number\n */\nexport function multiply(multiplicand: bigint): (value: bigint) => bigint;\nexport function multiply(multiplicand: number): (value: number) => number;\n\nexport function multiply(...args: readonly unknown[]): unknown {\n return purry(multiplyImplementation, args);\n}\n\n// The implementation only uses `number` types, but that's just because it's\n// hard to tell typescript that both value and multiplicand would be of the same\n// type.\nconst multiplyImplementation = (value: number, multiplicand: number): number =>\n value * multiplicand;\n"],"mappings":"wCAiCA,SAAgB,EAAS,GAAG,EAAmC,CAC7D,OAAOA,EAAAA,EAAM,EAAwB,EAAK,CAM5C,MAAM,GAA0B,EAAe,IAC7C,EAAQ"}