Skip to content

Commit

Permalink
domain: do not import util for a simple type check
Browse files Browse the repository at this point in the history
This removes `require('util')` from the `domain` module. There was
only a single simple type check used from the `util` module which
is now inlined instead.

PR-URL: #29825
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Yongsheng Zhang <[email protected]>
  • Loading branch information
BridgeAR authored and targos committed Nov 10, 2019
1 parent 5ade490 commit 8a333a4
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions lib/domain.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@

const { Object, Reflect } = primordials;

const util = require('util');
const EventEmitter = require('events');
const {
ERR_DOMAIN_CALLBACK_NOT_AVAILABLE,
Expand Down Expand Up @@ -207,7 +206,7 @@ Domain.prototype.members = undefined;
Domain.prototype._errorHandler = function(er) {
var caught = false;

if (!util.isPrimitive(er)) {
if ((typeof er === 'object' && er !== null) || typeof er === 'function') {
Object.defineProperty(er, 'domain', {
configurable: true,
enumerable: false,
Expand Down

0 comments on commit 8a333a4

Please sign in to comment.