2017-01-03 21:16:48 +00:00
|
|
|
// Copyright Joyent, Inc. and other Node contributors.
|
|
|
|
//
|
|
|
|
// Permission is hereby granted, free of charge, to any person obtaining a
|
|
|
|
// copy of this software and associated documentation files (the
|
|
|
|
// "Software"), to deal in the Software without restriction, including
|
|
|
|
// without limitation the rights to use, copy, modify, merge, publish,
|
|
|
|
// distribute, sublicense, and/or sell copies of the Software, and to permit
|
|
|
|
// persons to whom the Software is furnished to do so, subject to the
|
|
|
|
// following conditions:
|
|
|
|
//
|
|
|
|
// The above copyright notice and this permission notice shall be included
|
|
|
|
// in all copies or substantial portions of the Software.
|
|
|
|
//
|
|
|
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
|
|
|
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
|
|
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
|
|
|
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
|
|
|
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
|
|
|
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
|
|
|
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
|
|
|
2014-11-22 15:59:48 +00:00
|
|
|
'use strict';
|
|
|
|
|
2019-11-22 17:04:46 +00:00
|
|
|
const {
|
2019-11-23 09:09:05 +00:00
|
|
|
ArrayIsArray,
|
2020-11-16 15:39:28 +00:00
|
|
|
ArrayPrototypeJoin,
|
|
|
|
ArrayPrototypePop,
|
2020-09-29 18:29:40 +00:00
|
|
|
Date,
|
2020-11-16 15:39:28 +00:00
|
|
|
DatePrototypeGetDate,
|
|
|
|
DatePrototypeGetHours,
|
|
|
|
DatePrototypeGetMinutes,
|
|
|
|
DatePrototypeGetMonth,
|
|
|
|
DatePrototypeGetSeconds,
|
2020-01-02 18:19:02 +00:00
|
|
|
Error,
|
2020-11-16 15:39:28 +00:00
|
|
|
FunctionPrototypeBind,
|
2019-11-27 18:59:29 +00:00
|
|
|
NumberIsSafeInteger,
|
2019-11-22 17:04:46 +00:00
|
|
|
ObjectDefineProperties,
|
|
|
|
ObjectDefineProperty,
|
|
|
|
ObjectGetOwnPropertyDescriptors,
|
|
|
|
ObjectKeys,
|
|
|
|
ObjectPrototypeToString,
|
|
|
|
ObjectSetPrototypeOf,
|
2022-08-17 18:36:33 +00:00
|
|
|
ObjectValues,
|
2019-11-22 17:04:46 +00:00
|
|
|
ReflectApply,
|
2020-11-16 15:39:28 +00:00
|
|
|
StringPrototypePadStart,
|
2019-11-22 17:04:46 +00:00
|
|
|
} = primordials;
|
2019-03-31 11:30:12 +00:00
|
|
|
|
2019-03-18 01:29:39 +00:00
|
|
|
const {
|
|
|
|
codes: {
|
|
|
|
ERR_FALSY_VALUE_REJECTION,
|
|
|
|
ERR_INVALID_ARG_TYPE,
|
|
|
|
ERR_OUT_OF_RANGE
|
|
|
|
},
|
|
|
|
errnoException,
|
|
|
|
exceptionWithHostPort,
|
|
|
|
hideStackFrames
|
|
|
|
} = require('internal/errors');
|
2019-03-06 11:33:09 +00:00
|
|
|
const {
|
|
|
|
format,
|
|
|
|
formatWithOptions,
|
2021-09-19 21:44:33 +00:00
|
|
|
inspect,
|
|
|
|
stripVTControlCharacters,
|
2019-03-06 11:33:09 +00:00
|
|
|
} = require('internal/util/inspect');
|
2019-03-06 11:54:12 +00:00
|
|
|
const { debuglog } = require('internal/util/debuglog');
|
2021-05-16 11:22:48 +00:00
|
|
|
const {
|
|
|
|
validateFunction,
|
|
|
|
validateNumber,
|
|
|
|
} = require('internal/validators');
|
2017-08-17 05:10:43 +00:00
|
|
|
const { isBuffer } = require('buffer').Buffer;
|
2018-12-20 16:35:40 +00:00
|
|
|
const types = require('internal/util/types');
|
2017-09-28 07:16:41 +00:00
|
|
|
|
2017-06-19 20:17:29 +00:00
|
|
|
const {
|
|
|
|
deprecate,
|
2021-04-05 21:18:34 +00:00
|
|
|
getSystemErrorMap,
|
2018-02-03 09:30:48 +00:00
|
|
|
getSystemErrorName: internalErrorName,
|
2021-08-19 19:40:18 +00:00
|
|
|
promisify,
|
|
|
|
toUSVString,
|
2022-12-09 22:37:35 +00:00
|
|
|
defineLazyProperties,
|
2017-06-19 20:17:29 +00:00
|
|
|
} = require('internal/util');
|
2016-08-09 18:48:56 +00:00
|
|
|
|
2022-07-29 18:31:24 +00:00
|
|
|
let abortController;
|
|
|
|
|
|
|
|
function lazyAbortController() {
|
|
|
|
abortController ??= require('internal/abort_controller');
|
|
|
|
return abortController;
|
|
|
|
}
|
|
|
|
|
2018-05-07 01:53:02 +00:00
|
|
|
let internalDeepEqual;
|
2015-04-07 08:37:13 +00:00
|
|
|
|
2021-04-12 14:55:11 +00:00
|
|
|
/**
|
|
|
|
* @deprecated since v4.0.0
|
|
|
|
* @param {any} arg
|
|
|
|
* @returns {arg is boolean}
|
|
|
|
*/
|
2013-07-26 21:38:08 +00:00
|
|
|
function isBoolean(arg) {
|
2013-12-20 21:44:56 +00:00
|
|
|
return typeof arg === 'boolean';
|
2013-07-26 21:38:08 +00:00
|
|
|
}
|
|
|
|
|
2021-04-12 14:55:11 +00:00
|
|
|
/**
|
|
|
|
* @deprecated since v4.0.0
|
|
|
|
* @param {any} arg
|
|
|
|
* @returns {arg is null}
|
|
|
|
*/
|
2013-07-26 21:38:08 +00:00
|
|
|
function isNull(arg) {
|
|
|
|
return arg === null;
|
|
|
|
}
|
|
|
|
|
2021-04-12 14:55:11 +00:00
|
|
|
/**
|
|
|
|
* @deprecated since v4.0.0
|
|
|
|
* @param {any} arg
|
|
|
|
* @returns {arg is (null | undefined)}
|
|
|
|
*/
|
2013-07-26 21:38:08 +00:00
|
|
|
function isNullOrUndefined(arg) {
|
2015-01-29 01:05:53 +00:00
|
|
|
return arg === null || arg === undefined;
|
2013-07-26 21:38:08 +00:00
|
|
|
}
|
|
|
|
|
2021-04-12 14:55:11 +00:00
|
|
|
/**
|
|
|
|
* @deprecated since v4.0.0
|
|
|
|
* @param {any} arg
|
|
|
|
* @returns {arg is number}
|
|
|
|
*/
|
2013-07-26 21:38:08 +00:00
|
|
|
function isNumber(arg) {
|
2013-12-20 21:44:56 +00:00
|
|
|
return typeof arg === 'number';
|
2013-07-26 21:38:08 +00:00
|
|
|
}
|
|
|
|
|
2021-04-12 14:55:11 +00:00
|
|
|
/**
|
|
|
|
* @param {any} arg
|
|
|
|
* @returns {arg is string}
|
|
|
|
*/
|
2013-07-26 21:38:08 +00:00
|
|
|
function isString(arg) {
|
2013-12-20 21:44:56 +00:00
|
|
|
return typeof arg === 'string';
|
2013-07-26 21:38:08 +00:00
|
|
|
}
|
|
|
|
|
2021-04-12 14:55:11 +00:00
|
|
|
/**
|
|
|
|
* @deprecated since v4.0.0
|
|
|
|
* @param {any} arg
|
|
|
|
* @returns {arg is symbol}
|
|
|
|
*/
|
2013-07-26 21:38:08 +00:00
|
|
|
function isSymbol(arg) {
|
|
|
|
return typeof arg === 'symbol';
|
|
|
|
}
|
|
|
|
|
2021-04-12 14:55:11 +00:00
|
|
|
/**
|
|
|
|
* @deprecated since v4.0.0
|
|
|
|
* @param {any} arg
|
|
|
|
* @returns {arg is undefined}
|
|
|
|
*/
|
2013-07-26 21:38:08 +00:00
|
|
|
function isUndefined(arg) {
|
2015-01-29 01:05:53 +00:00
|
|
|
return arg === undefined;
|
2013-07-26 21:38:08 +00:00
|
|
|
}
|
2010-10-11 21:04:09 +00:00
|
|
|
|
2021-04-12 14:55:11 +00:00
|
|
|
/**
|
|
|
|
* @deprecated since v4.0.0
|
|
|
|
* @param {any} arg
|
|
|
|
* @returns {a is NonNullable<object>}
|
|
|
|
*/
|
2013-07-26 21:38:08 +00:00
|
|
|
function isObject(arg) {
|
2015-01-29 01:05:53 +00:00
|
|
|
return arg !== null && typeof arg === 'object';
|
2013-07-26 21:38:08 +00:00
|
|
|
}
|
2010-10-11 21:04:09 +00:00
|
|
|
|
2021-04-12 14:55:11 +00:00
|
|
|
/**
|
|
|
|
* @deprecated since v4.0.0
|
|
|
|
* @param {any} e
|
|
|
|
* @returns {arg is Error}
|
|
|
|
*/
|
2019-04-05 09:11:26 +00:00
|
|
|
function isError(e) {
|
2019-11-22 17:04:46 +00:00
|
|
|
return ObjectPrototypeToString(e) === '[object Error]' || e instanceof Error;
|
2019-04-05 09:11:26 +00:00
|
|
|
}
|
|
|
|
|
2021-04-12 14:55:11 +00:00
|
|
|
/**
|
|
|
|
* @deprecated since v4.0.0
|
|
|
|
* @param {any} arg
|
|
|
|
* @returns {arg is Function}
|
|
|
|
*/
|
2013-07-26 21:38:08 +00:00
|
|
|
function isFunction(arg) {
|
|
|
|
return typeof arg === 'function';
|
|
|
|
}
|
|
|
|
|
2021-04-12 14:55:11 +00:00
|
|
|
/**
|
|
|
|
* @deprecated since v4.0.0
|
|
|
|
* @param {any} arg
|
|
|
|
* @returns {arg is (boolean | null | number | string | symbol | undefined)}
|
|
|
|
*/
|
2013-08-02 19:52:34 +00:00
|
|
|
function isPrimitive(arg) {
|
2013-08-12 20:41:51 +00:00
|
|
|
return arg === null ||
|
2019-10-03 16:35:41 +00:00
|
|
|
(typeof arg !== 'object' && typeof arg !== 'function');
|
2013-08-02 19:52:34 +00:00
|
|
|
}
|
2011-09-08 16:16:48 +00:00
|
|
|
|
2021-04-12 14:55:11 +00:00
|
|
|
/**
|
|
|
|
* @param {number} n
|
|
|
|
* @returns {string}
|
|
|
|
*/
|
2010-12-02 04:59:06 +00:00
|
|
|
function pad(n) {
|
2020-11-16 15:39:28 +00:00
|
|
|
return StringPrototypePadStart(n.toString(), 2, '0');
|
2010-10-11 21:04:09 +00:00
|
|
|
}
|
|
|
|
|
2015-01-21 16:36:59 +00:00
|
|
|
const months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep',
|
|
|
|
'Oct', 'Nov', 'Dec'];
|
2010-10-11 21:04:09 +00:00
|
|
|
|
2021-04-12 14:55:11 +00:00
|
|
|
/**
|
|
|
|
* @returns {string} 26 Feb 16:19:34
|
|
|
|
*/
|
2010-12-02 04:59:06 +00:00
|
|
|
function timestamp() {
|
2018-02-16 12:28:38 +00:00
|
|
|
const d = new Date();
|
2020-11-16 15:39:28 +00:00
|
|
|
const t = ArrayPrototypeJoin([
|
|
|
|
pad(DatePrototypeGetHours(d)),
|
|
|
|
pad(DatePrototypeGetMinutes(d)),
|
|
|
|
pad(DatePrototypeGetSeconds(d)),
|
|
|
|
], ':');
|
|
|
|
return `${DatePrototypeGetDate(d)} ${months[DatePrototypeGetMonth(d)]} ${t}`;
|
2010-10-11 21:04:09 +00:00
|
|
|
}
|
|
|
|
|
2019-04-05 21:56:00 +00:00
|
|
|
let console;
|
2021-04-12 14:55:11 +00:00
|
|
|
/**
|
|
|
|
* Log is just a thin wrapper to console.log that prepends a timestamp
|
|
|
|
* @deprecated since v6.0.0
|
|
|
|
* @type {(...args: any[]) => void}
|
|
|
|
*/
|
2019-04-04 03:36:41 +00:00
|
|
|
function log(...args) {
|
2019-04-05 21:56:00 +00:00
|
|
|
if (!console) {
|
|
|
|
console = require('internal/console/global');
|
|
|
|
}
|
2019-04-04 03:36:41 +00:00
|
|
|
console.log('%s - %s', timestamp(), format(...args));
|
2017-06-19 20:17:29 +00:00
|
|
|
}
|
2010-10-11 21:04:09 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Inherit the prototype methods from one constructor into another.
|
|
|
|
*
|
|
|
|
* The Function.prototype.inherits from lang.js rewritten as a standalone
|
|
|
|
* function (not on Function.prototype). NOTE: If this file is to be loaded
|
2012-02-18 05:28:13 +00:00
|
|
|
* during bootstrapping this function needs to be rewritten using some native
|
2010-10-11 21:04:09 +00:00
|
|
|
* functions as prototype setup using normal JavaScript does not work as
|
|
|
|
* expected during bootstrapping (see mirror.js in r114903).
|
|
|
|
*
|
2021-04-12 14:55:11 +00:00
|
|
|
* @param {Function} ctor Constructor function which needs to inherit the
|
2010-12-02 04:59:06 +00:00
|
|
|
* prototype.
|
2021-04-12 14:55:11 +00:00
|
|
|
* @param {Function} superCtor Constructor function to inherit prototype from.
|
2015-03-23 00:45:16 +00:00
|
|
|
* @throws {TypeError} Will error if either constructor is null, or if
|
|
|
|
* the super constructor lacks a prototype.
|
2010-10-11 21:04:09 +00:00
|
|
|
*/
|
2017-06-19 20:17:29 +00:00
|
|
|
function inherits(ctor, superCtor) {
|
2015-03-23 00:45:16 +00:00
|
|
|
|
|
|
|
if (ctor === undefined || ctor === null)
|
2018-03-19 12:33:46 +00:00
|
|
|
throw new ERR_INVALID_ARG_TYPE('ctor', 'Function', ctor);
|
2015-03-23 00:45:16 +00:00
|
|
|
|
|
|
|
if (superCtor === undefined || superCtor === null)
|
2018-03-19 12:33:46 +00:00
|
|
|
throw new ERR_INVALID_ARG_TYPE('superCtor', 'Function', superCtor);
|
2015-03-23 00:45:16 +00:00
|
|
|
|
2017-06-20 21:37:00 +00:00
|
|
|
if (superCtor.prototype === undefined) {
|
2018-03-19 12:33:46 +00:00
|
|
|
throw new ERR_INVALID_ARG_TYPE('superCtor.prototype',
|
2018-12-18 01:18:55 +00:00
|
|
|
'Object', superCtor.prototype);
|
2017-06-20 21:37:00 +00:00
|
|
|
}
|
2019-11-22 17:04:46 +00:00
|
|
|
ObjectDefineProperty(ctor, 'super_', {
|
2022-06-03 08:23:58 +00:00
|
|
|
__proto__: null,
|
2018-09-26 21:17:26 +00:00
|
|
|
value: superCtor,
|
|
|
|
writable: true,
|
|
|
|
configurable: true
|
|
|
|
});
|
2019-11-22 17:04:46 +00:00
|
|
|
ObjectSetPrototypeOf(ctor.prototype, superCtor.prototype);
|
2017-06-19 20:17:29 +00:00
|
|
|
}
|
2012-02-20 17:59:56 +00:00
|
|
|
|
2021-04-12 14:55:11 +00:00
|
|
|
/**
|
|
|
|
* @deprecated since v6.0.0
|
|
|
|
* @template T
|
|
|
|
* @template S
|
|
|
|
* @param {T} target
|
|
|
|
* @param {S} source
|
|
|
|
* @returns {S extends null ? T : (T & S)}
|
|
|
|
*/
|
2017-06-19 20:17:29 +00:00
|
|
|
function _extend(target, source) {
|
2016-08-20 02:53:28 +00:00
|
|
|
// Don't do anything if source isn't an object
|
|
|
|
if (source === null || typeof source !== 'object') return target;
|
2012-02-20 17:59:56 +00:00
|
|
|
|
2019-11-22 17:04:46 +00:00
|
|
|
const keys = ObjectKeys(source);
|
2018-02-16 12:28:38 +00:00
|
|
|
let i = keys.length;
|
2012-02-20 17:59:56 +00:00
|
|
|
while (i--) {
|
2016-08-20 02:53:28 +00:00
|
|
|
target[keys[i]] = source[keys[i]];
|
2012-02-20 17:59:56 +00:00
|
|
|
}
|
2016-08-20 02:53:28 +00:00
|
|
|
return target;
|
2017-06-19 20:17:29 +00:00
|
|
|
}
|
2012-09-08 22:09:59 +00:00
|
|
|
|
2019-03-18 01:29:39 +00:00
|
|
|
const callbackifyOnRejected = hideStackFrames((reason, cb) => {
|
2017-04-28 01:57:12 +00:00
|
|
|
// `!reason` guard inspired by bluebird (Ref: https://goo.gl/t5IS6M).
|
|
|
|
// Because `null` is a special error value in callbacks which means "no error
|
|
|
|
// occurred", we error-wrap so the callback consumer can distinguish between
|
|
|
|
// "the promise rejected with null" or "the promise fulfilled with undefined".
|
|
|
|
if (!reason) {
|
2019-03-18 01:29:39 +00:00
|
|
|
reason = new ERR_FALSY_VALUE_REJECTION(reason);
|
2017-04-28 01:57:12 +00:00
|
|
|
}
|
|
|
|
return cb(reason);
|
2019-03-18 01:29:39 +00:00
|
|
|
});
|
2017-04-28 01:57:12 +00:00
|
|
|
|
2021-04-12 14:55:11 +00:00
|
|
|
/**
|
|
|
|
* @template {(...args: any[]) => Promise<any>} T
|
|
|
|
* @param {T} original
|
|
|
|
* @returns {T extends (...args: infer TArgs) => Promise<infer TReturn> ?
|
|
|
|
* ((...params: [...TArgs, ((err: Error, ret: TReturn) => any)]) => void) :
|
|
|
|
* never
|
|
|
|
* }
|
|
|
|
*/
|
2017-04-28 01:57:12 +00:00
|
|
|
function callbackify(original) {
|
2021-05-16 11:22:48 +00:00
|
|
|
validateFunction(original, 'original');
|
2017-04-28 01:57:12 +00:00
|
|
|
|
|
|
|
// We DO NOT return the promise as it gives the user a false sense that
|
|
|
|
// the promise is actually somehow related to the callback's execution
|
|
|
|
// and that the callback throwing will reject the promise.
|
|
|
|
function callbackified(...args) {
|
2020-11-16 15:39:28 +00:00
|
|
|
const maybeCb = ArrayPrototypePop(args);
|
2021-05-16 11:22:48 +00:00
|
|
|
validateFunction(maybeCb, 'last argument');
|
2020-11-16 15:39:28 +00:00
|
|
|
const cb = FunctionPrototypeBind(maybeCb, this);
|
2017-04-28 01:57:12 +00:00
|
|
|
// In true node style we process the callback on `nextTick` with all the
|
|
|
|
// implications (stack, `uncaughtException`, `async_hooks`)
|
2019-11-22 17:04:46 +00:00
|
|
|
ReflectApply(original, this, args)
|
2017-04-28 01:57:12 +00:00
|
|
|
.then((ret) => process.nextTick(cb, null, ret),
|
|
|
|
(rej) => process.nextTick(callbackifyOnRejected, rej, cb));
|
|
|
|
}
|
|
|
|
|
2019-11-22 17:04:46 +00:00
|
|
|
const descriptors = ObjectGetOwnPropertyDescriptors(original);
|
2019-03-24 21:11:47 +00:00
|
|
|
// It is possible to manipulate a functions `length` or `name` property. This
|
|
|
|
// guards against the manipulation.
|
2019-03-24 20:59:20 +00:00
|
|
|
if (typeof descriptors.length.value === 'number') {
|
|
|
|
descriptors.length.value++;
|
|
|
|
}
|
2019-03-24 21:11:47 +00:00
|
|
|
if (typeof descriptors.name.value === 'string') {
|
|
|
|
descriptors.name.value += 'Callbackified';
|
|
|
|
}
|
2022-08-17 18:36:33 +00:00
|
|
|
const propertiesValues = ObjectValues(descriptors);
|
|
|
|
for (let i = 0; i < propertiesValues.length; i++) {
|
|
|
|
// We want to use null-prototype objects to not rely on globally mutable
|
|
|
|
// %Object.prototype%.
|
|
|
|
ObjectSetPrototypeOf(propertiesValues[i], null);
|
|
|
|
}
|
2019-11-22 17:04:46 +00:00
|
|
|
ObjectDefineProperties(callbackified, descriptors);
|
2017-04-28 01:57:12 +00:00
|
|
|
return callbackified;
|
|
|
|
}
|
|
|
|
|
2021-04-12 14:55:11 +00:00
|
|
|
/**
|
|
|
|
* @param {number} err
|
|
|
|
* @returns {string}
|
|
|
|
*/
|
2018-02-03 09:30:48 +00:00
|
|
|
function getSystemErrorName(err) {
|
2018-08-03 15:23:26 +00:00
|
|
|
validateNumber(err, 'err');
|
2019-11-27 18:59:29 +00:00
|
|
|
if (err >= 0 || !NumberIsSafeInteger(err)) {
|
2018-02-27 13:55:32 +00:00
|
|
|
throw new ERR_OUT_OF_RANGE('err', 'a negative integer', err);
|
2018-02-03 09:30:48 +00:00
|
|
|
}
|
|
|
|
return internalErrorName(err);
|
|
|
|
}
|
|
|
|
|
2017-06-19 20:17:29 +00:00
|
|
|
// Keep the `exports =` so that various functions can still be monkeypatched
|
2019-04-04 03:36:41 +00:00
|
|
|
module.exports = {
|
2019-03-18 01:29:39 +00:00
|
|
|
_errnoException: errnoException,
|
|
|
|
_exceptionWithHostPort: exceptionWithHostPort,
|
2017-06-19 20:17:29 +00:00
|
|
|
_extend,
|
|
|
|
callbackify,
|
2020-06-12 15:25:38 +00:00
|
|
|
debug: debuglog,
|
2017-06-19 20:17:29 +00:00
|
|
|
debuglog,
|
|
|
|
deprecate,
|
|
|
|
format,
|
2018-03-15 12:45:43 +00:00
|
|
|
formatWithOptions,
|
2021-04-05 21:18:34 +00:00
|
|
|
getSystemErrorMap,
|
2018-01-16 19:21:16 +00:00
|
|
|
getSystemErrorName,
|
2017-06-19 20:17:29 +00:00
|
|
|
inherits,
|
|
|
|
inspect,
|
2019-11-23 09:09:05 +00:00
|
|
|
isArray: ArrayIsArray,
|
2017-06-19 20:17:29 +00:00
|
|
|
isBoolean,
|
2017-08-17 05:10:43 +00:00
|
|
|
isBuffer,
|
2018-05-07 01:53:02 +00:00
|
|
|
isDeepStrictEqual(a, b) {
|
|
|
|
if (internalDeepEqual === undefined) {
|
|
|
|
internalDeepEqual = require('internal/util/comparisons')
|
|
|
|
.isDeepStrictEqual;
|
|
|
|
}
|
|
|
|
return internalDeepEqual(a, b);
|
|
|
|
},
|
2017-06-19 20:17:29 +00:00
|
|
|
isNull,
|
|
|
|
isNullOrUndefined,
|
|
|
|
isNumber,
|
|
|
|
isString,
|
|
|
|
isSymbol,
|
|
|
|
isUndefined,
|
2018-12-20 16:35:40 +00:00
|
|
|
isRegExp: types.isRegExp,
|
2017-06-19 20:17:29 +00:00
|
|
|
isObject,
|
2018-12-20 16:35:40 +00:00
|
|
|
isDate: types.isDate,
|
2019-04-05 09:11:26 +00:00
|
|
|
isError,
|
2017-06-19 20:17:29 +00:00
|
|
|
isFunction,
|
|
|
|
isPrimitive,
|
|
|
|
log,
|
|
|
|
promisify,
|
2021-09-19 21:44:33 +00:00
|
|
|
stripVTControlCharacters,
|
2021-08-19 19:40:18 +00:00
|
|
|
toUSVString,
|
2022-07-29 18:31:24 +00:00
|
|
|
get transferableAbortSignal() {
|
|
|
|
return lazyAbortController().transferableAbortSignal;
|
|
|
|
},
|
|
|
|
get transferableAbortController() {
|
|
|
|
return lazyAbortController().transferableAbortController;
|
|
|
|
},
|
2023-02-07 17:43:57 +00:00
|
|
|
get aborted() {
|
|
|
|
return lazyAbortController().aborted;
|
|
|
|
},
|
2019-01-07 19:11:47 +00:00
|
|
|
types
|
2017-06-19 20:17:29 +00:00
|
|
|
};
|
2022-12-09 22:37:35 +00:00
|
|
|
|
|
|
|
defineLazyProperties(
|
|
|
|
module.exports,
|
|
|
|
'internal/util/parse_args/parse_args',
|
2023-02-14 17:45:16 +00:00
|
|
|
['parseArgs'],
|
2022-12-09 22:37:35 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
defineLazyProperties(
|
|
|
|
module.exports,
|
|
|
|
'internal/encoding',
|
2023-02-14 17:45:16 +00:00
|
|
|
['TextDecoder', 'TextEncoder'],
|
2022-12-09 22:37:35 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
defineLazyProperties(
|
|
|
|
module.exports,
|
|
|
|
'internal/mime',
|
2023-02-14 17:45:16 +00:00
|
|
|
['MIMEType', 'MIMEParams'],
|
2022-12-09 22:37:35 +00:00
|
|
|
);
|