Skip to content

Commit

Permalink
Use extname to get file extension
Browse files Browse the repository at this point in the history
  • Loading branch information
sondr3 committed Dec 29, 2022
1 parent 341fd5c commit fc44e2a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/compress.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { createReadStream, createWriteStream } from "node:fs";
import { readdir } from "node:fs/promises";
import { resolve } from "node:path";
import { extname, resolve } from "node:path";
import { hrtime } from "node:process";
import { promises as stream } from "node:stream";
import { createBrotliCompress, createGzip } from "node:zlib";
Expand All @@ -20,8 +20,8 @@ async function* walkDir(dir: string): AsyncGenerator<string> {
}

const filterFile = (file: string): boolean => {
return [".css", ".js", ".html", ".xml", ".cjs", ".mjs", ".svg", ".txt"].some((ext) =>
file.endsWith(ext),
return [".css", ".js", ".html", ".xml", ".cjs", ".mjs", ".svg", ".txt"].some(
(ext) => extname(file) == ext,
);
};

Expand Down

0 comments on commit fc44e2a

Please sign in to comment.