unused-package
Advanced tools
Comparing version 1.0.3 to 1.0.4
{ | ||
"name": "unused-package", | ||
"version": "1.0.3", | ||
"version": "1.0.4", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "unused.js", |
@@ -16,3 +16,6 @@ const directories = __dirname.split("/"); | ||
const traverseDirectories = async (source) => { | ||
const data = await fs.promises.readdir(source, { withFileTypes: true }); | ||
const isSourceFile = fs.lstatSync(source).isFile(); | ||
const data = isSourceFile | ||
? [{ isDirectory: () => false, name: source }] | ||
: await fs.promises.readdir(source, { withFileTypes: true }); | ||
@@ -27,3 +30,5 @@ for (let i = 0; i < data.length; i++) { | ||
) { | ||
const path = `${startingPath}/${source}/${file.name}`; | ||
const path = isSourceFile | ||
? `${startingPath}/${source}` | ||
: `${startingPath}/${source}/${file.name}`; | ||
const fileData = fs.readFileSync(path, "utf-8"); | ||
@@ -118,3 +123,1 @@ const codeLines = fileData.split("\n"); | ||
module.exports = findUnUsedPackages; | ||
//todo accept entry as file |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
5308
102