Skip to content

Commit

Permalink
refactor: Provide a better name for the files variable
Browse files Browse the repository at this point in the history
The files variable stores the names of files in the current module's
directory that have been recognized as possible license files
  • Loading branch information
RSeidelsohn committed Apr 8, 2023
1 parent bdefc86 commit 3105d5a
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ const flatten = function flatten(options) {
const moduleInfo = { licenses: UNKNOWN };
const { color: colorize, deps: json, unknown } = options;
const currentPackageNameAndVersion = `${json.name}@${json.version}`;
let files = [];
let licenseFilesInCurrentModuleDirectory = [];
let licenseData;
let licenseFile;
let noticeFiles = [];
Expand Down Expand Up @@ -171,10 +171,10 @@ const flatten = function flatten(options) {

/*istanbul ignore else*/
if (clarification?.licenseFile) {
files = [clarification.licenseFile];
licenseFilesInCurrentModuleDirectory = [clarification.licenseFile];
} else if (fs.existsSync(module_path)) {
files = licenseFiles(dirFiles);
const filesInModuleDirectory = fs.readdirSync(module_path);
licenseFilesInCurrentModuleDirectory = licenseFiles(filesInModuleDirectory);

noticeFiles = filesInModuleDirectory.filter((filename) => {
filename = filename.toUpperCase();
Expand All @@ -184,7 +184,7 @@ const flatten = function flatten(options) {
});
}

files.forEach(function (filename, index) {
licenseFilesInCurrentModuleDirectory.forEach(function (filename, index) {
licenseFile = path.join(module_path, filename);
// Checking that the file is in fact a normal file and not a directory for example.
/*istanbul ignore else*/
Expand Down

0 comments on commit 3105d5a

Please sign in to comment.