chore(inventory, core-flows): big number support (#8204)

This commit is contained in:
Carlos R. L. Rodrigues
2024-07-22 06:32:25 -03:00
committed by GitHub
parent c307972a99
commit fb29b958fa
27 changed files with 363 additions and 218 deletions

View File

@@ -1,8 +1,8 @@
import { BigNumberInput, BigNumberRawValue } from "@medusajs/types"
import { BigNumberInput, BigNumberRawValue, IBigNumber } from "@medusajs/types"
import { BigNumber as BigNumberJS } from "bignumber.js"
import { isBigNumber, isString } from "../common"
export class BigNumber {
export class BigNumber implements IBigNumber {
static DEFAULT_PRECISION = 20
private numeric_: number
@@ -110,7 +110,7 @@ export class BigNumber {
this.bignumber_ = newValue.bignumber_
}
toJSON() {
toJSON(): number {
return this.bignumber_
? this.bignumber_?.toNumber()
: this.raw_
@@ -118,7 +118,7 @@ export class BigNumber {
: this.numeric_
}
valueOf() {
valueOf(): number {
return this.numeric_
}
}