Protocol upgrading WIP

This commit is contained in:
Mo Bitar
2020-03-15 18:29:01 -05:00
parent 5a6a41933a
commit 148e840757
15 changed files with 956 additions and 403 deletions

View File

@@ -24,6 +24,31 @@ export function dictToArray(dict) {
return Object.keys(dict).map((key) => dict[key]);
}
export function humanReadableList(array) {
const addSeparator = (index, length) => {
if (index > 0) {
if (index === length - 1) {
if (length === 2) {
return ' and ';
} else {
return ', and ';
}
} else {
return ', ';
}
}
return '';
};
let result = '';
for (let i = 0; i < array.length; i++) {
const value = array[i];
result += addSeparator(i, array.length);
result += value;
}
return result;
}
export function getPlatformString() {
try {
const platform = navigator.platform.toLowerCase();