const json = '{"test":{"a":1,"b":false,"c":"string"},"status":"ok"}';
const prettyJson = JSON.stringify(JSON.parse(json), null, 2);
console.log(prettyJson);
// '{
// "test": {
// "a": 1,
// "b": false,
// "c": "string"
// },
// "status": "ok"
// }'
white-space: pre
и, возможно, моноширинный шрифт. function foo (global, factory) {
if (typeof exports === 'object' && typeof module !== 'undefined') {
module.exports = factory();
return;
}
if (typeof define === 'function' && define.amd) {
define(factory);
return;
}
global.Vue = factory();
}
foo(this, finction() { ... });