macos-version
Get or check the current macOS version
Install
$ npm install --save macos-version
Usage
const macosVersion = require('macos-version');
macosVersion();
macosVersion.is('>10.10');
macosVersion.assertGreaterThanOrEqualTo('10.12.5');
API
macosVersion()
Returns the macOS version.
macosVersion.is(semverRange)
Returns a boolean
of whether the specified semver range matches the macOS version.
macosVersion.isGreaterThanOrEqualTo(version)
Returns a boolean
of whether the macOS version is greater than or equal to the specified version.
macosVersion.assert(semverRange)
Throws an error if the specified semver range does not match the macOS version.
macosVersion.assertGreaterThanOrEqualTo(version)
Throws an error if the macOS version is not greater than or equal to the specified version.
Prefer this over .assert()
whenever possible as it outputs a more user-friendly error message.
assertMacOS()
Throws an error if platform is not macOS.
.isMacOS
True if platform is macOS.
Related
License
MIT © Sindre Sorhus