bonsai-analyzer
Version:
Trim your dependency tree.
19 lines (16 loc) • 406 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = fetchJSON;
const responseCache = {};
function fetchJSON(endpoint) {
if (!responseCache[endpoint]) {
responseCache[endpoint] = fetch(endpoint, {
headers: new Headers({
'Accept': 'application/json'
})
}).then(response => response.json());
}
return responseCache[endpoint];
}