]> Untitled Git - lemmy-ui.git/blob - src/shared/utils/browser/platform.ts
fix submodule error
[lemmy-ui.git] / src / shared / utils / browser / platform.ts
1 import { isBrowser } from "@utils/browser";
2
3 const platformString = () =>
4   navigator.platform?.match(/mac|win|linux/i)?.[0].toLowerCase();
5 const getPlatformPredicate = (platform: string) => () =>
6   isBrowser() && platformString() === platform;
7 const isWin = getPlatformPredicate("win");
8 const isMac = getPlatformPredicate("mac");
9 const isLinux = getPlatformPredicate("linux");
10
11 const platform = { isWin, isMac, isLinux };
12
13 export default platform;