Use util.types to migrate DEP0103 in Node.js.

PR: #3704
This commit is contained in:
John-David Dalton
2018-04-24 10:00:34 -07:00
parent 97e9edc53d
commit 852988e04a

View File

@@ -436,6 +436,14 @@
/** Used to access faster Node.js helpers. */
var nodeUtil = (function() {
try {
// Use `util.types` for Node.js 10+.
var types = freeModule && freeModule.require && freeModule.require('util').types;
if (types) {
return types;
}
// Legacy `process.binding('util')` for Node.js < 10.
return freeProcess && freeProcess.binding && freeProcess.binding('util');
} catch (e) {}
}());