go-ethereum/src/utils/getOS.ts
2022-12-12 19:44:42 -03:00

11 lines
313 B
TypeScript

import { OS } from '../types';
// slice to get the last part of the url that includes the os
export const getOS = (url: string): OS =>
url?.slice(46).includes('darwin')
? 'darwin'
: url?.slice(46).includes('linux')
? 'linux'
: url?.slice(46).includes('windows')
? 'windows'
: 'mobile';