Sha256: ee411fed0433affa9a23b20937ae9b9a79e173d71dce7dc0633c54e27378a78d

Contents?: true

Size: 1.43 KB

Versions: 41

Compression:

Stored size: 1.43 KB

Contents

{"version":3,"sources":["../src/cacheWrapper.ts"],"names":["cacheWrapper","cache","key","fn","cached","get","undefined","result","set","cacheWrapperSync"],"mappings":";;;;;;;;AAEA,eAAeA,YAAf,CACEC,KADF,EAEEC,GAFF,EAGEC,EAHF,EAI8B;AAC5B,QAAMC,MAAM,GAAGH,KAAK,CAACI,GAAN,CAAUH,GAAV,CAAf;;AACA,MAAIE,MAAM,KAAKE,SAAf,EAA0B;AACxB,WAAOF,MAAP;AACD;;AAED,QAAMG,MAAM,GAAG,MAAMJ,EAAE,EAAvB;AACAF,EAAAA,KAAK,CAACO,GAAN,CAAUN,GAAV,EAAeK,MAAf;AACA,SAAOA,MAAP;AACD;;AAED,SAASE,gBAAT,CACER,KADF,EAEEC,GAFF,EAGEC,EAHF,EAIqB;AACnB,QAAMC,MAAM,GAAGH,KAAK,CAACI,GAAN,CAAUH,GAAV,CAAf;;AACA,MAAIE,MAAM,KAAKE,SAAf,EAA0B;AACxB,WAAOF,MAAP;AACD;;AAED,QAAMG,MAAM,GAAGJ,EAAE,EAAjB;AACAF,EAAAA,KAAK,CAACO,GAAN,CAAUN,GAAV,EAAeK,MAAf;AACA,SAAOA,MAAP;AACD","sourcesContent":["import { Cache, CosmiconfigResult } from './types';\n\nasync function cacheWrapper(\n  cache: Cache,\n  key: string,\n  fn: () => Promise<CosmiconfigResult>,\n): Promise<CosmiconfigResult> {\n  const cached = cache.get(key);\n  if (cached !== undefined) {\n    return cached;\n  }\n\n  const result = await fn();\n  cache.set(key, result);\n  return result;\n}\n\nfunction cacheWrapperSync(\n  cache: Cache,\n  key: string,\n  fn: () => CosmiconfigResult,\n): CosmiconfigResult {\n  const cached = cache.get(key);\n  if (cached !== undefined) {\n    return cached;\n  }\n\n  const result = fn();\n  cache.set(key, result);\n  return result;\n}\n\nexport { cacheWrapper, cacheWrapperSync };\n"],"file":"cacheWrapper.js"}

Version data entries

41 entries across 40 versions & 7 rubygems

Version Path
trusty-cms-6.3.1 node_modules/cosmiconfig/dist/cacheWrapper.js.map
optimacms-0.1.61 spec/dummy/node_modules/babel-plugin-macros/node_modules/cosmiconfig/dist/cacheWrapper.js.map
trusty-cms-5.0.7 node_modules/cosmiconfig/dist/cacheWrapper.js.map
trusty-cms-5.0.6 node_modules/cosmiconfig/dist/cacheWrapper.js.map
trusty-cms-5.0.5 node_modules/cosmiconfig/dist/cacheWrapper.js.map
trusty-cms-5.0.4 node_modules/cosmiconfig/dist/cacheWrapper.js.map
disco_app-0.16.1 test/dummy/node_modules/babel-plugin-macros/node_modules/cosmiconfig/dist/cacheWrapper.js.map
disco_app-0.15.2 test/dummy/node_modules/babel-plugin-macros/node_modules/cosmiconfig/dist/cacheWrapper.js.map
trusty-cms-5.0.3 node_modules/cosmiconfig/dist/cacheWrapper.js.map
trusty-cms-5.0.2 node_modules/cosmiconfig/dist/cacheWrapper.js.map
disco_app-0.18.4 test/dummy/node_modules/babel-plugin-macros/node_modules/cosmiconfig/dist/cacheWrapper.js.map
disco_app-0.18.1 test/dummy/node_modules/babel-plugin-macros/node_modules/cosmiconfig/dist/cacheWrapper.js.map
disco_app-0.12.7.pre.puma.pre.3 test/dummy/node_modules/babel-plugin-macros/node_modules/cosmiconfig/dist/cacheWrapper.js.map
disco_app-0.14.0 test/dummy/node_modules/babel-plugin-macros/node_modules/cosmiconfig/dist/cacheWrapper.js.map
disco_app-0.13.6.pre.puma.pre.3 test/dummy/node_modules/babel-plugin-macros/node_modules/cosmiconfig/dist/cacheWrapper.js.map
trusty-cms-5.0.1 node_modules/cosmiconfig/dist/cacheWrapper.js.map
trusty-cms-4.3.5 node_modules/cosmiconfig/dist/cacheWrapper.js.map
trusty-cms-5.0.0 node_modules/cosmiconfig/dist/cacheWrapper.js.map
trusty-cms-4.3.4 node_modules/cosmiconfig/dist/cacheWrapper.js.map
trusty-cms-4.3.3 node_modules/cosmiconfig/dist/cacheWrapper.js.map