const isPowerOf2 = n => n && (n & (n - 1)) === 0
const getNextPowerOf2 = n => Math.pow(2, Math.ceil(Math.log2(n)))
const canvasSide = isPowerOf2(side) ? side : getNextPowerOf2(side)
/**
* Greatest common divisor
*/
function gcd(a, b) {
while (b > 0) {
const r = a % b;
a = b;
b = r;
}
return a;
}
/**
* Display seconds in MM:SS format
*/
function displaySeconds (seconds) {
const date = new Date(null)
date.setSeconds(seconds)
const dateString = date.toUTCString()
return dateString.match(/\d\d:(\d\d:\d\d)/)[1]
}
/**
* Remove accents from string
**/
const removeAccents = str =>
str.normalize("NFD").replace(/[\u0300-\u036f]/g, "")
// removeAccents("Crème Brulée") -> Creme Brulee