Skip to content

Commit 85241d2

Browse files
authored
Update index.js
1 parent 97f3cce commit 85241d2

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

index.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,14 @@
22
const { gcd, highestFirst, formatAspectRatio } = require('./utils')
33

44
module.exports = (height, width, seperator = ':') => {
5-
if (isNaN(Number(height))) {
5+
if (typeof height !== 'number') {
66
throw new Error(`Invalid height: ${height}`)
77
}
88

9-
if (isNaN(Number(width))) {
9+
if (typeof width !== 'number') {
1010
throw new Error(`Invalid width: ${width}`)
1111
}
12+
1213
const [h, w] = highestFirst(height, width)
1314
const divisor = gcd(h, w)
1415
return formatAspectRatio(h, w, divisor, seperator)

0 commit comments

Comments
 (0)