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.

30 lines
995 B

4 years ago
  1. var freeGlobal = require('./_freeGlobal');
  2. /** Detect free variable `exports`. */
  3. var freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;
  4. /** Detect free variable `module`. */
  5. var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;
  6. /** Detect the popular CommonJS extension `module.exports`. */
  7. var moduleExports = freeModule && freeModule.exports === freeExports;
  8. /** Detect free variable `process` from Node.js. */
  9. var freeProcess = moduleExports && freeGlobal.process;
  10. /** Used to access faster Node.js helpers. */
  11. var nodeUtil = (function() {
  12. try {
  13. // Use `util.types` for Node.js 10+.
  14. var types = freeModule && freeModule.require && freeModule.require('util').types;
  15. if (types) {
  16. return types;
  17. }
  18. // Legacy `process.binding('util')` for Node.js < 10.
  19. return freeProcess && freeProcess.binding && freeProcess.binding('util');
  20. } catch (e) {}
  21. }());
  22. module.exports = nodeUtil;