Skip to content

Commit

Permalink
Fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
narze authored Sep 12, 2021
1 parent a755e31 commit 4b04b8f
Showing 1 changed file with 16 additions and 20 deletions.
36 changes: 16 additions & 20 deletions generateXkb.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,12 @@ export async function generateXkb(
}

function toHex(str: string) {
var hex, i;
var result = "";
for (i=0; i<str.length; i++) {
hex = str.charCodeAt(i).toString(16);
result += " 0x1"+("000000"+hex).slice(-6);
let hex, i;
let result = "";

for (i = 0; i < str.length; i++) {
hex = str.charCodeAt(i).toString(16);
result += " 0x1" + ("000000" + hex).slice(-6);
}
return result;
}
Expand Down Expand Up @@ -92,28 +93,23 @@ export async function generateXkb(
]

const layoutLines = [""]
Object.entries(klfDefaultLayout).forEach(([key, value]) =>
{
const extensions = layout.layers.map
(
(_, idx) =>
{
return (toHex(layout.keys[key][idx]) || "voidsymbol")+((idx<3)?",":"")
}
)
Object.entries(klfDefaultLayout).forEach(([key, value]) => {
const extensions = layout.layers.map((_, idx) => {
return (toHex(layout.keys[key][idx]) || "voidsymbol") + ((idx < 3) ? "," : "")
})

extensions.push("] };")
layoutLines.push([value,...extensions].join(" "))
layoutLines.push([value, ...extensions].join(" "))
})

fs.writeFileSync(
outputPath,
"\ufeff" +
[
lines.join("\n"),
layoutLines.join("\n "),
" include \"level3(ralt_switch)\"\n};",
].join("\n\n"),
[
lines.join("\n"),
layoutLines.join("\n "),
" include \"level3(ralt_switch)\"\n};",
].join("\n\n"),
{
encoding: "utf8",
}
Expand Down

0 comments on commit 4b04b8f

Please sign in to comment.