fix AZERTY, layout map generator
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
import fs from 'node:fs';
|
||||
import path from 'node:path';
|
||||
|
||||
const DATA = {};
|
||||
|
||||
for (let i = 2; i < process.argv.length; ++i) {
|
||||
const filename = process.argv[i];
|
||||
const key = path.basename(filename).split('.')[0];
|
||||
const value = JSON.parse(fs.readFileSync(filename));
|
||||
DATA[key] = value;
|
||||
}
|
||||
|
||||
let keys = [];
|
||||
for (const map in DATA) {
|
||||
keys = keys.concat(Object.keys(DATA[map]));
|
||||
}
|
||||
const KEYS = Array.from(new Set(keys)).sort();
|
||||
const ACC = Object.fromEntries(Object.keys(DATA).map((el, i) => [el, i]));
|
||||
const MAP = Object.fromEntries(KEYS.map(el => [el, []]));
|
||||
for (const key of KEYS) {
|
||||
for (const map in ACC) {
|
||||
MAP[key].push(DATA[map][key]);
|
||||
}
|
||||
}
|
||||
|
||||
// minify if all entries are of length 1
|
||||
for (const key in MAP) {
|
||||
for (const c of MAP[key]) {
|
||||
if (!c || c.length !== 1)
|
||||
break;
|
||||
}
|
||||
MAP[key] = MAP[key].join('');
|
||||
}
|
||||
|
||||
const FINAL = {acc: ACC, map: MAP};
|
||||
|
||||
console.log(FINAL);
|
||||
console.log(JSON.stringify(FINAL).length);
|
||||
@@ -14,7 +14,7 @@
|
||||
"Digit7": "7",
|
||||
"Digit8": "8",
|
||||
"Digit9": "9",
|
||||
"Equal": "'",
|
||||
"Equal": "´",
|
||||
"IntlBackslash": "<",
|
||||
"KeyA": "a",
|
||||
"KeyB": "b",
|
||||
|
||||
@@ -1,21 +1,21 @@
|
||||
{
|
||||
"Backquote": "\u00b2",
|
||||
"Backslash": "\u20ac",
|
||||
"Backslash": "μ",
|
||||
"BracketLeft": "^",
|
||||
"BracketRight": "$",
|
||||
"Comma": ";",
|
||||
"Digit0": "0",
|
||||
"Digit0": "\u00e0",
|
||||
"Digit1": "&",
|
||||
"Digit2": "\u00e9",
|
||||
"Digit3": "\"",
|
||||
"Digit4": "'",
|
||||
"Digit5": "",
|
||||
"Digit6": "-",
|
||||
"Digit5": "(",
|
||||
"Digit6": "§",
|
||||
"Digit7": "\u00e8",
|
||||
"Digit8": "*",
|
||||
"Digit9": ")",
|
||||
"Equal": "=",
|
||||
"IntlBackslash": "\\",
|
||||
"Digit8": "!",
|
||||
"Digit9": "ç",
|
||||
"Equal": "-",
|
||||
"IntlBackslash": "<",
|
||||
"KeyA": "q",
|
||||
"KeyB": "b",
|
||||
"KeyC": "c",
|
||||
@@ -42,9 +42,9 @@
|
||||
"KeyX": "x",
|
||||
"KeyY": "y",
|
||||
"KeyZ": "w",
|
||||
"Minus": "_",
|
||||
"Period": ".",
|
||||
"Minus": ")",
|
||||
"Period": ":",
|
||||
"Quote": "\u00f9",
|
||||
"Semicolon": "m",
|
||||
"Slash": "/"
|
||||
"Slash": "="
|
||||
}
|
||||
Reference in New Issue
Block a user