UNPKG
aspect-ratio
Version:
latest (2.1.8)
2.1.8
2.1.7
2.1.6
2.1.5
2.1.4
2.1.3
2.1.2
2.1.1
2.1.0
2.0.3
2.0.2
2.0.1
2.0.0
1.0.0
0.12.13
0.12.12
Get the screen aspect ratio of a device
github.com/Kikobeats/aspect-ratio
Kikobeats/aspect-ratio
aspect-ratio
/
src
/
util.js
11 lines
(9 loc)
•
275 B
JavaScript
View Raw
1
2
3
4
5
6
7
8
9
10
11
const
gcd
= (
a, b
) => (b ===
0
? a :
gcd
(b, a % b))
const
highestFirst
= (
a, b
) => (a < b ? [b, a] : [a, b])
const
formatAspectRatio
= (
h, w, divisor, seperator
) =>
`
${h / divisor}
${seperator}
${w / divisor}
`
module
.
exports
= { gcd, highestFirst, formatAspectRatio }