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

Function getRequiredModuleName

tools/eslint-rules/required-modules.js:40–45  ·  view source on GitHub ↗

* Function to check if the path is a required module and return its name. * @param {string} str The path to check * @returns {undefined | string} required module name or undefined

(str)

Source from the content-addressed store, hash-verified

38 * @returns {undefined | string} required module name or undefined
39 */
40 function getRequiredModuleName(str) {
41 const match = requiredModules.find(([, test]) => {
42 return test.test(str);
43 });
44 return match ? match[0] : undefined;
45 }
46
47 /**
48 * Function to check if a node has an argument that is a required module and

Callers 2

createFunction · 0.85

Calls 2

findMethod · 0.65
testMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…