Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
* and have the following file name scheme:
* --.json
*
* A language subtag according to IETF BCP 47
* Display name of the keyboard layout (without dashes)
* `pc` or `mac`
*/
const args = parseArgs(process.argv);
const printInfo = args['info'];
const includeAll = args['all'];
const prettyPrint = args['pretty'];
const outFile = args['output'];
let output;
if (printInfo) {
output = nativeKeymap.getCurrentKeyboardLayout();
} else {
output = {
info: nativeKeymap.getCurrentKeyboardLayout(),
mapping: nativeKeymap.getKeyMap()
};
if (!includeAll) {
// We store only key codes for the "writing system keys" as defined here:
// https://w3c.github.io/uievents-code/#writing-system-keys
const ACCEPTED_CODES = [
'KeyA', 'KeyB', 'KeyC', 'KeyD', 'KeyE', 'KeyF', 'KeyG', 'KeyH', 'KeyI', 'KeyJ', 'KeyK', 'KeyL', 'KeyM',
'KeyN', 'KeyO', 'KeyP', 'KeyQ', 'KeyR', 'KeyS', 'KeyT', 'KeyU', 'KeyV', 'KeyW', 'KeyX', 'KeyY', 'KeyZ',
'Digit1', 'Digit2', 'Digit3', 'Digit4', 'Digit5', 'Digit6', 'Digit7', 'Digit8', 'Digit9', 'Digit0',
'Minus', 'Equal', 'BracketLeft', 'BracketRight', 'Backslash', 'Semicolon', 'Quote', 'Backquote',
'Comma', 'Period', 'Slash', 'IntlBackslash', 'IntlRo', 'IntlYen'
];
const ACCEPTED_VARIANTS = ['value', 'withShift', 'withAltGr', 'withShiftAltGr', 'vkey'];
* A language subtag according to IETF BCP 47
* Display name of the keyboard layout (without dashes)
* `pc` or `mac`
*/
const args = parseArgs(process.argv);
const printInfo = args['info'];
const includeAll = args['all'];
const prettyPrint = args['pretty'];
const outFile = args['output'];
let output;
if (printInfo) {
output = nativeKeymap.getCurrentKeyboardLayout();
} else {
output = {
info: nativeKeymap.getCurrentKeyboardLayout(),
mapping: nativeKeymap.getKeyMap()
};
if (!includeAll) {
// We store only key codes for the "writing system keys" as defined here:
// https://w3c.github.io/uievents-code/#writing-system-keys
const ACCEPTED_CODES = [
'KeyA', 'KeyB', 'KeyC', 'KeyD', 'KeyE', 'KeyF', 'KeyG', 'KeyH', 'KeyI', 'KeyJ', 'KeyK', 'KeyL', 'KeyM',
'KeyN', 'KeyO', 'KeyP', 'KeyQ', 'KeyR', 'KeyS', 'KeyT', 'KeyU', 'KeyV', 'KeyW', 'KeyX', 'KeyY', 'KeyZ',
'Digit1', 'Digit2', 'Digit3', 'Digit4', 'Digit5', 'Digit6', 'Digit7', 'Digit8', 'Digit9', 'Digit0',
'Minus', 'Equal', 'BracketLeft', 'BracketRight', 'Backslash', 'Semicolon', 'Quote', 'Backquote',
'Comma', 'Period', 'Slash', 'IntlBackslash', 'IntlRo', 'IntlYen'
];
const ACCEPTED_VARIANTS = ['value', 'withShift', 'withAltGr', 'withShiftAltGr', 'vkey'];
for (let code of Object.keys(output.mapping)) {
if (ACCEPTED_CODES.indexOf(code) < 0) {
delete output.mapping[code];
protected getNativeLayoutSync(): NativeKeyboardLayout {
return {
info: nativeKeymap.getCurrentKeyboardLayout(),
mapping: nativeKeymap.getKeyMap()
};
}