docxtemplater
Version:
Generate docx, pptx, and xlsx from templates (Word, Powerpoint and Excel documents), from Node.js, the Browser and the command line
17 lines (16 loc) • 687 B
JavaScript
;
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
function safeStringify(obj) {
var cache = [];
return JSON.stringify(obj, function (key, value) {
if (_typeof(value) === "object" && value !== null) {
if (cache.indexOf(value) !== -1) {
// Circular reference found
return;
}
cache.push(value);
}
return value;
}, null);
}
module.exports = safeStringify;