ejson2
Version:
Extended JSON Evolved
18 lines • 622 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.stringify = void 0;
const utils_1 = require("../utils");
const index_1 = require("./index");
const stringify_1 = require("../stringify");
exports.stringify = (0, utils_1.handleError)((item, options) => {
let serialized;
const json = index_1.EJSON.toJSONValue(item);
if (options && (options.canonical || options.indent)) {
serialized = (0, stringify_1.canonicalStringify)(json, options);
}
else {
serialized = JSON.stringify(json);
}
return serialized;
});
//# sourceMappingURL=stringify.js.map