remeda
Version:
A utility library for JavaScript and Typescript.
1 lines • 1.8 kB
Source Map (JSON)
{"version":3,"file":"ceil.cjs","names":["purry","withPrecision"],"sources":["../src/ceil.ts"],"sourcesContent":["import { withPrecision } from \"./internal/withPrecision\";\nimport { purry } from \"./purry\";\n\n/**\n * Rounds up a given number to a specific precision.\n * If you'd like to round up to an integer (i.e. use this function with constant `precision === 0`),\n * use `Math.ceil` instead, as it won't incur the additional library overhead.\n *\n * @param value - The number to round up.\n * @param precision - The precision to round up to. Must be an integer between -15 and 15.\n * @signature\n * R.ceil(value, precision);\n * @example\n * R.ceil(123.9876, 3) // => 123.988\n * R.ceil(483.22243, 1) // => 483.3\n * R.ceil(8541, -1) // => 8550\n * R.ceil(456789, -3) // => 457000\n * @dataFirst\n * @category Number\n */\nexport function ceil(value: number, precision: number): number;\n\n/**\n * Rounds up a given number to a specific precision.\n * If you'd like to round up to an integer (i.e. use this function with constant `precision === 0`),\n * use `Math.ceil` instead, as it won't incur the additional library overhead.\n *\n * @param precision - The precision to round up to. Must be an integer between -15 and 15.\n * @signature\n * R.ceil(precision)(value);\n * @example\n * R.ceil(3)(123.9876) // => 123.988\n * R.ceil(1)(483.22243) // => 483.3\n * R.ceil(-1)(8541) // => 8550\n * R.ceil(-3)(456789) // => 457000\n * @dataLast\n * @category Number\n */\nexport function ceil(precision: number): (value: number) => number;\n\nexport function ceil(...args: ReadonlyArray<unknown>): unknown {\n return purry(withPrecision(Math.ceil), args);\n}\n"],"mappings":"kFAwCA,SAAgB,EAAK,GAAG,EAAuC,CAC7D,OAAOA,EAAAA,EAAMC,EAAAA,EAAc,KAAK,KAAK,CAAE,EAAK"}