Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/condition.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
'use strict'

import debug from './debug'
import { jsonStringifyWithBigInt } from './utils'

export default class Condition {
constructor (properties) {
Expand Down Expand Up @@ -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})`
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's avoid a custom stringifier here when we can instead rely on the console.log built-in formatter if we change the signature of debug

)
return {
result,
Expand Down
7 changes: 7 additions & 0 deletions src/utils.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export function jsonStringifyWithBigInt (data) {
return JSON.stringify(data,
(key, value) => {
return typeof value === "bigint" ? value.toString() : value;
}
)
}