|
@ -25,6 +25,7 @@ const uv = process.binding('uv'); |
|
|
const Buffer = require('buffer').Buffer; |
|
|
const Buffer = require('buffer').Buffer; |
|
|
const internalUtil = require('internal/util'); |
|
|
const internalUtil = require('internal/util'); |
|
|
const binding = process.binding('util'); |
|
|
const binding = process.binding('util'); |
|
|
|
|
|
const errors = require('internal/errors'); |
|
|
|
|
|
|
|
|
const isError = internalUtil.isError; |
|
|
const isError = internalUtil.isError; |
|
|
|
|
|
|
|
@ -194,7 +195,7 @@ Object.defineProperty(inspect, 'defaultOptions', { |
|
|
}, |
|
|
}, |
|
|
set: function(options) { |
|
|
set: function(options) { |
|
|
if (options === null || typeof options !== 'object') { |
|
|
if (options === null || typeof options !== 'object') { |
|
|
throw new TypeError('"options" must be an object'); |
|
|
throw new errors.TypeError('ERR_INVALID_ARG_TYPE', 'options', 'object'); |
|
|
} |
|
|
} |
|
|
Object.assign(inspectDefaultOptions, options); |
|
|
Object.assign(inspectDefaultOptions, options); |
|
|
return inspectDefaultOptions; |
|
|
return inspectDefaultOptions; |
|
@ -946,17 +947,14 @@ exports.log = function() { |
|
|
exports.inherits = function(ctor, superCtor) { |
|
|
exports.inherits = function(ctor, superCtor) { |
|
|
|
|
|
|
|
|
if (ctor === undefined || ctor === null) |
|
|
if (ctor === undefined || ctor === null) |
|
|
throw new TypeError('The constructor to "inherits" must not be ' + |
|
|
throw new errors.TypeError('ERR_INVALID_ARG_TYPE', 'ctor', 'function'); |
|
|
'null or undefined'); |
|
|
|
|
|
|
|
|
|
|
|
if (superCtor === undefined || superCtor === null) |
|
|
if (superCtor === undefined || superCtor === null) |
|
|
throw new TypeError('The super constructor to "inherits" must not ' + |
|
|
throw new errors.TypeError('ERR_INVALID_ARG_TYPE', 'superCtor', 'function'); |
|
|
'be null or undefined'); |
|
|
|
|
|
|
|
|
|
|
|
if (superCtor.prototype === undefined) |
|
|
if (superCtor.prototype === undefined) |
|
|
throw new TypeError('The super constructor to "inherits" must ' + |
|
|
throw new errors.TypeError('ERR_INVALID_ARG_TYPE', 'superCtor.prototype', |
|
|
'have a prototype'); |
|
|
'function'); |
|
|
|
|
|
|
|
|
ctor.super_ = superCtor; |
|
|
ctor.super_ = superCtor; |
|
|
Object.setPrototypeOf(ctor.prototype, superCtor.prototype); |
|
|
Object.setPrototypeOf(ctor.prototype, superCtor.prototype); |
|
|
}; |
|
|
}; |
|
|