@stdlib/esm
Version:
ES module distribution for Stdlib, a standard library for JavaScript and Node.js.
3 lines • 554 B
JavaScript
// This file is a part of stdlib. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0
import r from"./../assert/is-string.js";import t from"./../assert/is-function.js";var e=r.isPrimitive,i=t;function n(r,t){if(!e(r))throw new TypeError("invalid argument. First argument must be a string. Value: `"+r+"`.");if(arguments.length>1&&!i(t))throw new TypeError("invalid argument. Reviver argument must be a function. Value: `"+t+"`.");try{return JSON.parse(r,t)}catch(r){return r}}var a=n;export default a;
//# sourceMappingURL=parse-json.js.map