You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

14 lines
398 B

import type { ErrorType } from '../errors/utils.js'
export type StringifyErrorType = ErrorType
export const stringify: typeof JSON.stringify = (value, replacer, space) =>
JSON.stringify(
value,
(key, value_) => {
const value = typeof value_ === 'bigint' ? value_.toString() : value_
return typeof replacer === 'function' ? replacer(key, value) : value
},
space,
)