Skip to content

Commit

Permalink
refactored and simplified to regex
Browse files Browse the repository at this point in the history
  • Loading branch information
nathanchase committed Dec 17, 2022
1 parent 04c70b4 commit 4492656
Showing 1 changed file with 2 additions and 19 deletions.
21 changes: 2 additions & 19 deletions src/compress.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,25 +71,8 @@ function isTextMime(mimeType: string) {
return /text|javascript|json|xml/.test(mimeType);
}

const compressibleMimeTypes = [
'atom',
'css',
'eot',
'htc',
'html',
'ico',
'js',
'json',
'mjs',
'otf',
'rss',
'svg',
'text',
'ttf',
'webmanifest',
'xml',
];
const compressibleMimeTypesRegex = /atom|css|eot|htc|html|ico|js|json|mjs|otf|rss|svg|text|ttf|webmanifest|xml/

function isCompressableMime(mimeType: string) {
return compressibleMimeTypes.includes(mimeType);
return compressibleMimeTypesRegex.test(mimeType);
}

0 comments on commit 4492656

Please sign in to comment.