Skip to content

Commit e2906da

Browse files
committed
refactor: use lastIndexOf to avoid allocation
1 parent 0a27556 commit e2906da

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

app/utils/file-types.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ const BINARY_EXTENSIONS = new Set([
6565
])
6666

6767
export function isBinaryFilePath(filePath: string): boolean {
68-
const ext = filePath.split('.').pop()?.toLowerCase() ?? ''
68+
const dotIndex = filePath.lastIndexOf('.')
69+
const ext = dotIndex > -1 ? filePath.slice(dotIndex + 1).toLowerCase() : ''
6970
return BINARY_EXTENSIONS.has(ext)
7071
}

0 commit comments

Comments
 (0)