UNPKG

@yoroi/common

Version:

The Common package of Yoroi SDK

27 lines 671 B
import { recordWithETag } from './record-with-etag'; import { isExpired } from './is-expired'; export const cacheResolveRecordsSource = _ref => { let { ids, cachedInfosWithoutRecord } = _ref; const toFetch = []; const fromCache = []; ids.forEach(id => { const cachedRecord = cachedInfosWithoutRecord.get(id); if (cachedRecord) { if (isExpired(cachedRecord)) { toFetch.push(recordWithETag(id, cachedRecord.hash)); } else { fromCache.push(id); } } else { toFetch.push(recordWithETag(id)); } }); return { toFetch, fromCache }; }; //# sourceMappingURL=cache-resolve-records-source.js.map