Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | 1x 1x 10x 9x 9x 22x 22x 22x 9x 10x 10x | import { trimSpaces } from "./trimSpaces";
export const getFigure = <T>(map: Record<string, T>, name?: string) => {
if (!name) return map.default;
const deviceKeys = Object.keys(map);
const figure = deviceKeys.find((key) => {
const parsedName = trimSpaces(name).toLowerCase();
const parsedKey = key.toLowerCase();
return parsedName.toLowerCase().includes(parsedKey);
});
return figure ? map[figure as keyof typeof map] : map.default;
};
|