session-desktop/ts/OS.ts

16 lines
434 B
TypeScript
Raw Normal View History

2018-05-03 01:57:02 +02:00
import is from '@sindresorhus/is';
import os from 'os';
import semver from 'semver';
export const isMacOS = () => process.platform === 'darwin';
export const isLinux = () => process.platform === 'linux';
export const isWindows = (minVersion?: string) => {
const osRelease = os.release();
2018-05-24 01:04:39 +02:00
if (process.platform !== 'win32') {
return false;
}
return is.undefined(minVersion) ? true : semver.gte(osRelease, minVersion);
2018-05-03 01:57:02 +02:00
};