Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 8a333a4

Browse filesBrowse 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
Copy full SHA for 8a333a4

File tree

Expand file treeCollapse file tree

1 file changed

+1
-2
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+1
-2
lines changed
Open diff view settings
Collapse file

‎lib/domain.js‎

Copy file name to clipboardExpand all lines: lib/domain.js
+1-2Lines 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-
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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.