UNPKG

node-request-interceptor

Version:

Low-level HTTP/HTTPS/XHR request interception library for NodeJS

18 lines 419 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.parseJson = void 0; /** * Parses a given string into JSON. * Gracefully handles invalid JSON by returning `null`. */ function parseJson(data) { try { var json = JSON.parse(data); return json; } catch (_) { return null; } } exports.parseJson = parseJson; //# sourceMappingURL=parseJson.js.map