Reworked the file dict keys to drop the suffix.
Some checks failed
Lint / pre-commit Linting (push) Failing after 50s
Some checks failed
Lint / pre-commit Linting (push) Failing after 50s
This commit is contained in:
parent
dbb1011e0c
commit
7141ce09e4
9
index.js
9
index.js
@ -26,8 +26,13 @@ function readFilesIntoDict(pattern, prefix) {
|
||||
files.forEach(file => {
|
||||
let readPromise = fs.promises.readFile(file, 'utf8')
|
||||
.then(content => {
|
||||
// Correctly remove the prefix from the filename
|
||||
const key = prefix && file.startsWith(prefix) ? file.slice(prefix.length) : file;
|
||||
// Remove the prefix from the filename and drop the file suffix
|
||||
let key = file;
|
||||
if (prefix && file.startsWith(prefix)) {
|
||||
key = key.slice(prefix.length);
|
||||
}
|
||||
key = path.basename(key, path.extname(key)); // Drop the file suffix
|
||||
|
||||
fileDict[key] = content;
|
||||
});
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user