You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
411 B
20 lines
411 B
/* |
|
* Copyright (c) 2020 The ZMK Contributors |
|
* |
|
* SPDX-License-Identifier: CC-BY-NC-SA-4.0 |
|
*/ |
|
|
|
import codes from "./data/hid"; |
|
|
|
export const map = codes.reduce((map, item) => { |
|
item.names.forEach((name) => (map[name] = item)); |
|
return map; |
|
}, {}); |
|
|
|
export function getCode(id) { |
|
return map[id] ?? null; |
|
} |
|
|
|
export function getCodes(ids) { |
|
return ids.reduce((result, id) => [...result, map[id]], []); |
|
}
|
|
|