npx standard --fix

This commit is contained in:
cclauss
2020-05-03 09:05:12 +02:00
parent e62ad2f73e
commit 856dc2f63c
47 changed files with 2240 additions and 2371 deletions

View File

@ -1,24 +1,24 @@
function intToHex(num){
switch(num){
case 10: return "A";
case 11: return "B";
case 12: return "C";
case 13: return "D";
case 14: return "E";
case 15: return "F";
}
return num;
function intToHex (num) {
switch (num) {
case 10: return 'A'
case 11: return 'B'
case 12: return 'C'
case 13: return 'D'
case 14: return 'E'
case 15: return 'F'
}
return num
}
function decimalToHex(num){
let hex_out = [];
while(num > 15) {
hex_out.push(intToHex(num%16));
num = Math.floor(num / 16);
}
return intToHex(num) + hex_out.join("");
function decimalToHex (num) {
const hex_out = []
while (num > 15) {
hex_out.push(intToHex(num % 16))
num = Math.floor(num / 16)
}
return intToHex(num) + hex_out.join('')
}
// test cases
console.log(decimalToHex(999098) === "F3EBA");
console.log(decimalToHex(123) === "7B");
console.log(decimalToHex(999098) === 'F3EBA')
console.log(decimalToHex(123) === '7B')