You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

22 lines
513 B
JavaScript

'use strict';
module.exports = function parseModules(filePath) {
if (!filePath.includes("/") && !filePath.includes("\\")) {
return ["<internal>"];
} else {
let regex = /(?:\/|\\)node_modules(?:\/|\\)([^\/\\]+)/g;
let match, matches = [];
while (match = regex.exec(filePath)) {
matches.push(match);
}
console.log(filePath)
console.log(matches)
return matches.map((match) => {
return match[1];
});
}
};