UNPKG

bonsai-analyzer

Version:
19 lines (16 loc) 406 B
"use strict"; 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]; }