Skip to content

Commit 8a333a4

Browse files
BridgeARtargos
authored andcommitted
domain: do not import util for a simple type check
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]>
1 parent 5ade490 commit 8a333a4

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

lib/domain.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828

2929
const { Object, Reflect } = primordials;
3030

31-
const util = require('util');
3231
const EventEmitter = require('events');
3332
const {
3433
ERR_DOMAIN_CALLBACK_NOT_AVAILABLE,
@@ -207,7 +206,7 @@ Domain.prototype.members = undefined;
207206
Domain.prototype._errorHandler = function(er) {
208207
var caught = false;
209208

210-
if (!util.isPrimitive(er)) {
209+
if ((typeof er === 'object' && er !== null) || typeof er === 'function') {
211210
Object.defineProperty(er, 'domain', {
212211
configurable: true,
213212
enumerable: false,

0 commit comments

Comments
 (0)