index.d.ts 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. declare const macosRelease: {
  2. /**
  3. Get the name and version of a macOS release from the Darwin version.
  4. @param release - By default, the current operating system is used, but you can supply a custom [Darwin kernel version](https://en.wikipedia.org/wiki/Darwin_%28operating_system%29#Release_history), which is the output of [`os.release()`](https://nodejs.org/api/os.html#os_os_release).
  5. @example
  6. ```
  7. import * as os from 'os';
  8. import macosRelease = require('macos-release');
  9. // On a macOS Sierra system
  10. macosRelease();
  11. //=> {name: 'Sierra', version: '10.12'}
  12. os.release();
  13. //=> 13.2.0
  14. // This is the Darwin kernel version
  15. macosRelease(os.release());
  16. //=> {name: 'Sierra', version: '10.12'}
  17. macosRelease('14.0.0');
  18. //=> {name: 'Yosemite', version: '10.10'}
  19. macosRelease('20.0.0');
  20. //=> {name: 'Big Sur', version: '11'}
  21. ```
  22. */
  23. (): {name: string, version: string}
  24. (release: string): {name: string, version: string} | undefined;
  25. // TODO: remove this in the next major version, refactor the whole definition to:
  26. // declare function macosRelease(release?: string): {name: string, version: string};
  27. // export = macosRelease;
  28. default: typeof macosRelease;
  29. };
  30. export = macosRelease;