diff --git a/src/condition.js b/src/condition.js index 5f5775d..9dbf2ad 100644 --- a/src/condition.js +++ b/src/condition.js @@ -1,6 +1,7 @@ 'use strict' import debug from './debug' +import { jsonStringifyWithBigInt } from './utils' export default class Condition { constructor (properties) { @@ -101,9 +102,9 @@ export default class Condition { ]).then(([rightHandSideValue, leftHandSideValue]) => { const result = op.evaluate(leftHandSideValue, rightHandSideValue) debug( - `condition::evaluate <${JSON.stringify(leftHandSideValue)} ${ + `condition::evaluate <${jsonStringifyWithBigInt(leftHandSideValue)} ${ this.operator - } ${JSON.stringify(rightHandSideValue)}?> (${result})` + } ${jsonStringifyWithBigInt(rightHandSideValue)}?> (${result})` ) return { result, diff --git a/src/utils.js b/src/utils.js new file mode 100644 index 0000000..e55197d --- /dev/null +++ b/src/utils.js @@ -0,0 +1,7 @@ +export function jsonStringifyWithBigInt (data) { + return JSON.stringify(data, + (key, value) => { + return typeof value === "bigint" ? value.toString() : value; + } + ) +}