UNPKG

hkt-toolbelt

Version:

Functional and composable type utilities

22 lines (21 loc) 587 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.multiply = void 0; const __1 = require(".."); /** * Given two natural numbers, return their product. * * @param {Number.Number} a - The first natural number. * @param {Number.Number} b - The second natural number. * * @example * ```ts * import { NaturalNumber } from "hkt-toolbelt"; * * const result = NaturalNumber.multiply(2)(3) * // ^? 6 * ``` */ exports.multiply = ((a) => (b) => __1.Number.isNatural(a) && __1.Number.isNatural(b) ? Number(a) * Number(b) : __1.Type.never);