UNPKG

bisheng

Version:

Transform Markdown(and other static files with transformers) into a SPA website using React.

27 lines (21 loc) 1.16 kB
"use strict"; function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } module.exports = function stringify(node) { var depth = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; var indent = ' '.repeat(depth); if (Array.isArray(node)) { return "[\n".concat(node.map(function (item) { return "".concat(indent, " ").concat(stringify(item, depth + 1)); }).join(',\n'), "\n").concat(indent, "]"); } if (_typeof(node) === 'object' && node !== null && !(node instanceof Date)) { if (node.__BISHENG_EMBEDED_CODE) { return node.code; } return "{\n".concat(Object.keys(node).map(function (key) { var value = node[key]; return "".concat(indent, " \"").concat(key, "\": ").concat(stringify(value, depth + 1)); }).join(',\n'), "\n").concat(indent, "}"); } return JSON.stringify(node, null, 2); };