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

Function underNodeModules

lib/internal/modules/esm/get_format.js:138–142  ·  view source on GitHub ↗

* Determine whether the given file URL is under a `node_modules` folder. * This function assumes that the input has already been verified to be a `file:` URL, * and is a file rather than a folder. * @param {URL} url * @returns {boolean}

(url)

Source from the content-addressed store, hash-verified

136 * @returns {boolean}
137 */
138function underNodeModules(url) {
139 if (url.protocol !== 'file:') { return false; } // We determine module types for other protocols based on MIME header
140
141 return StringPrototypeIncludes(url.pathname, '/node_modules/');
142}
143
144let typelessPackageJsonFilesWarnedAbout;
145function warnTypelessPackageJsonFile(pjsonPath, url) {

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…