DieselDepot-APP/node_modules/es-toolkit/dist/compat/math/multiply.js
SJCoetz def597c157 chore: add generated build artifacts and node module type files
add all Next.js build outputs and third-party dependency type declaration files
2026-07-20 01:18:42 +02:00

32 lines
1,002 B
JavaScript

const require_toString = require("../util/toString.js");
const require_toNumber = require("../util/toNumber.js");
//#region src/compat/math/multiply.ts
/**
* Multiply two numbers.
*
* If either of the numbers is `NaN`, the function returns `NaN`.
*
* @param value The first number in a multiplication
* @param other The second number in a multiplication
* @returns The product of value and other
*
* @example
* multiply(2, 3); // => 6
* multiply(2, NaN); // => NaN
* multiply(NaN, 3); // => NaN
* multiply(NaN, NaN); // => NaN
*/
function multiply(value, other) {
if (value === void 0 && other === void 0) return 1;
if (value === void 0 || other === void 0) return value ?? other;
if (typeof value === "string" || typeof other === "string") {
value = require_toString.toString(value);
other = require_toString.toString(other);
} else {
value = require_toNumber.toNumber(value);
other = require_toNumber.toNumber(other);
}
return value * other;
}
//#endregion
exports.multiply = multiply;