UNPKG

amos-tool

Version:

amos ui tool

11 lines (9 loc) 522 B
"use strict"; var trim = require("./_trim"); module.exports = function(r) { if (window.JSON && window.JSON.parse) return window.JSON.parse(r + ""); var n, t = null, e = trim(r + ""); return e && !trim(e.replace(/(,)|(\[|{)|(}|])|"(?:[^"\\\r\n]|\\["\\\/bfnrt]|\\u[\da-fA-F]{4})*"\s*:?|true|false|null|-?(?!0\d)\d+(?:\.\d+|)(?:[eE][+-]?\d+|)/g, function(r, e, i, u) { return n && e && (t = 0), 0 === t ? r : (n = i || e, t += !u - !i, ""); })) ? Function("return " + e)() : Function("Invalid JSON: " + r)(); };