UNPKG

amos-tool

Version:

amos ui tool

13 lines (12 loc) 759 B
module.exports = function(t) { if ("undefined" != typeof JSON && JSON.stringify) return JSON.stringify(t); var e = "", o = [], r = function(t) { var n = !1; "[object Array]" === Object.prototype.toString.call(t) ? (o.push("]", "["), n = !0) : "[object Object]" === Object.prototype.toString.call(t) && o.push("}", "{"); for (var c in t) "[object Null]" === Object.prototype.toString.call(t[c]) ? t[c] = "null" : "[object Undefined]" === Object.prototype.toString.call(t[c]) && (t[c] = "undefined"), e += t[c] && "object" == typeof t[c] ? "," + (n ? "" : '"' + c + '":' + (n ? '"' : "")) + r(t[c]) : ',"' + (n ? "" : c + '":"') + t[c] + '"'; return "" != e && (e = e.slice(1)), o.pop() + e + o.pop() }; return r(t) };