MCPcopy
hub / github.com/webpack/webpack / lookup

Function lookup

lib/util/mimeTypes.js:161–174  ·  view source on GitHub ↗
(path)

Source from the content-addressed store, hash-verified

159 * @returns {undefined | string} resolved MIME type
160 */
161const lookup = (path) => {
162 if (!path) {
163 return;
164 }
165
166 // get the extension ("ext" or ".ext" or full path)
167 const extension = extname(`x.${path}`).toLowerCase().slice(1);
168
169 if (!extension) {
170 return;
171 }
172
173 return types[extension];
174};
175
176module.exports = { extension, lookup };

Callers

nothing calls this directly

Calls 2

extnameFunction · 0.85
sliceMethod · 0.80

Tested by

no test coverage detected