Socket
Socket
Sign inDemoInstall

assert

Package Overview
Dependencies
Maintainers
6
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

assert - npm Package Compare versions

Comparing version 2.0.0 to 2.1.0

239

build/assert.js
// Currently in sync with Node.js lib/assert.js
// https://github.com/nodejs/node/commit/2a51ae424a513ec9a6aa3466baa0cc1d55dd4f3b
// Originally from narwhal.js (http://narwhaljs.org)

@@ -22,27 +23,27 @@ // Copyright (c) 2009 Thomas Robinson <280north.com>

// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
'use strict';
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var _require = require('./internal/errors'),
_require$codes = _require.codes,
ERR_AMBIGUOUS_ARGUMENT = _require$codes.ERR_AMBIGUOUS_ARGUMENT,
ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE,
ERR_INVALID_ARG_VALUE = _require$codes.ERR_INVALID_ARG_VALUE,
ERR_INVALID_RETURN_VALUE = _require$codes.ERR_INVALID_RETURN_VALUE,
ERR_MISSING_ARGS = _require$codes.ERR_MISSING_ARGS;
_require$codes = _require.codes,
ERR_AMBIGUOUS_ARGUMENT = _require$codes.ERR_AMBIGUOUS_ARGUMENT,
ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE,
ERR_INVALID_ARG_VALUE = _require$codes.ERR_INVALID_ARG_VALUE,
ERR_INVALID_RETURN_VALUE = _require$codes.ERR_INVALID_RETURN_VALUE,
ERR_MISSING_ARGS = _require$codes.ERR_MISSING_ARGS;
var AssertionError = require('./internal/assert/assertion_error');
var _require2 = require('util/'),
inspect = _require2.inspect;
inspect = _require2.inspect;
var _require$types = require('util/').types,
isPromise = _require$types.isPromise,
isRegExp = _require$types.isRegExp;
var objectAssign = Object.assign ? Object.assign : require('es6-object-assign').assign;
var objectIs = Object.is ? Object.is : require('object-is');
isPromise = _require$types.isPromise,
isRegExp = _require$types.isRegExp;
var objectAssign = require('object.assign/polyfill')();
var objectIs = require('object-is/polyfill')();
var RegExpPrototypeTest = require('call-bind/callBound')('RegExp.prototype.test');
var errorCache = new Map();

@@ -54,21 +55,19 @@ var isDeepEqual;

var decoder;
function lazyLoadComparison() {
var comparison = require('./internal/util/comparisons');
isDeepEqual = comparison.isDeepEqual;
isDeepStrictEqual = comparison.isDeepStrictEqual;
} // Escape control characters but not \n and \t to keep the line breaks and
}
// Escape control characters but not \n and \t to keep the line breaks and
// indentation intact.
// eslint-disable-next-line no-control-regex
var escapeSequencesRegExp = /[\x00-\x08\x0b\x0c\x0e-\x1f]/g;
var meta = ["\\u0000", "\\u0001", "\\u0002", "\\u0003", "\\u0004", "\\u0005", "\\u0006", "\\u0007", '\\b', '', '', "\\u000b", '\\f', '', "\\u000e", "\\u000f", "\\u0010", "\\u0011", "\\u0012", "\\u0013", "\\u0014", "\\u0015", "\\u0016", "\\u0017", "\\u0018", "\\u0019", "\\u001a", "\\u001b", "\\u001c", "\\u001d", "\\u001e", "\\u001f"];
var escapeFn = function escapeFn(str) {
return meta[str.charCodeAt(0)];
};
var warned = false;
var warned = false; // The assert module provides functions that throw
// The assert module provides functions that throw
// AssertionError's when particular conditions are not met. The

@@ -78,3 +77,5 @@ // assert module must conform to the following interface.

var assert = module.exports = ok;
var NO_EXCEPTION_SENTINEL = {}; // All of the following functions must throw an AssertionError
var NO_EXCEPTION_SENTINEL = {};
// All of the following functions must throw an AssertionError
// when a corresponding condition is not met, with a message that

@@ -89,7 +90,5 @@ // may be undefined if not provided. All assertion methods provide

}
function fail(actual, expected, message, operator, stackStartFn) {
var argsLen = arguments.length;
var internalMessage;
if (argsLen === 0) {

@@ -106,6 +105,4 @@ internalMessage = 'Failed';

}
if (argsLen === 2) operator = '!=';
}
if (message instanceof Error) throw message;

@@ -118,9 +115,6 @@ var errArgs = {

};
if (message !== undefined) {
errArgs.message = message;
}
var err = new AssertionError(errArgs);
if (internalMessage) {

@@ -130,14 +124,11 @@ err.message = internalMessage;

}
throw err;
}
assert.fail = fail;
assert.fail = fail; // The AssertionError is defined in internal/error.
// The AssertionError is defined in internal/error.
assert.AssertionError = AssertionError;
function innerOk(fn, argLen, value, message) {
if (!value) {
var generatedMessage = false;
if (argLen === 0) {

@@ -149,3 +140,2 @@ generatedMessage = true;

}
var err = new AssertionError({

@@ -161,6 +151,6 @@ actual: value,

}
} // Pure assertion tests whether a value is truthy, as determined
}
// Pure assertion tests whether a value is truthy, as determined
// by !!value.
function ok() {

@@ -170,16 +160,13 @@ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {

}
innerOk.apply(void 0, [ok, args.length].concat(args));
}
assert.ok = ok;
assert.ok = ok; // The equality assertion tests shallow, coercive equality with ==.
// The equality assertion tests shallow, coercive equality with ==.
/* eslint-disable no-restricted-properties */
assert.equal = function equal(actual, expected, message) {
if (arguments.length < 2) {
throw new ERR_MISSING_ARGS('actual', 'expected');
} // eslint-disable-next-line eqeqeq
}
// eslint-disable-next-line eqeqeq
if (actual != expected) {

@@ -194,12 +181,11 @@ innerFail({

}
}; // The non-equality assertion tests for whether two objects are not
};
// The non-equality assertion tests for whether two objects are not
// equal with !=.
assert.notEqual = function notEqual(actual, expected, message) {
if (arguments.length < 2) {
throw new ERR_MISSING_ARGS('actual', 'expected');
} // eslint-disable-next-line eqeqeq
}
// eslint-disable-next-line eqeqeq
if (actual == expected) {

@@ -214,5 +200,5 @@ innerFail({

}
}; // The equivalence assertion tests a deep equality relation.
};
// The equivalence assertion tests a deep equality relation.
assert.deepEqual = function deepEqual(actual, expected, message) {

@@ -222,5 +208,3 @@ if (arguments.length < 2) {

}
if (isDeepEqual === undefined) lazyLoadComparison();
if (!isDeepEqual(actual, expected)) {

@@ -235,5 +219,5 @@ innerFail({

}
}; // The non-equivalence assertion tests for any deep inequality.
};
// The non-equivalence assertion tests for any deep inequality.
assert.notDeepEqual = function notDeepEqual(actual, expected, message) {

@@ -243,5 +227,3 @@ if (arguments.length < 2) {

}
if (isDeepEqual === undefined) lazyLoadComparison();
if (isDeepEqual(actual, expected)) {

@@ -259,3 +241,2 @@ innerFail({

assert.deepStrictEqual = function deepStrictEqual(actual, expected, message) {

@@ -265,5 +246,3 @@ if (arguments.length < 2) {

}
if (isDeepEqual === undefined) lazyLoadComparison();
if (!isDeepStrictEqual(actual, expected)) {

@@ -279,5 +258,3 @@ innerFail({

};
assert.notDeepStrictEqual = notDeepStrictEqual;
function notDeepStrictEqual(actual, expected, message) {

@@ -287,5 +264,3 @@ if (arguments.length < 2) {

}
if (isDeepEqual === undefined) lazyLoadComparison();
if (isDeepStrictEqual(actual, expected)) {

@@ -301,3 +276,2 @@ innerFail({

}
assert.strictEqual = function strictEqual(actual, expected, message) {

@@ -307,3 +281,2 @@ if (arguments.length < 2) {

}
if (!objectIs(actual, expected)) {

@@ -319,3 +292,2 @@ innerFail({

};
assert.notStrictEqual = function notStrictEqual(actual, expected, message) {

@@ -325,3 +297,2 @@ if (arguments.length < 2) {

}
if (objectIs(actual, expected)) {

@@ -337,11 +308,8 @@ innerFail({

};
var Comparison = function Comparison(obj, keys, actual) {
var Comparison = /*#__PURE__*/_createClass(function Comparison(obj, keys, actual) {
var _this = this;
_classCallCheck(this, Comparison);
keys.forEach(function (key) {
if (key in obj) {
if (actual !== undefined && typeof actual[key] === 'string' && isRegExp(obj[key]) && obj[key].test(actual[key])) {
if (actual !== undefined && typeof actual[key] === 'string' && isRegExp(obj[key]) && RegExpPrototypeTest(obj[key], actual[key])) {
_this[key] = actual[key];

@@ -353,4 +321,3 @@ } else {

});
};
});
function compareExceptionKey(actual, expected, key, message, keys, fn) {

@@ -373,3 +340,2 @@ if (!(key in actual) || !isDeepStrictEqual(actual[key], expected[key])) {

}
innerFail({

@@ -384,12 +350,11 @@ actual: actual,

}
function expectedException(actual, expected, msg, fn) {
if (typeof expected !== 'function') {
if (isRegExp(expected)) return expected.test(actual); // assert.doesNotThrow does not accept objects.
if (isRegExp(expected)) return RegExpPrototypeTest(expected, actual);
// assert.doesNotThrow does not accept objects.
if (arguments.length === 2) {
throw new ERR_INVALID_ARG_TYPE('expected', ['Function', 'RegExp'], expected);
} // Handle primitives properly.
}
// Handle primitives properly.
if (_typeof(actual) !== 'object' || actual === null) {

@@ -406,6 +371,5 @@ var err = new AssertionError({

}
var keys = Object.keys(expected); // Special handle errors to make sure the name and the message are compared
var keys = Object.keys(expected);
// Special handle errors to make sure the name and the message are compared
// as well.
if (expected instanceof Error) {

@@ -416,26 +380,20 @@ keys.push('name', 'message');

}
if (isDeepEqual === undefined) lazyLoadComparison();
keys.forEach(function (key) {
if (typeof actual[key] === 'string' && isRegExp(expected[key]) && expected[key].test(actual[key])) {
if (typeof actual[key] === 'string' && isRegExp(expected[key]) && RegExpPrototypeTest(expected[key], actual[key])) {
return;
}
compareExceptionKey(actual, expected, key, msg, keys, fn);
});
return true;
} // Guard instanceof against arrow functions as they don't have a prototype.
}
// Guard instanceof against arrow functions as they don't have a prototype.
if (expected.prototype !== undefined && actual instanceof expected) {
return true;
}
if (Error.isPrototypeOf(expected)) {
return false;
}
return expected.call({}, actual) === true;
}
function getActual(fn) {

@@ -445,3 +403,2 @@ if (typeof fn !== 'function') {

}
try {

@@ -452,6 +409,4 @@ fn();

}
return NO_EXCEPTION_SENTINEL;
}
function checkIsPromise(obj) {

@@ -461,16 +416,16 @@ // Accept native ES6 promises and promises that are implemented in a similar

// `catch` handler.
// TODO: thenables are checked up until they have the correct methods,
// but according to documentation, the `then` method should receive
// the `fulfill` and `reject` arguments as well or it may be never resolved.
return isPromise(obj) || obj !== null && _typeof(obj) === 'object' && typeof obj.then === 'function' && typeof obj.catch === 'function';
}
function waitForActual(promiseFn) {
return Promise.resolve().then(function () {
var resultPromise;
if (typeof promiseFn === 'function') {
// Return a rejected promise if `promiseFn` throws synchronously.
resultPromise = promiseFn(); // Fail in case no promise is returned.
resultPromise = promiseFn();
// Fail in case no promise is returned.
if (!checkIsPromise(resultPromise)) {

@@ -484,3 +439,2 @@ throw new ERR_INVALID_RETURN_VALUE('instance of Promise', 'promiseFn', resultPromise);

}
return Promise.resolve().then(function () {

@@ -495,3 +449,2 @@ return resultPromise;

}
function expectsError(stackStartFn, actual, error, message) {

@@ -502,3 +455,2 @@ if (typeof error === 'string') {

}
if (_typeof(actual) === 'object' && actual !== null) {

@@ -511,3 +463,2 @@ if (actual.message === error) {

}
message = error;

@@ -518,10 +469,7 @@ error = undefined;

}
if (actual === NO_EXCEPTION_SENTINEL) {
var details = '';
if (error && error.name) {
details += " (".concat(error.name, ")");
}
details += message ? ": ".concat(message) : '.';

@@ -537,3 +485,2 @@ var fnType = stackStartFn.name === 'rejects' ? 'rejection' : 'exception';

}
if (error && !expectedException(actual, error, message, stackStartFn)) {

@@ -543,6 +490,4 @@ throw actual;

}
function expectsNoError(stackStartFn, actual, error, message) {
if (actual === NO_EXCEPTION_SENTINEL) return;
if (typeof error === 'string') {

@@ -552,3 +497,2 @@ message = error;

}
if (!error || expectedException(actual, error)) {

@@ -565,6 +509,4 @@ var details = message ? ": ".concat(message) : '.';

}
throw actual;
}
assert.throws = function throws(promiseFn) {

@@ -574,6 +516,4 @@ for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {

}
expectsError.apply(void 0, [throws, getActual(promiseFn)].concat(args));
};
assert.rejects = function rejects(promiseFn) {

@@ -583,3 +523,2 @@ for (var _len3 = arguments.length, args = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {

}
return waitForActual(promiseFn).then(function (result) {

@@ -589,3 +528,2 @@ return expectsError.apply(void 0, [rejects, result].concat(args));

};
assert.doesNotThrow = function doesNotThrow(fn) {

@@ -595,6 +533,4 @@ for (var _len4 = arguments.length, args = new Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++) {

}
expectsNoError.apply(void 0, [doesNotThrow, getActual(fn)].concat(args));
};
assert.doesNotReject = function doesNotReject(fn) {

@@ -604,3 +540,2 @@ for (var _len5 = arguments.length, args = new Array(_len5 > 1 ? _len5 - 1 : 0), _key5 = 1; _key5 < _len5; _key5++) {

}
return waitForActual(fn).then(function (result) {

@@ -610,7 +545,5 @@ return expectsNoError.apply(void 0, [doesNotReject, result].concat(args));

};
assert.ifError = function ifError(err) {
if (err !== null && err !== undefined) {
var message = 'ifError got unwanted exception: ';
if (_typeof(err) === 'object' && typeof err.message === 'string') {

@@ -625,3 +558,2 @@ if (err.message.length === 0 && err.constructor) {

}
var newErr = new AssertionError({

@@ -633,6 +565,6 @@ actual: err,

stackStartFn: ifError
}); // Make sure we actually have a stack trace!
});
// Make sure we actually have a stack trace!
var origStack = err.stack;
if (typeof origStack === 'string') {

@@ -643,10 +575,8 @@ // This will remove any duplicated frames from the error frames taken

var tmp2 = origStack.split('\n');
tmp2.shift(); // Filter all frames existing in err.stack.
tmp2.shift();
// Filter all frames existing in err.stack.
var tmp1 = newErr.stack.split('\n');
for (var i = 0; i < tmp2.length; i++) {
// Find the first occurrence of the frame.
var pos = tmp1.indexOf(tmp2[i]);
if (pos !== -1) {

@@ -658,11 +588,42 @@ // Only keep new frames.

}
newErr.stack = "".concat(tmp1.join('\n'), "\n").concat(tmp2.join('\n'));
}
throw newErr;
}
}; // Expose a strict only variant of assert
};
// Currently in sync with Node.js lib/assert.js
// https://github.com/nodejs/node/commit/2a871df3dfb8ea663ef5e1f8f62701ec51384ecb
function internalMatch(string, regexp, message, fn, fnName) {
if (!isRegExp(regexp)) {
throw new ERR_INVALID_ARG_TYPE('regexp', 'RegExp', regexp);
}
var match = fnName === 'match';
if (typeof string !== 'string' || RegExpPrototypeTest(regexp, string) !== match) {
if (message instanceof Error) {
throw message;
}
var generatedMessage = !message;
// 'The input was expected to not match the regular expression ' +
message = message || (typeof string !== 'string' ? 'The "string" argument must be of type string. Received type ' + "".concat(_typeof(string), " (").concat(inspect(string), ")") : (match ? 'The input did not match the regular expression ' : 'The input was expected to not match the regular expression ') + "".concat(inspect(regexp), ". Input:\n\n").concat(inspect(string), "\n"));
var err = new AssertionError({
actual: string,
expected: regexp,
message: message,
operator: fnName,
stackStartFn: fn
});
err.generatedMessage = generatedMessage;
throw err;
}
}
assert.match = function match(string, regexp, message) {
internalMatch(string, regexp, message, match, 'match');
};
assert.doesNotMatch = function doesNotMatch(string, regexp, message) {
internalMatch(string, regexp, message, doesNotMatch, 'doesNotMatch');
};
// Expose a strict only variant of assert
function strict() {

@@ -672,6 +633,4 @@ for (var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {

}
innerOk.apply(void 0, [strict, args.length].concat(args));
}
assert.strict = objectAssign(strict, assert, {

@@ -678,0 +637,0 @@ equal: assert.strictEqual,

// Currently in sync with Node.js lib/internal/assert/assertion_error.js
// https://github.com/nodejs/node/commit/0817840f775032169ddd70c85ac059f18ffcc81c
'use strict';
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
function _wrapNativeSuper(Class) { var _cache = typeof Map === "function" ? new Map() : undefined; _wrapNativeSuper = function _wrapNativeSuper(Class) { if (Class === null || !_isNativeFunction(Class)) return Class; if (typeof Class !== "function") { throw new TypeError("Super expression must either be null or a function"); } if (typeof _cache !== "undefined") { if (_cache.has(Class)) return _cache.get(Class); _cache.set(Class, Wrapper); } function Wrapper() { return _construct(Class, arguments, _getPrototypeOf(this).constructor); } Wrapper.prototype = Object.create(Class.prototype, { constructor: { value: Wrapper, enumerable: false, writable: true, configurable: true } }); return _setPrototypeOf(Wrapper, Class); }; return _wrapNativeSuper(Class); }
function isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
function _construct(Parent, args, Class) { if (isNativeReflectConstruct()) { _construct = Reflect.construct; } else { _construct = function _construct(Parent, args, Class) { var a = [null]; a.push.apply(a, args); var Constructor = Function.bind.apply(Parent, a); var instance = new Constructor(); if (Class) _setPrototypeOf(instance, Class.prototype); return instance; }; } return _construct.apply(null, arguments); }
function _construct(Parent, args, Class) { if (_isNativeReflectConstruct()) { _construct = Reflect.construct.bind(); } else { _construct = function _construct(Parent, args, Class) { var a = [null]; a.push.apply(a, args); var Constructor = Function.bind.apply(Parent, a); var instance = new Constructor(); if (Class) _setPrototypeOf(instance, Class.prototype); return instance; }; } return _construct.apply(null, arguments); }
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
function _isNativeFunction(fn) { return Function.toString.call(fn).indexOf("[native code]") !== -1; }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
var _require = require('util/'),
inspect = _require.inspect;
inspect = _require.inspect;
var _require2 = require('../errors'),
ERR_INVALID_ARG_TYPE = _require2.codes.ERR_INVALID_ARG_TYPE; // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/endsWith
ERR_INVALID_ARG_TYPE = _require2.codes.ERR_INVALID_ARG_TYPE;
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/endsWith
function endsWith(str, search, this_len) {

@@ -46,7 +35,6 @@ if (this_len === undefined || this_len > str.length) {

}
return str.substring(this_len - search.length, this_len) === search;
} // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/repeat
}
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/repeat
function repeat(str, count) {

@@ -57,3 +45,2 @@ count = Math.floor(count);

count = Math.floor(Math.log(count) / Math.log(2));
while (count) {

@@ -63,7 +50,5 @@ str += str;

}
str += str.substring(0, maxCount - str.length);
return str;
}
var blue = '';

@@ -85,7 +70,7 @@ var green = '';

notIdentical: 'Values identical but not reference-equal:'
}; // Comparing short primitives should just show === / !== instead of using the
};
// Comparing short primitives should just show === / !== instead of using the
// diff.
var kMaxShortLength = 10;
function copyError(source) {

@@ -102,3 +87,2 @@ var keys = Object.keys(source);

}
function inspectValue(val) {

@@ -127,3 +111,2 @@ // The util.inspect default values could be changed. This makes sure the

}
function createErrDiff(actual, expected, operator) {

@@ -139,16 +122,17 @@ var other = '';

var i = 0;
var indicator = ''; // In case both values are objects explicitly mark them as not reference equal
var indicator = '';
// In case both values are objects explicitly mark them as not reference equal
// for the `strictEqual` operator.
if (operator === 'strictEqual' && _typeof(actual) === 'object' && _typeof(expected) === 'object' && actual !== null && expected !== null) {
operator = 'strictEqualObject';
} // If "actual" and "expected" fit on a single line and they are not strictly
}
// If "actual" and "expected" fit on a single line and they are not strictly
// equal, check further special handling.
if (actualLines.length === 1 && expectedLines.length === 1 && actualLines[0] !== expectedLines[0]) {
var inputLength = actualLines[0].length + expectedLines[0].length; // If the character length of "actual" and "expected" together is less than
var inputLength = actualLines[0].length + expectedLines[0].length;
// If the character length of "actual" and "expected" together is less than
// kMaxShortLength and if neither is an object and at least one of them is
// not `zero`, use the strict equal comparison to visualize the output.
if (inputLength <= kMaxShortLength) {

@@ -164,9 +148,7 @@ if ((_typeof(actual) !== 'object' || actual === null) && (_typeof(expected) !== 'object' || expected === null) && (actual !== 0 || expected !== 0)) {

var maxLength = process.stderr && process.stderr.isTTY ? process.stderr.columns : 80;
if (inputLength < maxLength) {
while (actualLines[0][i] === expectedLines[0][i]) {
i++;
} // Ignore the first characters.
}
// Ignore the first characters.
if (i > 2) {

@@ -180,9 +162,8 @@ // Add position indicator for the first mismatch in case it is a

}
} // Remove all ending lines that match (this optimizes the output for
}
// Remove all ending lines that match (this optimizes the output for
// readability by reducing the number of total changed lines).
var a = actualLines[actualLines.length - 1];
var b = expectedLines[expectedLines.length - 1];
while (a === b) {

@@ -194,3 +175,2 @@ if (i++ < 2) {

}
actualLines.pop();

@@ -202,15 +182,13 @@ expectedLines.pop();

}
var maxLines = Math.max(actualLines.length, expectedLines.length); // Strict equal with identical objects that are not identical by reference.
var maxLines = Math.max(actualLines.length, expectedLines.length);
// Strict equal with identical objects that are not identical by reference.
// E.g., assert.deepStrictEqual({ a: Symbol() }, { a: Symbol() })
if (maxLines === 0) {
// We have to get the result again. The lines were all removed before.
var _actualLines = actualInspected.split('\n'); // Only remove lines in case it makes sense to collapse those.
var _actualLines = actualInspected.split('\n');
// Only remove lines in case it makes sense to collapse those.
// TODO: Accept env to always show the full error.
if (_actualLines.length > 30) {
_actualLines[26] = "".concat(blue, "...").concat(white);
while (_actualLines.length > 27) {

@@ -220,6 +198,4 @@ _actualLines.pop();

}
return "".concat(kReadableOperator.notIdentical, "\n\n").concat(_actualLines.join('\n'), "\n");
}
if (i > 3) {

@@ -229,3 +205,2 @@ end = "\n".concat(blue, "...").concat(white).concat(end);

}
if (other !== '') {

@@ -235,11 +210,8 @@ end = "\n ".concat(other).concat(end);

}
var printedLines = 0;
var msg = kReadableOperator[operator] + "\n".concat(green, "+ actual").concat(white, " ").concat(red, "- expected").concat(white);
var skippedMsg = " ".concat(blue, "...").concat(white, " Lines skipped");
for (i = 0; i < maxLines; i++) {
// Only extra expected lines exist
var cur = i - lastPos;
if (actualLines.length < i + 1) {

@@ -257,12 +229,11 @@ // If the last diverging line is more than one line above and the

}
res += "\n ".concat(expectedLines[i - 1]);
printedLines++;
} // Mark the current line as the last diverging one.
lastPos = i; // Add the expected line to the cache.
}
// Mark the current line as the last diverging one.
lastPos = i;
// Add the expected line to the cache.
other += "\n".concat(red, "-").concat(white, " ").concat(expectedLines[i]);
printedLines++; // Only extra actual lines exist
printedLines++;
// Only extra actual lines exist
} else if (expectedLines.length < i + 1) {

@@ -280,19 +251,19 @@ // If the last diverging line is more than one line above and the

}
res += "\n ".concat(actualLines[i - 1]);
printedLines++;
} // Mark the current line as the last diverging one.
lastPos = i; // Add the actual line to the result.
}
// Mark the current line as the last diverging one.
lastPos = i;
// Add the actual line to the result.
res += "\n".concat(green, "+").concat(white, " ").concat(actualLines[i]);
printedLines++; // Lines diverge
printedLines++;
// Lines diverge
} else {
var expectedLine = expectedLines[i];
var actualLine = actualLines[i]; // If the lines diverge, specifically check for lines that only diverge by
var actualLine = actualLines[i];
// If the lines diverge, specifically check for lines that only diverge by
// a trailing comma. In that case it is actually identical and we should
// mark it as such.
var divergingLines = actualLine !== expectedLine && (!endsWith(actualLine, ',') || actualLine.slice(0, -1) !== expectedLine); // If the expected line has a trailing comma but is otherwise identical,
var divergingLines = actualLine !== expectedLine && (!endsWith(actualLine, ',') || actualLine.slice(0, -1) !== expectedLine);
// If the expected line has a trailing comma but is otherwise identical,
// add a comma at the end of the actual line. Otherwise the output could

@@ -306,3 +277,2 @@ // look weird as in:

//
if (divergingLines && endsWith(expectedLine, ',') && expectedLine.slice(0, -1) === actualLine) {

@@ -312,3 +282,2 @@ divergingLines = false;

}
if (divergingLines) {

@@ -326,14 +295,13 @@ // If the last diverging line is more than one line above and the

}
res += "\n ".concat(actualLines[i - 1]);
printedLines++;
} // Mark the current line as the last diverging one.
lastPos = i; // Add the actual line to the result and cache the expected diverging
}
// Mark the current line as the last diverging one.
lastPos = i;
// Add the actual line to the result and cache the expected diverging
// line so consecutive diverging lines show up as +++--- and not +-+-+-.
res += "\n".concat(green, "+").concat(white, " ").concat(actualLine);
other += "\n".concat(red, "-").concat(white, " ").concat(expectedLine);
printedLines += 2; // Lines are identical
printedLines += 2;
// Lines are identical
} else {

@@ -343,5 +311,5 @@ // Add all cached information to the result before adding other things

res += other;
other = ''; // If the last diverging line is exactly one line above or if it is the
other = '';
// If the last diverging line is exactly one line above or if it is the
// very first line, add the line to the result.
if (cur === 1 || i === 0) {

@@ -352,5 +320,4 @@ res += "\n ".concat(actualLine);

}
} // Inspected object to big (Show ~20 rows max)
}
// Inspected object to big (Show ~20 rows max)
if (printedLines > 20 && i < maxLines - 2) {

@@ -360,30 +327,22 @@ return "".concat(msg).concat(skippedMsg, "\n").concat(res, "\n").concat(blue, "...").concat(white).concat(other, "\n") + "".concat(blue, "...").concat(white);

}
return "".concat(msg).concat(skipped ? skippedMsg : '', "\n").concat(res).concat(other).concat(end).concat(indicator);
}
var AssertionError =
/*#__PURE__*/
function (_Error) {
var AssertionError = /*#__PURE__*/function (_Error, _inspect$custom) {
_inherits(AssertionError, _Error);
var _super = _createSuper(AssertionError);
function AssertionError(options) {
var _this;
_classCallCheck(this, AssertionError);
if (_typeof(options) !== 'object' || options === null) {
throw new ERR_INVALID_ARG_TYPE('options', 'Object', options);
}
var message = options.message,
operator = options.operator,
stackStartFn = options.stackStartFn;
operator = options.operator,
stackStartFn = options.stackStartFn;
var actual = options.actual,
expected = options.expected;
expected = options.expected;
var limit = Error.stackTraceLimit;
Error.stackTraceLimit = 0;
if (message != null) {
_this = _possibleConstructorReturn(this, _getPrototypeOf(AssertionError).call(this, String(message)));
_this = _super.call(this, String(message));
} else {

@@ -404,7 +363,6 @@ if (process.stderr && process.stderr.isTTY) {

}
} // Prevent the error stack from being visible by duplicating the error
}
// Prevent the error stack from being visible by duplicating the error
// in a very close way to the original in case both sides are actually
// instances of Error.
if (_typeof(actual) === 'object' && actual !== null && _typeof(expected) === 'object' && expected !== null && 'stack' in actual && actual instanceof Error && 'stack' in expected && expected instanceof Error) {

@@ -414,5 +372,4 @@ actual = copyError(actual);

}
if (operator === 'deepStrictEqual' || operator === 'strictEqual') {
_this = _possibleConstructorReturn(this, _getPrototypeOf(AssertionError).call(this, createErrDiff(actual, expected, operator)));
_this = _super.call(this, createErrDiff(actual, expected, operator));
} else if (operator === 'notDeepStrictEqual' || operator === 'notStrictEqual') {

@@ -422,33 +379,30 @@ // In case the objects are equal but the operator requires unequal, show

var base = kReadableOperator[operator];
var res = inspectValue(actual).split('\n'); // In case "actual" is an object, it should not be reference equal.
var res = inspectValue(actual).split('\n');
// In case "actual" is an object, it should not be reference equal.
if (operator === 'notStrictEqual' && _typeof(actual) === 'object' && actual !== null) {
base = kReadableOperator.notStrictEqualObject;
} // Only remove lines in case it makes sense to collapse those.
}
// Only remove lines in case it makes sense to collapse those.
// TODO: Accept env to always show the full error.
if (res.length > 30) {
res[26] = "".concat(blue, "...").concat(white);
while (res.length > 27) {
res.pop();
}
} // Only print a single input.
}
// Only print a single input.
if (res.length === 1) {
_this = _possibleConstructorReturn(this, _getPrototypeOf(AssertionError).call(this, "".concat(base, " ").concat(res[0])));
_this = _super.call(this, "".concat(base, " ").concat(res[0]));
} else {
_this = _possibleConstructorReturn(this, _getPrototypeOf(AssertionError).call(this, "".concat(base, "\n\n").concat(res.join('\n'), "\n")));
_this = _super.call(this, "".concat(base, "\n\n").concat(res.join('\n'), "\n"));
}
} else {
var _res = inspectValue(actual);
var other = '';
var knownOperators = kReadableOperator[operator];
if (operator === 'notDeepEqual' || operator === 'notEqual') {
_res = "".concat(kReadableOperator[operator], "\n\n").concat(_res);
if (_res.length > 1024) {

@@ -459,11 +413,8 @@ _res = "".concat(_res.slice(0, 1021), "...");

other = "".concat(inspectValue(expected));
if (_res.length > 512) {
_res = "".concat(_res.slice(0, 509), "...");
}
if (other.length > 512) {
other = "".concat(other.slice(0, 509), "...");
}
if (operator === 'deepEqual' || operator === 'equal') {

@@ -475,7 +426,5 @@ _res = "".concat(knownOperators, "\n\n").concat(_res, "\n\nshould equal\n\n");

}
_this = _possibleConstructorReturn(this, _getPrototypeOf(AssertionError).call(this, "".concat(_res).concat(other)));
_this = _super.call(this, "".concat(_res).concat(other));
}
}
Error.stackTraceLimit = limit;

@@ -493,15 +442,12 @@ _this.generatedMessage = !message;

_this.operator = operator;
if (Error.captureStackTrace) {
// eslint-disable-next-line no-restricted-syntax
Error.captureStackTrace(_assertThisInitialized(_this), stackStartFn);
} // Create error message including the error code in the name.
_this.stack; // Reset the name.
}
// Create error message including the error code in the name.
_this.stack;
// Reset the name.
_this.name = 'AssertionError';
return _possibleConstructorReturn(_this);
}
_createClass(AssertionError, [{

@@ -513,3 +459,3 @@ key: "toString",

}, {
key: inspect.custom,
key: _inspect$custom,
value: function value(recurseTimes, ctx) {

@@ -520,3 +466,3 @@ // This limits the `actual` and `expected` property default inspection to

// input values.
return inspect(this, _objectSpread({}, ctx, {
return inspect(this, _objectSpread(_objectSpread({}, ctx), {}, {
customInspect: false,

@@ -527,6 +473,4 @@ depth: 0

}]);
return AssertionError;
}(_wrapNativeSuper(Error));
}( /*#__PURE__*/_wrapNativeSuper(Error), inspect.custom);
module.exports = AssertionError;

@@ -5,7 +5,8 @@ // Currently in sync with Node.js lib/internal/errors.js

/* eslint node-core/documented-errors: "error" */
/* eslint node-core/alphabetize-errors: "error" */
/* eslint node-core/prefer-util-format-errors: "error" */
/* eslint node-core/prefer-util-format-errors: "error" */
'use strict'; // The whole point behind this internal module is to allow Node.js to no
'use strict';
// The whole point behind this internal module is to allow Node.js to no
// longer be forced to treat every error message change as a semver-major

@@ -15,22 +16,20 @@ // change. The NodeError classes here all expose a `code` property whose

// message may change, the code should not.
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
var codes = {};
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
var codes = {}; // Lazy loaded
// Lazy loaded
var assert;
var util;
function createErrorType(code, message, Base) {

@@ -40,3 +39,2 @@ if (!Base) {

}
function getMessage(arg1, arg2, arg3) {

@@ -49,25 +47,18 @@ if (typeof message === 'string') {

}
var NodeError =
/*#__PURE__*/
function (_Base) {
var NodeError = /*#__PURE__*/function (_Base) {
_inherits(NodeError, _Base);
var _super = _createSuper(NodeError);
function NodeError(arg1, arg2, arg3) {
var _this;
_classCallCheck(this, NodeError);
_this = _possibleConstructorReturn(this, _getPrototypeOf(NodeError).call(this, getMessage(arg1, arg2, arg3)));
_this = _super.call(this, getMessage(arg1, arg2, arg3));
_this.code = code;
return _this;
}
return NodeError;
return _createClass(NodeError);
}(Base);
codes[code] = NodeError;
} // https://github.com/nodejs/node/blob/v10.8.0/lib/internal/errors.js
}
// https://github.com/nodejs/node/blob/v10.8.0/lib/internal/errors.js
function oneOf(expected, thing) {

@@ -79,3 +70,2 @@ if (Array.isArray(expected)) {

});
if (len > 2) {

@@ -91,10 +81,10 @@ return "one of ".concat(thing, " ").concat(expected.slice(0, len - 1).join(', '), ", or ") + expected[len - 1];

}
} // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/startsWith
}
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/startsWith
function startsWith(str, search, pos) {
return str.substr(!pos || pos < 0 ? 0 : +pos, search.length) === search;
} // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/endsWith
}
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/endsWith
function endsWith(str, search, this_len) {

@@ -104,7 +94,6 @@ if (this_len === undefined || this_len > str.length) {

}
return str.substring(this_len - search.length, this_len) === search;
} // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/includes
}
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/includes
function includes(str, search, start) {

@@ -114,3 +103,2 @@ if (typeof start !== 'number') {

}
if (start + search.length > str.length) {

@@ -122,10 +110,9 @@ return false;

}
createErrorType('ERR_AMBIGUOUS_ARGUMENT', 'The "%s" argument is ambiguous. %s', TypeError);
createErrorType('ERR_INVALID_ARG_TYPE', function (name, expected, actual) {
if (assert === undefined) assert = require('../assert');
assert(typeof name === 'string', "'name' must be a string"); // determiner: 'must be' or 'must not be'
assert(typeof name === 'string', "'name' must be a string");
// determiner: 'must be' or 'must not be'
var determiner;
if (typeof expected === 'string' && startsWith(expected, 'not ')) {

@@ -137,5 +124,3 @@ determiner = 'must not be';

}
var msg;
if (endsWith(name, ' argument')) {

@@ -147,5 +132,5 @@ // For cases like 'first argument'

msg = "The \"".concat(name, "\" ").concat(type, " ").concat(determiner, " ").concat(oneOf(expected, 'type'));
} // TODO(BridgeAR): Improve the output by showing `null` and similar.
}
// TODO(BridgeAR): Improve the output by showing `null` and similar.
msg += ". Received type ".concat(_typeof(actual));

@@ -158,7 +143,5 @@ return msg;

var inspected = util.inspect(value);
if (inspected.length > 128) {
inspected = "".concat(inspected.slice(0, 128), "...");
}
return "The argument '".concat(name, "' ").concat(reason, ". Received ").concat(inspected);

@@ -168,3 +151,2 @@ }, TypeError, RangeError);

var type;
if (value && value.constructor && value.constructor.name) {

@@ -175,3 +157,2 @@ type = "instance of ".concat(value.constructor.name);

}
return "Expected ".concat(input, " to be returned from the \"").concat(name, "\"") + " function but got ".concat(type, ".");

@@ -183,3 +164,2 @@ }, TypeError);

}
if (assert === undefined) assert = require('../assert');

@@ -192,3 +172,2 @@ assert(args.length > 0, 'At least one arg needs to be specified');

});
switch (len) {

@@ -198,7 +177,5 @@ case 1:

break;
case 2:
msg += "".concat(args[0], " and ").concat(args[1], " arguments");
break;
default:

@@ -209,5 +186,4 @@ msg += args.slice(0, len - 1).join(', ');

}
return "".concat(msg, " must be specified");
}, TypeError);
module.exports.codes = codes;
// Currently in sync with Node.js lib/internal/util/comparisons.js
// https://github.com/nodejs/node/commit/112cc7c27551254aa2b17098fb774867f05ed0d9
'use strict';
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); }
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); }
function _iterableToArrayLimit(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
var regexFlagsSupported = /a/g.flags !== undefined;
var arrayFromSet = function arrayFromSet(set) {

@@ -24,3 +21,2 @@ var array = [];

};
var arrayFromMap = function arrayFromMap(map) {

@@ -33,3 +29,2 @@ var array = [];

};
var objectIs = Object.is ? Object.is : require('object-is');

@@ -40,45 +35,39 @@ var objectGetOwnPropertySymbols = Object.getOwnPropertySymbols ? Object.getOwnPropertySymbols : function () {

var numberIsNaN = Number.isNaN ? Number.isNaN : require('is-nan');
function uncurryThis(f) {
return f.call.bind(f);
}
var hasOwnProperty = uncurryThis(Object.prototype.hasOwnProperty);
var propertyIsEnumerable = uncurryThis(Object.prototype.propertyIsEnumerable);
var objectToString = uncurryThis(Object.prototype.toString);
var _require$types = require('util/').types,
isAnyArrayBuffer = _require$types.isAnyArrayBuffer,
isArrayBufferView = _require$types.isArrayBufferView,
isDate = _require$types.isDate,
isMap = _require$types.isMap,
isRegExp = _require$types.isRegExp,
isSet = _require$types.isSet,
isNativeError = _require$types.isNativeError,
isBoxedPrimitive = _require$types.isBoxedPrimitive,
isNumberObject = _require$types.isNumberObject,
isStringObject = _require$types.isStringObject,
isBooleanObject = _require$types.isBooleanObject,
isBigIntObject = _require$types.isBigIntObject,
isSymbolObject = _require$types.isSymbolObject,
isFloat32Array = _require$types.isFloat32Array,
isFloat64Array = _require$types.isFloat64Array;
isAnyArrayBuffer = _require$types.isAnyArrayBuffer,
isArrayBufferView = _require$types.isArrayBufferView,
isDate = _require$types.isDate,
isMap = _require$types.isMap,
isRegExp = _require$types.isRegExp,
isSet = _require$types.isSet,
isNativeError = _require$types.isNativeError,
isBoxedPrimitive = _require$types.isBoxedPrimitive,
isNumberObject = _require$types.isNumberObject,
isStringObject = _require$types.isStringObject,
isBooleanObject = _require$types.isBooleanObject,
isBigIntObject = _require$types.isBigIntObject,
isSymbolObject = _require$types.isSymbolObject,
isFloat32Array = _require$types.isFloat32Array,
isFloat64Array = _require$types.isFloat64Array;
function isNonIndex(key) {
if (key.length === 0 || key.length > 10) return true;
for (var i = 0; i < key.length; i++) {
var code = key.charCodeAt(i);
if (code < 48 || code > 57) return true;
} // The maximum size for an array is 2 ** 32 -1.
}
// The maximum size for an array is 2 ** 32 -1.
return key.length === 10 && key >= Math.pow(2, 32);
}
function getOwnNonIndexProperties(value) {
return Object.keys(value).filter(isNonIndex).concat(objectGetOwnPropertySymbols(value).filter(Object.prototype.propertyIsEnumerable.bind(value)));
} // Taken from https://github.com/feross/buffer/blob/680e9e5e488f22aac27599a57dc844a6315928dd/index.js
}
// Taken from https://github.com/feross/buffer/blob/680e9e5e488f22aac27599a57dc844a6315928dd/index.js
// original notice:
/*!

@@ -90,4 +79,2 @@ * The buffer module from node.js, for the browser.

*/
function compare(a, b) {

@@ -97,6 +84,4 @@ if (a === b) {

}
var x = a.length;
var y = b.length;
for (var i = 0, len = Math.min(x, y); i < len; ++i) {

@@ -109,14 +94,10 @@ if (a[i] !== b[i]) {

}
if (x < y) {
return -1;
}
if (y < x) {
return 1;
}
return 0;
}
var ONLY_ENUMERABLE = undefined;

@@ -128,8 +109,8 @@ var kStrict = true;

var kIsSet = 2;
var kIsMap = 3; // Check if they have the same source and flags
var kIsMap = 3;
// Check if they have the same source and flags
function areSimilarRegExps(a, b) {
return regexFlagsSupported ? a.source === b.source && a.flags === b.flags : RegExp.prototype.toString.call(a) === RegExp.prototype.toString.call(b);
}
function areSimilarFloatArrays(a, b) {

@@ -139,3 +120,2 @@ if (a.byteLength !== b.byteLength) {

}
for (var offset = 0; offset < a.byteLength; offset++) {

@@ -146,6 +126,4 @@ if (a[offset] !== b[offset]) {

}
return true;
}
function areSimilarTypedArrays(a, b) {

@@ -155,10 +133,7 @@ if (a.byteLength !== b.byteLength) {

}
return compare(new Uint8Array(a.buffer, a.byteOffset, a.byteLength), new Uint8Array(b.buffer, b.byteOffset, b.byteLength)) === 0;
}
function areEqualArrayBuffers(buf1, buf2) {
return buf1.byteLength === buf2.byteLength && compare(new Uint8Array(buf1), new Uint8Array(buf2)) === 0;
}
function isEqualBoxedPrimitive(val1, val2) {

@@ -168,17 +143,15 @@ if (isNumberObject(val1)) {

}
if (isStringObject(val1)) {
return isStringObject(val2) && String.prototype.valueOf.call(val1) === String.prototype.valueOf.call(val2);
}
if (isBooleanObject(val1)) {
return isBooleanObject(val2) && Boolean.prototype.valueOf.call(val1) === Boolean.prototype.valueOf.call(val2);
}
if (isBigIntObject(val1)) {
return isBigIntObject(val2) && BigInt.prototype.valueOf.call(val1) === BigInt.prototype.valueOf.call(val2);
}
return isSymbolObject(val2) && Symbol.prototype.valueOf.call(val1) === Symbol.prototype.valueOf.call(val2);
}
return isSymbolObject(val2) && Symbol.prototype.valueOf.call(val1) === Symbol.prototype.valueOf.call(val2);
} // Notes: Type tags are historical [[Class]] properties that can be set by
// Notes: Type tags are historical [[Class]] properties that can be set by
// FunctionTemplate::SetClassName() in C++ or Symbol.toStringTag in JS

@@ -202,3 +175,2 @@ // and retrieved using Object.prototype.toString.call(obj) in JS

function innerDeepEqual(val1, val2, strict, memos) {

@@ -209,5 +181,5 @@ // All identical values are equivalent, as determined by ===.

return strict ? objectIs(val1, val2) : true;
} // Check more closely if val1 and val2 are equal.
}
// Check more closely if val1 and val2 are equal.
if (strict) {

@@ -217,7 +189,5 @@ if (_typeof(val1) !== 'object') {

}
if (_typeof(val2) !== 'object' || val1 === null || val2 === null) {
return false;
}
if (Object.getPrototypeOf(val1) !== Object.getPrototypeOf(val2)) {

@@ -232,6 +202,4 @@ return false;

}
return false;
}
if (val2 === null || _typeof(val2) !== 'object') {

@@ -241,10 +209,7 @@ return false;

}
var val1Tag = objectToString(val1);
var val2Tag = objectToString(val2);
if (val1Tag !== val2Tag) {
return false;
}
if (Array.isArray(val1)) {

@@ -255,16 +220,12 @@ // Check for sparse arrays and general fast path

}
var keys1 = getOwnNonIndexProperties(val1, ONLY_ENUMERABLE);
var keys2 = getOwnNonIndexProperties(val2, ONLY_ENUMERABLE);
if (keys1.length !== keys2.length) {
return false;
}
return keyCheck(val1, val2, strict, memos, kIsArray, keys1);
} // [browserify] This triggers on certain types in IE (Map/Set) so we don't
}
// [browserify] This triggers on certain types in IE (Map/Set) so we don't
// wan't to early return out of the rest of the checks. However we can check
// if the second value is one of these values and the first isn't.
if (val1Tag === '[object Object]') {

@@ -276,3 +237,2 @@ // return keyCheck(val1, val2, strict, memos, kNoIterator);

}
if (isDate(val1)) {

@@ -299,15 +259,11 @@ if (!isDate(val2) || Date.prototype.getTime.call(val1) !== Date.prototype.getTime.call(val2)) {

return false;
} // Buffer.compare returns true, so val1.length === val2.length. If they both
}
// Buffer.compare returns true, so val1.length === val2.length. If they both
// only contain numeric keys, we don't need to exam further than checking
// the symbols.
var _keys = getOwnNonIndexProperties(val1, ONLY_ENUMERABLE);
var _keys2 = getOwnNonIndexProperties(val2, ONLY_ENUMERABLE);
if (_keys.length !== _keys2.length) {
return false;
}
return keyCheck(val1, val2, strict, memos, kNoIterator, _keys);

@@ -318,3 +274,2 @@ } else if (isSet(val1)) {

}
return keyCheck(val1, val2, strict, memos, kIsSet);

@@ -325,3 +280,2 @@ } else if (isMap(val1)) {

}
return keyCheck(val1, val2, strict, memos, kIsMap);

@@ -335,6 +289,4 @@ } else if (isAnyArrayBuffer(val1)) {

}
return keyCheck(val1, val2, strict, memos, kNoIterator);
}
function getEnumerables(val, keys) {

@@ -345,3 +297,2 @@ return keys.filter(function (k) {

}
function keyCheck(val1, val2, strict, memos, iterationType, aKeys) {

@@ -357,12 +308,12 @@ // For all remaining Object pairs, including Array, objects and Maps,

aKeys = Object.keys(val1);
var bKeys = Object.keys(val2); // The pair must have the same number of owned properties.
var bKeys = Object.keys(val2);
// The pair must have the same number of owned properties.
if (aKeys.length !== bKeys.length) {
return false;
}
} // Cheap key test
}
// Cheap key test
var i = 0;
for (; i < aKeys.length; i++) {

@@ -373,12 +324,8 @@ if (!hasOwnProperty(val2, aKeys[i])) {

}
if (strict && arguments.length === 5) {
var symbolKeysA = objectGetOwnPropertySymbols(val1);
if (symbolKeysA.length !== 0) {
var count = 0;
for (i = 0; i < symbolKeysA.length; i++) {
var key = symbolKeysA[i];
if (propertyIsEnumerable(val1, key)) {

@@ -388,3 +335,2 @@ if (!propertyIsEnumerable(val2, key)) {

}
aKeys.push(key);

@@ -396,5 +342,3 @@ count++;

}
var symbolKeysB = objectGetOwnPropertySymbols(val2);
if (symbolKeysA.length !== symbolKeysB.length && getEnumerables(val2, symbolKeysB).length !== count) {

@@ -405,3 +349,2 @@ return false;

var _symbolKeysB = objectGetOwnPropertySymbols(val2);
if (_symbolKeysB.length !== 0 && getEnumerables(val2, _symbolKeysB).length !== 0) {

@@ -412,8 +355,7 @@ return false;

}
if (aKeys.length === 0 && (iterationType === kNoIterator || iterationType === kIsArray && val1.length === 0 || val1.size === 0)) {
return true;
} // Use memos to handle cycles.
}
// Use memos to handle cycles.
if (memos === undefined) {

@@ -430,6 +372,4 @@ memos = {

var val2MemoA = memos.val1.get(val1);
if (val2MemoA !== undefined) {
var val2MemoB = memos.val2.get(val2);
if (val2MemoB !== undefined) {

@@ -439,6 +379,4 @@ return val2MemoA === val2MemoB;

}
memos.position++;
}
memos.val1.set(val1, memos.position);

@@ -451,10 +389,7 @@ memos.val2.set(val2, memos.position);

}
function setHasEqualElement(set, val1, strict, memo) {
// Go looking.
var setValues = arrayFromSet(set);
for (var i = 0; i < setValues.length; i++) {
var val2 = setValues[i];
if (innerDeepEqual(val1, val2, strict, memo)) {

@@ -466,10 +401,9 @@ // Remove the matching element to make sure we do not check that again.

}
return false;
}
return false;
} // See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Equality_comparisons_and_sameness#Loose_equality_using
// See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Equality_comparisons_and_sameness#Loose_equality_using
// Sadly it is not possible to detect corresponding values properly in case the
// type is a string, number, bigint or boolean. The reason is that those values
// can match lots of different string values (e.g., 1n == '+00001').
function findLooseMatchingPrimitives(prim) {

@@ -479,10 +413,7 @@ switch (_typeof(prim)) {

return null;
case 'object':
// Only pass in null as object!
return undefined;
case 'symbol':
return false;
case 'string':

@@ -493,3 +424,2 @@ prim = +prim;

// Fall through
case 'number':

@@ -499,8 +429,5 @@ if (numberIsNaN(prim)) {

}
}
return true;
}
function setMightHaveLoosePrim(a, b, prim) {

@@ -511,19 +438,13 @@ var altValue = findLooseMatchingPrimitives(prim);

}
function mapMightHaveLoosePrim(a, b, prim, item, memo) {
var altValue = findLooseMatchingPrimitives(prim);
if (altValue != null) {
return altValue;
}
var curB = b.get(altValue);
if (curB === undefined && !b.has(altValue) || !innerDeepEqual(item, curB, false, memo)) {
return false;
}
return !a.has(altValue) && innerDeepEqual(item, curB, false, memo);
}
function setEquiv(a, b, strict, memo) {

@@ -534,40 +455,35 @@ // This is a lazily initiated Set of entries which have to be compared

var aValues = arrayFromSet(a);
for (var i = 0; i < aValues.length; i++) {
var val = aValues[i]; // Note: Checking for the objects first improves the performance for object
var val = aValues[i];
// Note: Checking for the objects first improves the performance for object
// heavy sets but it is a minor slow down for primitives. As they are fast
// to check this improves the worst case scenario instead.
if (_typeof(val) === 'object' && val !== null) {
if (set === null) {
set = new Set();
} // If the specified value doesn't exist in the second set its an not null
}
// If the specified value doesn't exist in the second set its an not null
// object (or non strict only: a not matching primitive) we'll need to go
// hunting for something thats deep-(strict-)equal to it. To make this
// O(n log n) complexity we have to copy these values in a new set first.
set.add(val);
} else if (!b.has(val)) {
if (strict) return false; // Fast path to detect missing string, symbol, undefined and null values.
if (strict) return false;
// Fast path to detect missing string, symbol, undefined and null values.
if (!setMightHaveLoosePrim(a, b, val)) {
return false;
}
if (set === null) {
set = new Set();
}
set.add(val);
}
}
if (set !== null) {
var bValues = arrayFromSet(b);
for (var _i = 0; _i < bValues.length; _i++) {
var _val = bValues[_i]; // We have to check if a primitive value is already
var _val = bValues[_i];
// We have to check if a primitive value is already
// matching and only if it's not, go hunting for it.
if (_typeof(_val) === 'object' && _val !== null) {

@@ -579,9 +495,6 @@ if (!setHasEqualElement(set, _val, strict, memo)) return false;

}
return set.size === 0;
}
return true;
}
function mapHasEqualEntry(set, map, key1, item1, strict, memo) {

@@ -592,6 +505,4 @@ // To be able to handle cases like:

var setValues = arrayFromSet(set);
for (var i = 0; i < setValues.length; i++) {
var key2 = setValues[i];
if (innerDeepEqual(key1, key2, strict, memo) && innerDeepEqual(item1, map.get(key2), strict, memo)) {

@@ -602,15 +513,11 @@ set.delete(key2);

}
return false;
}
function mapEquiv(a, b, strict, memo) {
var set = null;
var aEntries = arrayFromMap(a);
for (var i = 0; i < aEntries.length; i++) {
var _aEntries$i = _slicedToArray(aEntries[i], 2),
key = _aEntries$i[0],
item1 = _aEntries$i[1];
key = _aEntries$i[0],
item1 = _aEntries$i[1];
if (_typeof(key) === 'object' && key !== null) {

@@ -620,3 +527,2 @@ if (set === null) {

}
set.add(key);

@@ -627,13 +533,10 @@ } else {

var item2 = b.get(key);
if (item2 === undefined && !b.has(key) || !innerDeepEqual(item1, item2, strict, memo)) {
if (strict) return false; // Fast path to detect missing string, symbol, undefined and null
if (strict) return false;
// Fast path to detect missing string, symbol, undefined and null
// keys.
if (!mapMightHaveLoosePrim(a, b, key, item1, memo)) return false;
if (set === null) {
set = new Set();
}
set.add(key);

@@ -643,24 +546,18 @@ }

}
if (set !== null) {
var bEntries = arrayFromMap(b);
for (var _i2 = 0; _i2 < bEntries.length; _i2++) {
var _bEntries$_i = _slicedToArray(bEntries[_i2], 2),
key = _bEntries$_i[0],
item = _bEntries$_i[1];
if (_typeof(key) === 'object' && key !== null) {
if (!mapHasEqualEntry(set, a, key, item, strict, memo)) return false;
} else if (!strict && (!a.has(key) || !innerDeepEqual(a.get(key), item, false, memo)) && !mapHasEqualEntry(set, a, key, item, false, memo)) {
_key = _bEntries$_i[0],
item = _bEntries$_i[1];
if (_typeof(_key) === 'object' && _key !== null) {
if (!mapHasEqualEntry(set, a, _key, item, strict, memo)) return false;
} else if (!strict && (!a.has(_key) || !innerDeepEqual(a.get(_key), item, false, memo)) && !mapHasEqualEntry(set, a, _key, item, false, memo)) {
return false;
}
}
return set.size === 0;
}
return true;
}
function objEquiv(a, b, strict, keys, memos, iterationType) {

@@ -670,3 +567,2 @@ // Sets and maps don't have their entries accessible via normal object

var i = 0;
if (iterationType === kIsSet) {

@@ -691,6 +587,4 @@ if (!setEquiv(a, b, strict, memos)) {

var keysA = Object.keys(a);
for (; i < keysA.length; i++) {
var key = keysA[i];
if (!hasOwnProperty(b, key) || !innerDeepEqual(a[key], b[key], strict, memos)) {

@@ -700,33 +594,26 @@ return false;

}
if (keysA.length !== Object.keys(b).length) {
return false;
}
return true;
}
}
} // The pair must have equivalent values for every corresponding key.
}
// The pair must have equivalent values for every corresponding key.
// Possibly expensive deep test:
for (i = 0; i < keys.length; i++) {
var _key = keys[i];
if (!innerDeepEqual(a[_key], b[_key], strict, memos)) {
var _key2 = keys[i];
if (!innerDeepEqual(a[_key2], b[_key2], strict, memos)) {
return false;
}
}
return true;
}
function isDeepEqual(val1, val2) {
return innerDeepEqual(val1, val2, kLoose);
}
function isDeepStrictEqual(val1, val2) {
return innerDeepEqual(val1, val2, kStrict);
}
module.exports = {

@@ -733,0 +620,0 @@ isDeepEqual: isDeepEqual,

{
"name": "assert",
"version": "2.0.0",
"version": "2.1.0",
"description": "The assert module from Node.js, for the browser.",

@@ -28,19 +28,20 @@ "main": "build/assert.js",

"devDependencies": {
"@babel/cli": "^7.4.4",
"@babel/core": "^7.4.4",
"@babel/preset-env": "^7.4.4",
"airtap": "^2.0.2",
"@babel/cli": "^7.22.15",
"@babel/core": "^7.22.15",
"@babel/preset-env": "^7.22.15",
"airtap": "^2.0.4",
"array-fill": "^1.2.0",
"core-js": "^3.0.1",
"cross-env": "^5.2.0",
"object.entries": "^1.1.0",
"object.getownpropertydescriptors": "^2.0.3",
"tape": "^4.10.1"
"core-js": "^3.32.2",
"cross-env": "^5.2.1",
"object.entries": "^1.1.7",
"object.getownpropertydescriptors": "^2.1.7",
"tape": "^5.6.6"
},
"dependencies": {
"es6-object-assign": "^1.1.0",
"is-nan": "^1.2.1",
"object-is": "^1.0.1",
"util": "^0.12.0"
"call-bind": "^1.0.2",
"is-nan": "^1.3.2",
"object-is": "^1.1.5",
"object.assign": "^4.1.4",
"util": "^0.12.5"
}
}

@@ -21,10 +21,12 @@ # assert

## Usage
## Inconsistencies with Node.js `assert`
The goal is to provide an API that is as functionally identical to the [Node.js `assert` API](https://nodejs.org/api/assert.html) as possible. Read the [official docs](https://nodejs.org/api/assert.html) for API documentation.
Due to differences between browsers, some error properties such as `message` and `stack` will be inconsistent. However the assertion behaviour is as close as possible to Node.js and the same error `code` will always be used.
### Inconsistencies with Node.js `assert`
## Usage with bundlers that don't automatically include polyfills for Node.js APIs
Due to differences between browsers, some error properties such as `message` and `stack` will be inconsistent. However the assertion behaviour is as close as possible to Node.js and the same error `code` will always be used.
Bundlers like `webpack 5` and `Vite.js` (and possibly others) don't automatically include polyfills for Node.js APIs. Like most packages on npm, this module depends on other Node.js APIs, so it won't work with these bundlers without also including a polyfill for the `process` Node.js global. You can use [this library](https://github.com/defunctzombie/node-process) to polyfill the `process` global.
Note that this is not a flaw in this package - this package will work without any manual configuration with `browserify` and `webpack 4` and other working bundlers. Unfortunately, some bundlers decided to require an explicit allow-list of all Node.js API specific packages instead of having them work out of the box, hence the incompatibility. See https://github.com/browserify/commonjs-assert/issues/55 for some more context.
## Contributing

@@ -31,0 +33,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc