1
0
mirror of https://github.com/home-assistant/frontend.git synced 2026-03-02 23:10:47 +00:00
Files
frontend/src/common/string/compare.ts
2019-05-07 21:07:59 -07:00

14 lines
244 B
TypeScript

export const compare = (a: string, b: string) => {
if (a < b) {
return -1;
}
if (a > b) {
return 1;
}
return 0;
};
export const caseInsensitiveCompare = (a: string, b: string) =>
compare(a.toLowerCase(), b.toLowerCase());