@hazae41/glacier
Version:
Yet another React data (re)fetching library
43 lines (41 loc) • 1.07 kB
JavaScript
function shouldUseCacheIfFresh(cache) {
if (cache === "default")
return true;
if (cache === "reload")
return false;
if (cache === "no-cache")
return false;
if (cache === "force-cache")
return true;
if (cache === "only-if-cached")
return true;
return true;
}
function shouldUseCacheIfStale(cache) {
if (cache === "default")
return false;
if (cache === "reload")
return false;
if (cache === "no-cache")
return false;
if (cache === "force-cache")
return true;
if (cache === "only-if-cached")
return true;
return false;
}
function shouldUseNetwork(cache) {
if (cache === "default")
return true;
if (cache === "reload")
return true;
if (cache === "no-cache")
return true;
if (cache === "force-cache")
return true;
if (cache === "only-if-cached")
return false;
return true;
}
export { shouldUseCacheIfFresh, shouldUseCacheIfStale, shouldUseNetwork };
//# sourceMappingURL=index.mjs.map