MCPcopy Index your code
hub / github.com/nodejs/node / createModeAwareCache

Function createModeAwareCache

test/fixtures/snapshot/typescript.js:42868–42902  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

42866 }
42867 /* @internal */
42868 function createModeAwareCache() {
42869 var underlying = new ts.Map();
42870 var memoizedReverseKeys = new ts.Map();
42871 var cache = {
42872 get: function (specifier, mode) {
42873 return underlying.get(getUnderlyingCacheKey(specifier, mode));
42874 },
42875 set: function (specifier, mode, value) {
42876 underlying.set(getUnderlyingCacheKey(specifier, mode), value);
42877 return cache;
42878 },
42879 delete: function (specifier, mode) {
42880 underlying.delete(getUnderlyingCacheKey(specifier, mode));
42881 return cache;
42882 },
42883 has: function (specifier, mode) {
42884 return underlying.has(getUnderlyingCacheKey(specifier, mode));
42885 },
42886 forEach: function (cb) {
42887 return underlying.forEach(function (elem, key) {
42888 var _a = memoizedReverseKeys.get(key), specifier = _a[0], mode = _a[1];
42889 return cb(elem, specifier, mode);
42890 });
42891 },
42892 size: function () {
42893 return underlying.size;
42894 }
42895 };
42896 return cache;
42897 function getUnderlyingCacheKey(specifier, mode) {
42898 var result = mode === undefined ? specifier : "".concat(mode, "|").concat(specifier);
42899 memoizedReverseKeys.set(result, [specifier, mode]);
42900 return result;
42901 }
42902 }
42903 ts.createModeAwareCache = createModeAwareCache;
42904 /* @internal */
42905 function zipToModeAwareCache(file, keys, values) {

Callers 2

zipToModeAwareCacheFunction · 0.85

Calls 7

getUnderlyingCacheKeyFunction · 0.85
getMethod · 0.65
deleteMethod · 0.65
hasMethod · 0.65
forEachMethod · 0.65
cbFunction · 0.50
setMethod · 0.45

Tested by

no test coverage detected