Skip to content

Commit 37c7fc7

Browse files
committed
maximum call stack exceeded when no width and height is sent
1 parent 4d822d9 commit 37c7fc7

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

index.js

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

44
module.exports = (height, width, seperator = ':') => {
5+
if (!height) {
6+
throw new Error(`Invalid height: ${height}`);
7+
}
8+
9+
if (!width) {
10+
throw new Error(`Invalid width: ${width}`);
11+
}
512
const [h, w] = highestFirst(height, width)
613
const divisor = gcd(h, w)
714
return formatAspectRatio(h, w, divisor, seperator)

0 commit comments

Comments
 (0)