@hakit/core
Version:
A collection of React hooks and helpers for Home Assistant to easily communicate with the Home Assistant WebSocket API.
16 lines (15 loc) • 462 B
JavaScript
const a = [" ", ": ", " - "], c = (s, o) => {
const r = s.toLowerCase(), n = o.toLowerCase();
for (const i of a) {
const t = `${n}${i}`;
if (r.startsWith(t)) {
const e = s.substring(t.length);
if (e.length)
return f(e.substr(0, e.indexOf(" "))) ? e : e[0].toUpperCase() + e.slice(1);
}
}
}, f = (s) => s.toLowerCase() !== s;
export {
c as stripPrefixFromEntityName
};
//# sourceMappingURL=stripPrefixFromEntityName.js.map