Skip to content

Commit

Permalink
fix: error was thrown when --ignorefile was not given
Browse files Browse the repository at this point in the history
  • Loading branch information
amtrack committed Oct 19, 2022
1 parent 238d62c commit a26023b
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ export function formatFileProperties(
export async function getNonEmptyLinesFromFile(
filePath: string
): Promise<string[]> {
if (!filePath) {
return [];
}
const content = await readFile(filePath, "utf8");
return (
parseNewLineSeparatedValues(content)
Expand All @@ -51,6 +54,9 @@ export async function getNonEmptyLinesFromFile(
export async function getNonEmptyLinesFromFiles(
filePaths: string[]
): Promise<string[]> {
if (!filePaths) {
return [];
}
const promises = filePaths.map((fp) => getNonEmptyLinesFromFile(fp));
const results = await Promise.all(promises);
return results.flat().filter(Boolean);
Expand Down

0 comments on commit a26023b

Please sign in to comment.