aboutsummaryrefslogtreecommitdiff
path: root/node_modules/cosmiconfig/dist/cacheWrapper.js
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/cosmiconfig/dist/cacheWrapper.js')
-rw-r--r--node_modules/cosmiconfig/dist/cacheWrapper.js19
1 files changed, 19 insertions, 0 deletions
diff --git a/node_modules/cosmiconfig/dist/cacheWrapper.js b/node_modules/cosmiconfig/dist/cacheWrapper.js
new file mode 100644
index 00000000..38c4fcb2
--- /dev/null
+++ b/node_modules/cosmiconfig/dist/cacheWrapper.js
@@ -0,0 +1,19 @@
+//
+'use strict';
+
+function cacheWrapper (cache , key , fn ) {
+ if (!cache) {
+ return fn();
+ }
+
+ const cached = cache.get(key);
+ if (cached !== undefined) {
+ return cached;
+ }
+
+ const result = fn();
+ cache.set(key, result);
+ return result;
+}
+
+module.exports = cacheWrapper;