checkWindows.js 435 B

1234567891011121314151617181920212223242526
  1. 'use strict'
  2. const errorMessage = 'Not a Windows platform'
  3. const isWindows = process.platform.indexOf('win') === 0
  4. function async (callback) {
  5. if (isWindows === false) {
  6. if (typeof callback === 'function') {
  7. callback(new Error(errorMessage))
  8. }
  9. }
  10. return isWindows
  11. }
  12. function sync () {
  13. if (isWindows === false) {
  14. throw new Error(errorMessage)
  15. }
  16. return isWindows
  17. }
  18. module.exports = {
  19. async,
  20. sync,
  21. }