env.js 654 B

1234567891011121314151617181920212223
  1. 'use strict';
  2. exports.isNode = 'undefined' != typeof process
  3. && 'object' == typeof module
  4. && 'object' == typeof global
  5. && 'function' == typeof Buffer
  6. && process.argv
  7. exports.isMongo = !exports.isNode
  8. && 'function' == typeof printjson
  9. && 'function' == typeof ObjectId
  10. && 'function' == typeof rs
  11. && 'function' == typeof sh;
  12. exports.isBrowser = !exports.isNode
  13. && !exports.isMongo
  14. && 'undefined' != typeof window;
  15. exports.type = exports.isNode ? 'node'
  16. : exports.isMongo ? 'mongo'
  17. : exports.isBrowser ? 'browser'
  18. : 'unknown'