source: trip-planner-front/node_modules/cosmiconfig/dist/cacheWrapper.js@ 6a3a178

Last change on this file since 6a3a178 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 612 bytes
Line 
1"use strict";
2
3Object.defineProperty(exports, "__esModule", {
4 value: true
5});
6exports.cacheWrapper = cacheWrapper;
7exports.cacheWrapperSync = cacheWrapperSync;
8
9async function cacheWrapper(cache, key, fn) {
10 const cached = cache.get(key);
11
12 if (cached !== undefined) {
13 return cached;
14 }
15
16 const result = await fn();
17 cache.set(key, result);
18 return result;
19}
20
21function cacheWrapperSync(cache, key, fn) {
22 const cached = cache.get(key);
23
24 if (cached !== undefined) {
25 return cached;
26 }
27
28 const result = fn();
29 cache.set(key, result);
30 return result;
31}
32//# sourceMappingURL=cacheWrapper.js.map
Note: See TracBrowser for help on using the repository browser.