We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 97f3cce commit 85241d2Copy full SHA for 85241d2
index.js
@@ -2,13 +2,14 @@
2
const { gcd, highestFirst, formatAspectRatio } = require('./utils')
3
4
module.exports = (height, width, seperator = ':') => {
5
- if (isNaN(Number(height))) {
+ if (typeof height !== 'number') {
6
throw new Error(`Invalid height: ${height}`)
7
}
8
9
- if (isNaN(Number(width))) {
+ if (typeof width !== 'number') {
10
throw new Error(`Invalid width: ${width}`)
11
12
+
13
const [h, w] = highestFirst(height, width)
14
const divisor = gcd(h, w)
15
return formatAspectRatio(h, w, divisor, seperator)
0 commit comments