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 <anna@addaleax.net> Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com>
1 parent 5ade490 commit 8a333a4

1 file changed

Lines changed: 1 addition & 2 deletions

File tree

‎lib/domain.js‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828

2929
const{ Object, Reflect }=primordials;
3030

31-
constutil=require('util');
3231
constEventEmitter=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
varcaught=false;
209208

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

0 commit comments

Comments
 (0)