@yoroi/common
Version:
The Common package of Yoroi SDK
20 lines (19 loc) • 835 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.storageSerializer = void 0;
var _numberReplacer = require("../../numbers/number-replacer");
/**
* Serializes the given object into a JSON string, with support for BigInt and BigNumber values.
* Since BigInt and BigNumber are not supported by JSON.stringify, it serialize them as strings.
*
* @param toStringify - The object to be serialized.
* @returns A stringfied JSON object with BigInt and BigNumber values serialized as strings.
* @summary This is not a replacer function, it will retun a stringified JSON object direclty.
*/
const storageSerializer = toStringify => {
return JSON.stringify(toStringify, _numberReplacer.numberReplacer);
};
exports.storageSerializer = storageSerializer;
//# sourceMappingURL=storage-serializer.js.map