@robotical/sensors-dashboard
Version:
A dashboard tool for depicting Marty data by Robotical
16 lines (12 loc) • 425 B
text/typescript
import addonNamesMap from "./constants/addons-names";
export default function renameValueLabel(valKey: string, addonName: string) {
const mappedFullKey = addonNamesMap(valKey);
if (mappedFullKey !== valKey) {
return mappedFullKey;
}
const shortenedKey = valKey
.replace(addonName, "")
.replace(/^[_\s-]+/, "");
const mappedShortKey = addonNamesMap(shortenedKey);
return mappedShortKey || valKey;
}