用工小程序前端代码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

78 lines
1.7 KiB

6 months ago
  1. # osx-release [![Build Status](https://travis-ci.org/sindresorhus/osx-release.svg?branch=master)](https://travis-ci.org/sindresorhus/osx-release)
  2. > Get the name and version of a OS X release from the Darwin version.
  3. > Example: `13.2.0` → `{name: 'Mavericks', version: '10.9'}`
  4. ## Install
  5. ```sh
  6. $ npm install --save osx-release
  7. ```
  8. ## Usage
  9. ```js
  10. var os = require('os');
  11. var osxRelease = require('osx-release');
  12. // on an OS X Mavericks system
  13. osxRelease();
  14. //=> {name: 'Mavericks', version: '10.9'}
  15. os.release();
  16. //=> 13.2.0
  17. // this is the Darwin kernel version
  18. osxRelease(os.release());
  19. //=> {name: 'Mavericks', version: '10.9'}
  20. osxRelease('14.0.0');
  21. //=> {name: 'Yosemite', version: '10.10'}
  22. ```
  23. ## API
  24. ### osxRelease([release])
  25. #### release
  26. Type: `string`
  27. By default the current OS is used, but you can supply a custom [Darwin kernel version](http://en.wikipedia.org/wiki/Darwin_%28operating_system%29#Release_history), which is the output of [`os.release()`](http://nodejs.org/api/os.html#os_os_release).
  28. ## CLI
  29. ```sh
  30. $ npm install --global osx-release
  31. ```
  32. ```sh
  33. $ osx-release --help
  34. Usage
  35. osx-release [release]
  36. Example
  37. osx-release
  38. Mavericks 10.9
  39. osx-release 14.0.0
  40. Yosemite 10.10
  41. ```
  42. ## Related
  43. - [os-name](https://github.com/sindresorhus/os-name) - Get the name of the current operating system. Example: `OS X Mavericks`
  44. - [osx-version](https://github.com/sindresorhus/osx-version) - Get the OS X version of the current system. Example: `10.9.3`
  45. - [win-release](https://github.com/sindresorhus/osx-version) - Get the name of a Windows version from the release number: `5.1.2600``XP`
  46. ## License
  47. MIT © [Sindre Sorhus](http://sindresorhus.com)