MCPcopy
hub / github.com/webpack/webpack / populate

Function populate

lib/util/mimeTypes.js:108–127  ·  view source on GitHub ↗
(extensions, types)

Source from the content-addressed store, hash-verified

106 * @param {Record<string, string>} types types
107 */
108const populate = (extensions, types) => {
109 for (const type of Object.keys(db)) {
110 const mime = db[type];
111 const foundExtensions = mime.extensions;
112
113 if (!foundExtensions || foundExtensions.length === 0) {
114 continue;
115 }
116
117 // mime -> extensions
118 extensions[type] = foundExtensions;
119
120 // extension -> mime
121 for (let i = 0; i < foundExtensions.length; i++) {
122 const extension = foundExtensions[i];
123
124 types[extension] = preferredType(extension, types[extension], type);
125 }
126 }
127};
128
129populate(extensions, types);
130

Callers 1

mimeTypes.jsFile · 0.85

Calls 2

preferredTypeFunction · 0.85
keysMethod · 0.65

Tested by

no test coverage detected