mirror of
https://github.com/zkldi/Tachi.git
synced 2026-09-30 19:07:58 +03:00
feat: probably fix jubeat 1dp stuff
This commit is contained in:
@@ -165,6 +165,21 @@ export function RoundToNDecimalPlaces(value: number, n: integer) {
|
||||
return Number(value.toFixed(n));
|
||||
}
|
||||
|
||||
/**
|
||||
* Floor a number to N decimal places.
|
||||
*
|
||||
* @example `FloorToNDP(1.594, 1) -> 1.5`
|
||||
* @example `FloorToNDP(1.599, 2) -> 1.59`
|
||||
*
|
||||
* @param number - The number to floor.
|
||||
* @param dp - The amount of decimal places to floor to.
|
||||
*/
|
||||
export function FloorToNDP(number: number, dp: integer) {
|
||||
const mul = 10 ** dp;
|
||||
|
||||
return Math.floor(number * mul) / mul;
|
||||
}
|
||||
|
||||
export function OmitUndefinedKeys<T>(obj: Partial<T>): Partial<T> {
|
||||
const omittedObj: Partial<T> = {};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user