@websolutespa/payload-plugin-bowl
Version:
Bowl PayloadCms plugin of the BOM Repository
25 lines (24 loc) • 709 B
JavaScript
import * as fs from 'fs';
import * as path from 'path';
export function debugJson(name, data) {
if (typeof fs.writeFileSync === 'function') {
fs.writeFileSync(path.join(process.cwd(), name), JSON.stringify(data, replaceCircularReference(), 2), {
encoding: 'utf8'
});
} else {
console.log('debugJson', name, data);
}
}
function replaceCircularReference() {
const seen = new WeakSet();
return (key, value)=>{
if (typeof value === 'object' && value !== null) {
if (seen.has(value)) {
return undefined;
}
seen.add(value);
}
return value;
};
}
//# sourceMappingURL=debug.js.map