refactor: replace ignored numeric literals with constants
This commit is contained in:
@@ -1,12 +1,14 @@
|
||||
import { Decimal } from '../../common/decimal';
|
||||
|
||||
const MISSING_PROTO_COMPONENT = 0;
|
||||
|
||||
const NANO = 1_000_000_000n;
|
||||
|
||||
export type ProtoDecimal = { nano?: number | string; units?: number | string };
|
||||
|
||||
export function decimal(value: ProtoDecimal): Decimal {
|
||||
return {
|
||||
value: BigInt(value.units ?? 0) * NANO + BigInt(value.nano ?? 0),
|
||||
value: BigInt(value.units ?? MISSING_PROTO_COMPONENT) * NANO + BigInt(value.nano ?? MISSING_PROTO_COMPONENT),
|
||||
scale: 9,
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user