UNPKG

@technobuddha/library

Version:
21 lines (20 loc) 882 B
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.ceil = void 0; var ceil_1 = __importDefault(require("lodash/ceil")); /** * A tweaked variant of {@code Math.ceil}. See {@code goog.math.safeFloor} for * details. * @param input A number. * @param precision The precision to round up to. * @return The smallest integer greater than or equal to {@code input}. */ function ceil(input, _a) { var _b = _a === void 0 ? {} : _a, _c = _b.tolerance, tolerance = _c === void 0 ? 0 : _c, _d = _b.precision, precision = _d === void 0 ? 0 : _d; return ceil_1.default(input - (Math.sign(input) * tolerance) - Number.EPSILON, precision); } exports.ceil = ceil; exports.default = ceil;