Skip to content

Commit

Permalink
perf(plugin): support checking for a list of extensions
Browse files Browse the repository at this point in the history
  • Loading branch information
mohatt committed Mar 11, 2021
1 parent d64d4e8 commit a942e03
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/filesystem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -203,10 +203,12 @@ export class Filesystem {
* Returns the file extension or checks if
* a file has a given extension
*/
extension (file: string, checkExt?: string): string|boolean {
extension (file: string, checkExt?: string|string[]): string|boolean {
const ext = path.extname(file).replace('.', '').toLowerCase()
if (checkExt === undefined) return ext
return ext === checkExt
return typeof checkExt === 'string'
? ext === checkExt
: checkExt.includes(ext)
}

/**
Expand Down

0 comments on commit a942e03

Please # to comment.