MCPcopy
hub / github.com/less/less.js / tryWithExtension

Function tryWithExtension

packages/less/lib/less-node/file-manager.js:67–83  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

65 function getFileData(fulfill, reject) {
66 (function tryPathIndex(i) {
67 function tryWithExtension() {
68 const extFilename = options.ext ? self.tryAppendExtension(fullFilename, options.ext) : fullFilename;
69
70 if (extFilename !== fullFilename && !explicit && paths[i] === '.') {
71 try {
72 fullFilename = require.resolve(extFilename);
73 isNodeModule = true;
74 }
75 catch (e) {
76 filenamesTried.push(npmPrefix + extFilename);
77 fullFilename = extFilename;
78 }
79 }
80 else {
81 fullFilename = extFilename;
82 }
83 }
84 if (i < paths.length) {
85 (function tryPrefix(j) {
86 if (j < prefixes.length) {

Callers 1

getFileDataFunction · 0.85

Calls 2

tryAppendExtensionMethod · 0.80
pushMethod · 0.80

Tested by

no test coverage detected