marko
Version:
UI Components + streaming, async, high performance, HTML templating for Node.js and the browser.
18 lines (17 loc) • 357 B
JavaScript
var toJSONDescriptor = {
configurable: true,
enumerable: false,
writable: true,
value: function emptyInput() {
return {};
},
};
module.exports = function (input) {
if (input.toJSON) {
return input;
} else {
const newInput = { ...input };
Object.defineProperty(newInput, "toJSON", toJSONDescriptor);
return newInput;
}
};