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

Method set

lib/internal/modules/esm/module_map.js:99–114  ·  view source on GitHub ↗
(url, type = kImplicitTypeAttribute, job)

Source from the content-addressed store, hash-verified

97 return super.get(url)?.[type];
98 }
99 set(url, type = kImplicitTypeAttribute, job) {
100 validateString(url, 'url');
101 validateString(type, 'type');
102
103 const { ModuleJobBase } = require('internal/modules/esm/module_job');
104 if (job instanceof ModuleJobBase !== true &&
105 typeof job !== 'function') {
106 throw new ERR_INVALID_ARG_TYPE('job', 'ModuleJob', job);
107 }
108 debug(`Storing ${url} (${
109 type === kImplicitTypeAttribute ? 'implicit type' : type
110 }) in ModuleLoadMap`);
111 const cachedJobsForUrl = super.get(url) ?? { __proto__: null };
112 cachedJobsForUrl[type] = job;
113 return super.set(url, cachedJobsForUrl);
114 }
115 has(url, type = kImplicitTypeAttribute) {
116 validateString(url, 'url');
117 validateString(type, 'type');

Callers 15

#parseMethod · 0.45
#getKeyForPathMethod · 0.45
syncLinkMethod · 0.45
executeModuleJobMethod · 0.45
importSyncForRequireMethod · 0.45
#cachedDefaultResolveMethod · 0.45
translators.jsFile · 0.45
requireFnFunction · 0.45
createCJSModuleWrapFunction · 0.45

Calls 3

getMethod · 0.65
requireFunction · 0.50
debugFunction · 0.50

Tested by

no test coverage detected