UNPKG

hkt-toolbelt

Version:

Functional and composable type utilities

19 lines (18 loc) 523 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.divide = void 0; /** * Given two natural numbers, divide the first by the second, and return the * floored result as a natural number. * * @param {Number_.Number} A - The numerator. * @param {Number_.Number} B - The denominator. * * @example * ```ts * import { NaturalNumber } from "hkt-toolbelt"; * * const T0 = NaturalNumber.divide(42)(10); // 4 * ``` */ exports.divide = ((a) => (b) => Math.floor(Number(a) / Number(b)));