UNPKG

hkt-toolbelt

Version:

Functional and composable type utilities

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