Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/utils/key.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ export function getByteForCode(
const byte: number | undefined = basicKeyToByte[code];
if (byte !== undefined) {
return byte;
} else if (isHexCode(code)) {
return eval(code)
Comment thread
lowking marked this conversation as resolved.
Outdated
} else if (isLayerCode(code)) {
return getByteForLayerCode(code, basicKeyToByte);
} else if (advancedStringToKeycode(code, basicKeyToByte) !== null) {
Expand All @@ -82,6 +84,10 @@ export function getByteForCode(
throw `Could not find byte for ${code}`;
}

function isHexCode(code: string) {
return code.startsWith('0x')
}

function isLayerCode(code: string) {
return /([A-Za-z]+)\((\d+)\)/.test(code);
}
Expand Down