From 46e43f4bde4a35785b4997b81e86cd19f046b69b Mon Sep 17 00:00:00 2001 From: Minteck Date: Tue, 21 Dec 2021 16:52:28 +0100 Subject: Commit --- src/node_modules/assert/CHANGELOG.md | 14 + src/node_modules/assert/LICENSE | 18 + src/node_modules/assert/README.md | 73 +++ src/node_modules/assert/build/assert.js | 631 +++++++++++++++++++ .../build/internal/assert/assertion_error.js | 501 +++++++++++++++ src/node_modules/assert/build/internal/errors.js | 195 ++++++ .../assert/build/internal/util/comparisons.js | 688 +++++++++++++++++++++ src/node_modules/assert/package.json | 45 ++ 8 files changed, 2165 insertions(+) create mode 100644 src/node_modules/assert/CHANGELOG.md create mode 100644 src/node_modules/assert/LICENSE create mode 100644 src/node_modules/assert/README.md create mode 100644 src/node_modules/assert/build/assert.js create mode 100644 src/node_modules/assert/build/internal/assert/assertion_error.js create mode 100644 src/node_modules/assert/build/internal/errors.js create mode 100644 src/node_modules/assert/build/internal/util/comparisons.js create mode 100644 src/node_modules/assert/package.json (limited to 'src/node_modules/assert') diff --git a/src/node_modules/assert/CHANGELOG.md b/src/node_modules/assert/CHANGELOG.md new file mode 100644 index 0000000..807626d --- /dev/null +++ b/src/node_modules/assert/CHANGELOG.md @@ -0,0 +1,14 @@ +# assert change log + +All notable changes to this project will be documented in this file. + +This project adheres to [Semantic Versioning](http://semver.org/). + +## 2.0.0 + +* Sync with Node.js master. ([@lukechilds](https://github.com/lukechilds) in [#44](https://github.com/browserify/commonjs-assert/pull/44)) + +**Note:** Support for IE9 and IE10 has been dropped. IE11 is still supported. + +## 1.5.0 +* Add strict mode APIs. ([@lukechilds](https://github.com/lukechilds) in [#41](https://github.com/browserify/commonjs-assert/pull/41)) diff --git a/src/node_modules/assert/LICENSE b/src/node_modules/assert/LICENSE new file mode 100644 index 0000000..e3d4e69 --- /dev/null +++ b/src/node_modules/assert/LICENSE @@ -0,0 +1,18 @@ +Copyright Joyent, Inc. and other Node contributors. All rights reserved. +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. diff --git a/src/node_modules/assert/README.md b/src/node_modules/assert/README.md new file mode 100644 index 0000000..e2cc9e1 --- /dev/null +++ b/src/node_modules/assert/README.md @@ -0,0 +1,73 @@ +# assert + +> The [`assert`](https://nodejs.org/api/assert.html) module from Node.js, for the browser. + +[![Build Status](https://travis-ci.org/browserify/commonjs-assert.svg?branch=master)](https://travis-ci.org/browserify/commonjs-assert) +[![npm](https://img.shields.io/npm/dm/assert.svg)](https://www.npmjs.com/package/assert) +[![npm](https://img.shields.io/npm/v/assert.svg)](https://www.npmjs.com/package/assert) + +With browserify, simply `require('assert')` or use the `assert` global and you will get this module. + +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. + +## Install + +To use this module directly (without browserify), install it as a dependency: + +``` +npm install assert +``` + +## Usage + +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. + +### Inconsistencies with Node.js `assert` + +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. + +## Contributing + +To contribute, work on the source files. Then build and run the tests against the built files. Be careful to not introduce syntax that will be transpiled down to unsupported syntax. For example, `for...of` loops will be transpiled to use `Symbol.iterator` which is unavailable in IE. + +### Build scripts + +#### `npm run build` + +Builds the project into the `build` dir. + +#### `npm run dev` + +Watches source files for changes and rebuilds them into the `build` dir. + +#### `npm run test` + +Builds the source files into the `build` dir and then runs the tests against the built project. + +#### `npm run test:nobuild` + +Runs the tests against the built project without rebuilding first. + +This is useful if you're debugging in the transpiled code and want to re-run the tests without overwriting any changes you may have made. + +#### `npm run test:source` + +Runs the tests against the unbuilt source files. + +This will only work on modern Node.js versions. + +#### `npm run test:browsers` + +Run browser tests against the all targets in the cloud. + +Requires airtap credentials to be configured on your machine. + +#### `npm run test:browsers:local` + +Run a local browser test server. No airtap configuration required. + +When paired with `npm run dev` any changes you make to the source files will be automatically transpiled and served on the next request to the test server. + +## License + +MIT © Joyent, Inc. and other Node contributors diff --git a/src/node_modules/assert/build/assert.js b/src/node_modules/assert/build/assert.js new file mode 100644 index 0000000..a4bc0a8 --- /dev/null +++ b/src/node_modules/assert/build/assert.js @@ -0,0 +1,631 @@ +// Currently in sync with Node.js lib/assert.js +// https://github.com/nodejs/node/commit/2a51ae424a513ec9a6aa3466baa0cc1d55dd4f3b +// Originally from narwhal.js (http://narwhaljs.org) +// Copyright (c) 2009 Thomas Robinson <280north.com> +// +// 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 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. +'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 _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; + +var AssertionError = require('./internal/assert/assertion_error'); + +var _require2 = require('util/'), + 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'); +var errorCache = new Map(); +var isDeepEqual; +var isDeepStrictEqual; +var parseExpressionAt; +var findNodeAround; +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 +// 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; // The assert module provides functions that throw +// AssertionError's when particular conditions are not met. The +// 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 +// when a corresponding condition is not met, with a message that +// may be undefined if not provided. All assertion methods provide +// both the actual and expected values to the assertion error for +// display purposes. + +function innerFail(obj) { + if (obj.message instanceof Error) throw obj.message; + throw new AssertionError(obj); +} + +function fail(actual, expected, message, operator, stackStartFn) { + var argsLen = arguments.length; + var internalMessage; + + if (argsLen === 0) { + internalMessage = 'Failed'; + } else if (argsLen === 1) { + message = actual; + actual = undefined; + } else { + if (warned === false) { + warned = true; + var warn = process.emitWarning ? process.emitWarning : console.warn.bind(console); + warn('assert.fail() with more than one argument is deprecated. ' + 'Please use assert.strictEqual() instead or only pass a message.', 'DeprecationWarning', 'DEP0094'); + } + + if (argsLen === 2) operator = '!='; + } + + if (message instanceof Error) throw message; + var errArgs = { + actual: actual, + expected: expected, + operator: operator === undefined ? 'fail' : operator, + stackStartFn: stackStartFn || fail + }; + + if (message !== undefined) { + errArgs.message = message; + } + + var err = new AssertionError(errArgs); + + if (internalMessage) { + err.message = internalMessage; + err.generatedMessage = true; + } + + throw err; +} + +assert.fail = fail; // The AssertionError is defined in internal/error. + +assert.AssertionError = AssertionError; + +function innerOk(fn, argLen, value, message) { + if (!value) { + var generatedMessage = false; + + if (argLen === 0) { + generatedMessage = true; + message = 'No value argument passed to `assert.ok()`'; + } else if (message instanceof Error) { + throw message; + } + + var err = new AssertionError({ + actual: value, + expected: true, + message: message, + operator: '==', + stackStartFn: fn + }); + err.generatedMessage = generatedMessage; + throw err; + } +} // Pure assertion tests whether a value is truthy, as determined +// by !!value. + + +function ok() { + for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + innerOk.apply(void 0, [ok, args.length].concat(args)); +} + +assert.ok = ok; // 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 + + + if (actual != expected) { + innerFail({ + actual: actual, + expected: expected, + message: message, + operator: '==', + stackStartFn: equal + }); + } +}; // 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 + + + if (actual == expected) { + innerFail({ + actual: actual, + expected: expected, + message: message, + operator: '!=', + stackStartFn: notEqual + }); + } +}; // The equivalence assertion tests a deep equality relation. + + +assert.deepEqual = function deepEqual(actual, expected, message) { + if (arguments.length < 2) { + throw new ERR_MISSING_ARGS('actual', 'expected'); + } + + if (isDeepEqual === undefined) lazyLoadComparison(); + + if (!isDeepEqual(actual, expected)) { + innerFail({ + actual: actual, + expected: expected, + message: message, + operator: 'deepEqual', + stackStartFn: deepEqual + }); + } +}; // The non-equivalence assertion tests for any deep inequality. + + +assert.notDeepEqual = function notDeepEqual(actual, expected, message) { + if (arguments.length < 2) { + throw new ERR_MISSING_ARGS('actual', 'expected'); + } + + if (isDeepEqual === undefined) lazyLoadComparison(); + + if (isDeepEqual(actual, expected)) { + innerFail({ + actual: actual, + expected: expected, + message: message, + operator: 'notDeepEqual', + stackStartFn: notDeepEqual + }); + } +}; +/* eslint-enable */ + + +assert.deepStrictEqual = function deepStrictEqual(actual, expected, message) { + if (arguments.length < 2) { + throw new ERR_MISSING_ARGS('actual', 'expected'); + } + + if (isDeepEqual === undefined) lazyLoadComparison(); + + if (!isDeepStrictEqual(actual, expected)) { + innerFail({ + actual: actual, + expected: expected, + message: message, + operator: 'deepStrictEqual', + stackStartFn: deepStrictEqual + }); + } +}; + +assert.notDeepStrictEqual = notDeepStrictEqual; + +function notDeepStrictEqual(actual, expected, message) { + if (arguments.length < 2) { + throw new ERR_MISSING_ARGS('actual', 'expected'); + } + + if (isDeepEqual === undefined) lazyLoadComparison(); + + if (isDeepStrictEqual(actual, expected)) { + innerFail({ + actual: actual, + expected: expected, + message: message, + operator: 'notDeepStrictEqual', + stackStartFn: notDeepStrictEqual + }); + } +} + +assert.strictEqual = function strictEqual(actual, expected, message) { + if (arguments.length < 2) { + throw new ERR_MISSING_ARGS('actual', 'expected'); + } + + if (!objectIs(actual, expected)) { + innerFail({ + actual: actual, + expected: expected, + message: message, + operator: 'strictEqual', + stackStartFn: strictEqual + }); + } +}; + +assert.notStrictEqual = function notStrictEqual(actual, expected, message) { + if (arguments.length < 2) { + throw new ERR_MISSING_ARGS('actual', 'expected'); + } + + if (objectIs(actual, expected)) { + innerFail({ + actual: actual, + expected: expected, + message: message, + operator: 'notStrictEqual', + stackStartFn: notStrictEqual + }); + } +}; + +var Comparison = 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])) { + _this[key] = actual[key]; + } else { + _this[key] = obj[key]; + } + } + }); +}; + +function compareExceptionKey(actual, expected, key, message, keys, fn) { + if (!(key in actual) || !isDeepStrictEqual(actual[key], expected[key])) { + if (!message) { + // Create placeholder objects to create a nice output. + var a = new Comparison(actual, keys); + var b = new Comparison(expected, keys, actual); + var err = new AssertionError({ + actual: a, + expected: b, + operator: 'deepStrictEqual', + stackStartFn: fn + }); + err.actual = actual; + err.expected = expected; + err.operator = fn.name; + throw err; + } + + innerFail({ + actual: actual, + expected: expected, + message: message, + operator: fn.name, + stackStartFn: fn + }); + } +} + +function expectedException(actual, expected, msg, fn) { + if (typeof expected !== 'function') { + if (isRegExp(expected)) return expected.test(actual); // assert.doesNotThrow does not accept objects. + + if (arguments.length === 2) { + throw new ERR_INVALID_ARG_TYPE('expected', ['Function', 'RegExp'], expected); + } // Handle primitives properly. + + + if (_typeof(actual) !== 'object' || actual === null) { + var err = new AssertionError({ + actual: actual, + expected: expected, + message: msg, + operator: 'deepStrictEqual', + stackStartFn: fn + }); + err.operator = fn.name; + throw err; + } + + var keys = Object.keys(expected); // Special handle errors to make sure the name and the message are compared + // as well. + + if (expected instanceof Error) { + keys.push('name', 'message'); + } else if (keys.length === 0) { + throw new ERR_INVALID_ARG_VALUE('error', expected, 'may not be an empty object'); + } + + if (isDeepEqual === undefined) lazyLoadComparison(); + keys.forEach(function (key) { + if (typeof actual[key] === 'string' && isRegExp(expected[key]) && expected[key].test(actual[key])) { + return; + } + + compareExceptionKey(actual, expected, key, msg, keys, fn); + }); + return true; + } // 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) { + if (typeof fn !== 'function') { + throw new ERR_INVALID_ARG_TYPE('fn', 'Function', fn); + } + + try { + fn(); + } catch (e) { + return e; + } + + return NO_EXCEPTION_SENTINEL; +} + +function checkIsPromise(obj) { + // Accept native ES6 promises and promises that are implemented in a similar + // way. Do not accept thenables that use a function as `obj` and that have no + // `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. + + if (!checkIsPromise(resultPromise)) { + throw new ERR_INVALID_RETURN_VALUE('instance of Promise', 'promiseFn', resultPromise); + } + } else if (checkIsPromise(promiseFn)) { + resultPromise = promiseFn; + } else { + throw new ERR_INVALID_ARG_TYPE('promiseFn', ['Function', 'Promise'], promiseFn); + } + + return Promise.resolve().then(function () { + return resultPromise; + }).then(function () { + return NO_EXCEPTION_SENTINEL; + }).catch(function (e) { + return e; + }); + }); +} + +function expectsError(stackStartFn, actual, error, message) { + if (typeof error === 'string') { + if (arguments.length === 4) { + throw new ERR_INVALID_ARG_TYPE('error', ['Object', 'Error', 'Function', 'RegExp'], error); + } + + if (_typeof(actual) === 'object' && actual !== null) { + if (actual.message === error) { + throw new ERR_AMBIGUOUS_ARGUMENT('error/message', "The error message \"".concat(actual.message, "\" is identical to the message.")); + } + } else if (actual === error) { + throw new ERR_AMBIGUOUS_ARGUMENT('error/message', "The error \"".concat(actual, "\" is identical to the message.")); + } + + message = error; + error = undefined; + } else if (error != null && _typeof(error) !== 'object' && typeof error !== 'function') { + throw new ERR_INVALID_ARG_TYPE('error', ['Object', 'Error', 'Function', 'RegExp'], error); + } + + if (actual === NO_EXCEPTION_SENTINEL) { + var details = ''; + + if (error && error.name) { + details += " (".concat(error.name, ")"); + } + + details += message ? ": ".concat(message) : '.'; + var fnType = stackStartFn.name === 'rejects' ? 'rejection' : 'exception'; + innerFail({ + actual: undefined, + expected: error, + operator: stackStartFn.name, + message: "Missing expected ".concat(fnType).concat(details), + stackStartFn: stackStartFn + }); + } + + if (error && !expectedException(actual, error, message, stackStartFn)) { + throw actual; + } +} + +function expectsNoError(stackStartFn, actual, error, message) { + if (actual === NO_EXCEPTION_SENTINEL) return; + + if (typeof error === 'string') { + message = error; + error = undefined; + } + + if (!error || expectedException(actual, error)) { + var details = message ? ": ".concat(message) : '.'; + var fnType = stackStartFn.name === 'doesNotReject' ? 'rejection' : 'exception'; + innerFail({ + actual: actual, + expected: error, + operator: stackStartFn.name, + message: "Got unwanted ".concat(fnType).concat(details, "\n") + "Actual message: \"".concat(actual && actual.message, "\""), + stackStartFn: stackStartFn + }); + } + + throw actual; +} + +assert.throws = function throws(promiseFn) { + for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) { + args[_key2 - 1] = arguments[_key2]; + } + + expectsError.apply(void 0, [throws, getActual(promiseFn)].concat(args)); +}; + +assert.rejects = function rejects(promiseFn) { + for (var _len3 = arguments.length, args = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) { + args[_key3 - 1] = arguments[_key3]; + } + + return waitForActual(promiseFn).then(function (result) { + return expectsError.apply(void 0, [rejects, result].concat(args)); + }); +}; + +assert.doesNotThrow = function doesNotThrow(fn) { + for (var _len4 = arguments.length, args = new Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++) { + args[_key4 - 1] = arguments[_key4]; + } + + expectsNoError.apply(void 0, [doesNotThrow, getActual(fn)].concat(args)); +}; + +assert.doesNotReject = function doesNotReject(fn) { + for (var _len5 = arguments.length, args = new Array(_len5 > 1 ? _len5 - 1 : 0), _key5 = 1; _key5 < _len5; _key5++) { + args[_key5 - 1] = arguments[_key5]; + } + + return waitForActual(fn).then(function (result) { + 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') { + if (err.message.length === 0 && err.constructor) { + message += err.constructor.name; + } else { + message += err.message; + } + } else { + message += inspect(err); + } + + var newErr = new AssertionError({ + actual: err, + expected: null, + operator: 'ifError', + message: message, + stackStartFn: ifError + }); // Make sure we actually have a stack trace! + + var origStack = err.stack; + + if (typeof origStack === 'string') { + // This will remove any duplicated frames from the error frames taken + // from within `ifError` and add the original error frames to the newly + // created ones. + var tmp2 = origStack.split('\n'); + 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) { + // Only keep new frames. + tmp1 = tmp1.slice(0, pos); + break; + } + } + + newErr.stack = "".concat(tmp1.join('\n'), "\n").concat(tmp2.join('\n')); + } + + throw newErr; + } +}; // Expose a strict only variant of assert + + +function strict() { + for (var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) { + args[_key6] = arguments[_key6]; + } + + innerOk.apply(void 0, [strict, args.length].concat(args)); +} + +assert.strict = objectAssign(strict, assert, { + equal: assert.strictEqual, + deepEqual: assert.deepStrictEqual, + notEqual: assert.notStrictEqual, + notDeepEqual: assert.notDeepStrictEqual +}); +assert.strict.strict = assert.strict; \ No newline at end of file diff --git a/src/node_modules/assert/build/internal/assert/assertion_error.js b/src/node_modules/assert/build/internal/assert/assertion_error.js new file mode 100644 index 0000000..9295f0a --- /dev/null +++ b/src/node_modules/assert/build/internal/assert/assertion_error.js @@ -0,0 +1,501 @@ +// 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 _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 _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 _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); } + +var _require = require('util/'), + 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 + + +function endsWith(str, search, this_len) { + if (this_len === undefined || this_len > str.length) { + 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 + + +function repeat(str, count) { + count = Math.floor(count); + if (str.length == 0 || count == 0) return ''; + var maxCount = str.length * count; + count = Math.floor(Math.log(count) / Math.log(2)); + + while (count) { + str += str; + count--; + } + + str += str.substring(0, maxCount - str.length); + return str; +} + +var blue = ''; +var green = ''; +var red = ''; +var white = ''; +var kReadableOperator = { + deepStrictEqual: 'Expected values to be strictly deep-equal:', + strictEqual: 'Expected values to be strictly equal:', + strictEqualObject: 'Expected "actual" to be reference-equal to "expected":', + deepEqual: 'Expected values to be loosely deep-equal:', + equal: 'Expected values to be loosely equal:', + notDeepStrictEqual: 'Expected "actual" not to be strictly deep-equal to:', + notStrictEqual: 'Expected "actual" to be strictly unequal to:', + notStrictEqualObject: 'Expected "actual" not to be reference-equal to "expected":', + notDeepEqual: 'Expected "actual" not to be loosely deep-equal to:', + notEqual: 'Expected "actual" to be loosely unequal to:', + notIdentical: 'Values identical but not reference-equal:' +}; // Comparing short primitives should just show === / !== instead of using the +// diff. + +var kMaxShortLength = 10; + +function copyError(source) { + var keys = Object.keys(source); + var target = Object.create(Object.getPrototypeOf(source)); + keys.forEach(function (key) { + target[key] = source[key]; + }); + Object.defineProperty(target, 'message', { + value: source.message + }); + return target; +} + +function inspectValue(val) { + // The util.inspect default values could be changed. This makes sure the + // error messages contain the necessary information nevertheless. + return inspect(val, { + compact: false, + customInspect: false, + depth: 1000, + maxArrayLength: Infinity, + // Assert compares only enumerable properties (with a few exceptions). + showHidden: false, + // Having a long line as error is better than wrapping the line for + // comparison for now. + // TODO(BridgeAR): `breakLength` should be limited as soon as soon as we + // have meta information about the inspected properties (i.e., know where + // in what line the property starts and ends). + breakLength: Infinity, + // Assert does not detect proxies currently. + showProxy: false, + sorted: true, + // Inspect getters as we also check them when comparing entries. + getters: true + }); +} + +function createErrDiff(actual, expected, operator) { + var other = ''; + var res = ''; + var lastPos = 0; + var end = ''; + var skipped = false; + var actualInspected = inspectValue(actual); + var actualLines = actualInspected.split('\n'); + var expectedLines = inspectValue(expected).split('\n'); + var i = 0; + 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 + // 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 + // 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) { + if ((_typeof(actual) !== 'object' || actual === null) && (_typeof(expected) !== 'object' || expected === null) && (actual !== 0 || expected !== 0)) { + // -0 === +0 + return "".concat(kReadableOperator[operator], "\n\n") + "".concat(actualLines[0], " !== ").concat(expectedLines[0], "\n"); + } + } else if (operator !== 'strictEqualObject') { + // If the stderr is a tty and the input length is lower than the current + // columns per line, add a mismatch indicator below the output. If it is + // not a tty, use a default value of 80 characters. + 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. + + + if (i > 2) { + // Add position indicator for the first mismatch in case it is a + // single line and the input length is less than the column length. + indicator = "\n ".concat(repeat(' ', i), "^"); + i = 0; + } + } + } + } // 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) { + if (i++ < 2) { + end = "\n ".concat(a).concat(end); + } else { + other = a; + } + + actualLines.pop(); + expectedLines.pop(); + if (actualLines.length === 0 || expectedLines.length === 0) break; + a = actualLines[actualLines.length - 1]; + b = expectedLines[expectedLines.length - 1]; + } + + 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. + // TODO: Accept env to always show the full error. + + + if (_actualLines.length > 30) { + _actualLines[26] = "".concat(blue, "...").concat(white); + + while (_actualLines.length > 27) { + _actualLines.pop(); + } + } + + return "".concat(kReadableOperator.notIdentical, "\n\n").concat(_actualLines.join('\n'), "\n"); + } + + if (i > 3) { + end = "\n".concat(blue, "...").concat(white).concat(end); + skipped = true; + } + + if (other !== '') { + end = "\n ".concat(other).concat(end); + other = ''; + } + + 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) { + // If the last diverging line is more than one line above and the + // current line is at least line three, add some of the former lines and + // also add dots to indicate skipped entries. + if (cur > 1 && i > 2) { + if (cur > 4) { + res += "\n".concat(blue, "...").concat(white); + skipped = true; + } else if (cur > 3) { + res += "\n ".concat(expectedLines[i - 2]); + printedLines++; + } + + 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. + + other += "\n".concat(red, "-").concat(white, " ").concat(expectedLines[i]); + printedLines++; // Only extra actual lines exist + } else if (expectedLines.length < i + 1) { + // If the last diverging line is more than one line above and the + // current line is at least line three, add some of the former lines and + // also add dots to indicate skipped entries. + if (cur > 1 && i > 2) { + if (cur > 4) { + res += "\n".concat(blue, "...").concat(white); + skipped = true; + } else if (cur > 3) { + res += "\n ".concat(actualLines[i - 2]); + printedLines++; + } + + 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. + + res += "\n".concat(green, "+").concat(white, " ").concat(actualLines[i]); + printedLines++; // Lines diverge + } else { + var expectedLine = expectedLines[i]; + 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, + // add a comma at the end of the actual line. Otherwise the output could + // look weird as in: + // + // [ + // 1 // No comma at the end! + // + 2 + // ] + // + + if (divergingLines && endsWith(expectedLine, ',') && expectedLine.slice(0, -1) === actualLine) { + divergingLines = false; + actualLine += ','; + } + + if (divergingLines) { + // If the last diverging line is more than one line above and the + // current line is at least line three, add some of the former lines and + // also add dots to indicate skipped entries. + if (cur > 1 && i > 2) { + if (cur > 4) { + res += "\n".concat(blue, "...").concat(white); + skipped = true; + } else if (cur > 3) { + res += "\n ".concat(actualLines[i - 2]); + printedLines++; + } + + 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 + // 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 + } else { + // Add all cached information to the result before adding other things + // and reset the cache. + res += other; + 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) { + res += "\n ".concat(actualLine); + printedLines++; + } + } + } // Inspected object to big (Show ~20 rows max) + + + if (printedLines > 20 && i < maxLines - 2) { + 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) { + _inherits(AssertionError, _Error); + + 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; + var actual = options.actual, + expected = options.expected; + var limit = Error.stackTraceLimit; + Error.stackTraceLimit = 0; + + if (message != null) { + _this = _possibleConstructorReturn(this, _getPrototypeOf(AssertionError).call(this, String(message))); + } else { + if (process.stderr && process.stderr.isTTY) { + // Reset on each call to make sure we handle dynamically set environment + // variables correct. + if (process.stderr && process.stderr.getColorDepth && process.stderr.getColorDepth() !== 1) { + blue = "\x1B[34m"; + green = "\x1B[32m"; + white = "\x1B[39m"; + red = "\x1B[31m"; + } else { + blue = ''; + green = ''; + white = ''; + red = ''; + } + } // 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) { + actual = copyError(actual); + expected = copyError(expected); + } + + if (operator === 'deepStrictEqual' || operator === 'strictEqual') { + _this = _possibleConstructorReturn(this, _getPrototypeOf(AssertionError).call(this, createErrDiff(actual, expected, operator))); + } else if (operator === 'notDeepStrictEqual' || operator === 'notStrictEqual') { + // In case the objects are equal but the operator requires unequal, show + // the first object and say A equals B + var base = kReadableOperator[operator]; + 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. + // 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. + + + if (res.length === 1) { + _this = _possibleConstructorReturn(this, _getPrototypeOf(AssertionError).call(this, "".concat(base, " ").concat(res[0]))); + } else { + _this = _possibleConstructorReturn(this, _getPrototypeOf(AssertionError).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) { + _res = "".concat(_res.slice(0, 1021), "..."); + } + } else { + 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') { + _res = "".concat(knownOperators, "\n\n").concat(_res, "\n\nshould equal\n\n"); + } else { + other = " ".concat(operator, " ").concat(other); + } + } + + _this = _possibleConstructorReturn(this, _getPrototypeOf(AssertionError).call(this, "".concat(_res).concat(other))); + } + } + + Error.stackTraceLimit = limit; + _this.generatedMessage = !message; + Object.defineProperty(_assertThisInitialized(_this), 'name', { + value: 'AssertionError [ERR_ASSERTION]', + enumerable: false, + writable: true, + configurable: true + }); + _this.code = 'ERR_ASSERTION'; + _this.actual = actual; + _this.expected = expected; + _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. + + _this.name = 'AssertionError'; + return _possibleConstructorReturn(_this); + } + + _createClass(AssertionError, [{ + key: "toString", + value: function toString() { + return "".concat(this.name, " [").concat(this.code, "]: ").concat(this.message); + } + }, { + key: inspect.custom, + value: function value(recurseTimes, ctx) { + // This limits the `actual` and `expected` property default inspection to + // the minimum depth. Otherwise those values would be too verbose compared + // to the actual error message which contains a combined view of these two + // input values. + return inspect(this, _objectSpread({}, ctx, { + customInspect: false, + depth: 0 + })); + } + }]); + + return AssertionError; +}(_wrapNativeSuper(Error)); + +module.exports = AssertionError; \ No newline at end of file diff --git a/src/node_modules/assert/build/internal/errors.js b/src/node_modules/assert/build/internal/errors.js new file mode 100644 index 0000000..3f4350a --- /dev/null +++ b/src/node_modules/assert/build/internal/errors.js @@ -0,0 +1,195 @@ +// Currently in sync with Node.js lib/internal/errors.js +// https://github.com/nodejs/node/commit/3b044962c48fe313905877a96b5d0894a5404f6f + +/* eslint node-core/documented-errors: "error" */ + +/* eslint node-core/alphabetize-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 +// longer be forced to treat every error message change as a semver-major +// change. The NodeError classes here all expose a `code` property whose +// value statically and permanently identifies the error. While the error +// 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 _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 _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } + +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 + +var assert; +var util; + +function createErrorType(code, message, Base) { + if (!Base) { + Base = Error; + } + + function getMessage(arg1, arg2, arg3) { + if (typeof message === 'string') { + return message; + } else { + return message(arg1, arg2, arg3); + } + } + + var NodeError = + /*#__PURE__*/ + function (_Base) { + _inherits(NodeError, _Base); + + function NodeError(arg1, arg2, arg3) { + var _this; + + _classCallCheck(this, NodeError); + + _this = _possibleConstructorReturn(this, _getPrototypeOf(NodeError).call(this, getMessage(arg1, arg2, arg3))); + _this.code = code; + return _this; + } + + return NodeError; + }(Base); + + codes[code] = NodeError; +} // https://github.com/nodejs/node/blob/v10.8.0/lib/internal/errors.js + + +function oneOf(expected, thing) { + if (Array.isArray(expected)) { + var len = expected.length; + expected = expected.map(function (i) { + return String(i); + }); + + if (len > 2) { + return "one of ".concat(thing, " ").concat(expected.slice(0, len - 1).join(', '), ", or ") + expected[len - 1]; + } else if (len === 2) { + return "one of ".concat(thing, " ").concat(expected[0], " or ").concat(expected[1]); + } else { + return "of ".concat(thing, " ").concat(expected[0]); + } + } else { + return "of ".concat(thing, " ").concat(String(expected)); + } +} // 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 + + +function endsWith(str, search, this_len) { + if (this_len === undefined || this_len > str.length) { + 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 + + +function includes(str, search, start) { + if (typeof start !== 'number') { + start = 0; + } + + if (start + search.length > str.length) { + return false; + } else { + return str.indexOf(search, start) !== -1; + } +} + +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' + + var determiner; + + if (typeof expected === 'string' && startsWith(expected, 'not ')) { + determiner = 'must not be'; + expected = expected.replace(/^not /, ''); + } else { + determiner = 'must be'; + } + + var msg; + + if (endsWith(name, ' argument')) { + // For cases like 'first argument' + msg = "The ".concat(name, " ").concat(determiner, " ").concat(oneOf(expected, 'type')); + } else { + var type = includes(name, '.') ? 'property' : 'argument'; + msg = "The \"".concat(name, "\" ").concat(type, " ").concat(determiner, " ").concat(oneOf(expected, 'type')); + } // TODO(BridgeAR): Improve the output by showing `null` and similar. + + + msg += ". Received type ".concat(_typeof(actual)); + return msg; +}, TypeError); +createErrorType('ERR_INVALID_ARG_VALUE', function (name, value) { + var reason = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'is invalid'; + if (util === undefined) util = require('util/'); + 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); +}, TypeError, RangeError); +createErrorType('ERR_INVALID_RETURN_VALUE', function (input, name, value) { + var type; + + if (value && value.constructor && value.constructor.name) { + type = "instance of ".concat(value.constructor.name); + } else { + type = "type ".concat(_typeof(value)); + } + + return "Expected ".concat(input, " to be returned from the \"").concat(name, "\"") + " function but got ".concat(type, "."); +}, TypeError); +createErrorType('ERR_MISSING_ARGS', function () { + for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + if (assert === undefined) assert = require('../assert'); + assert(args.length > 0, 'At least one arg needs to be specified'); + var msg = 'The '; + var len = args.length; + args = args.map(function (a) { + return "\"".concat(a, "\""); + }); + + switch (len) { + case 1: + msg += "".concat(args[0], " argument"); + break; + + case 2: + msg += "".concat(args[0], " and ").concat(args[1], " arguments"); + break; + + default: + msg += args.slice(0, len - 1).join(', '); + msg += ", and ".concat(args[len - 1], " arguments"); + break; + } + + return "".concat(msg, " must be specified"); +}, TypeError); +module.exports.codes = codes; \ No newline at end of file diff --git a/src/node_modules/assert/build/internal/util/comparisons.js b/src/node_modules/assert/build/internal/util/comparisons.js new file mode 100644 index 0000000..31d43ff --- /dev/null +++ b/src/node_modules/assert/build/internal/util/comparisons.js @@ -0,0 +1,688 @@ +// 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 _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); } + +var regexFlagsSupported = /a/g.flags !== undefined; + +var arrayFromSet = function arrayFromSet(set) { + var array = []; + set.forEach(function (value) { + return array.push(value); + }); + return array; +}; + +var arrayFromMap = function arrayFromMap(map) { + var array = []; + map.forEach(function (value, key) { + return array.push([key, value]); + }); + return array; +}; + +var objectIs = Object.is ? Object.is : require('object-is'); +var objectGetOwnPropertySymbols = Object.getOwnPropertySymbols ? Object.getOwnPropertySymbols : function () { + return []; +}; +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; + +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. + + + 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 +// original notice: + +/*! + * The buffer module from node.js, for the browser. + * + * @author Feross Aboukhadijeh + * @license MIT + */ + + +function compare(a, b) { + if (a === b) { + return 0; + } + + var x = a.length; + var y = b.length; + + for (var i = 0, len = Math.min(x, y); i < len; ++i) { + if (a[i] !== b[i]) { + x = a[i]; + y = b[i]; + break; + } + } + + if (x < y) { + return -1; + } + + if (y < x) { + return 1; + } + + return 0; +} + +var ONLY_ENUMERABLE = undefined; +var kStrict = true; +var kLoose = false; +var kNoIterator = 0; +var kIsArray = 1; +var kIsSet = 2; +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) { + if (a.byteLength !== b.byteLength) { + return false; + } + + for (var offset = 0; offset < a.byteLength; offset++) { + if (a[offset] !== b[offset]) { + return false; + } + } + + return true; +} + +function areSimilarTypedArrays(a, b) { + if (a.byteLength !== b.byteLength) { + return false; + } + + 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) { + if (isNumberObject(val1)) { + return isNumberObject(val2) && objectIs(Number.prototype.valueOf.call(val1), Number.prototype.valueOf.call(val2)); + } + + 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); +} // Notes: Type tags are historical [[Class]] properties that can be set by +// FunctionTemplate::SetClassName() in C++ or Symbol.toStringTag in JS +// and retrieved using Object.prototype.toString.call(obj) in JS +// See https://tc39.github.io/ecma262/#sec-object.prototype.tostring +// for a list of tags pre-defined in the spec. +// There are some unspecified tags in the wild too (e.g. typed array tags). +// Since tags can be altered, they only serve fast failures +// +// Typed arrays and buffers are checked by comparing the content in their +// underlying ArrayBuffer. This optimization requires that it's +// reasonable to interpret their underlying memory in the same way, +// which is checked by comparing their type tags. +// (e.g. a Uint8Array and a Uint16Array with the same memory content +// could still be different because they will be interpreted differently). +// +// For strict comparison, objects should have +// a) The same built-in type tags +// b) The same prototypes. + + +function innerDeepEqual(val1, val2, strict, memos) { + // All identical values are equivalent, as determined by ===. + if (val1 === val2) { + if (val1 !== 0) return true; + return strict ? objectIs(val1, val2) : true; + } // Check more closely if val1 and val2 are equal. + + + if (strict) { + if (_typeof(val1) !== 'object') { + return typeof val1 === 'number' && numberIsNaN(val1) && numberIsNaN(val2); + } + + if (_typeof(val2) !== 'object' || val1 === null || val2 === null) { + return false; + } + + if (Object.getPrototypeOf(val1) !== Object.getPrototypeOf(val2)) { + return false; + } + } else { + if (val1 === null || _typeof(val1) !== 'object') { + if (val2 === null || _typeof(val2) !== 'object') { + // eslint-disable-next-line eqeqeq + return val1 == val2; + } + + return false; + } + + if (val2 === null || _typeof(val2) !== 'object') { + return false; + } + } + + var val1Tag = objectToString(val1); + var val2Tag = objectToString(val2); + + if (val1Tag !== val2Tag) { + return false; + } + + if (Array.isArray(val1)) { + // Check for sparse arrays and general fast path + if (val1.length !== val2.length) { + return false; + } + + 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 + // 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]') { + // return keyCheck(val1, val2, strict, memos, kNoIterator); + if (!isMap(val1) && isMap(val2) || !isSet(val1) && isSet(val2)) { + return false; + } + } + + if (isDate(val1)) { + if (!isDate(val2) || Date.prototype.getTime.call(val1) !== Date.prototype.getTime.call(val2)) { + return false; + } + } else if (isRegExp(val1)) { + if (!isRegExp(val2) || !areSimilarRegExps(val1, val2)) { + return false; + } + } else if (isNativeError(val1) || val1 instanceof Error) { + // Do not compare the stack as it might differ even though the error itself + // is otherwise identical. + if (val1.message !== val2.message || val1.name !== val2.name) { + return false; + } + } else if (isArrayBufferView(val1)) { + if (!strict && (isFloat32Array(val1) || isFloat64Array(val1))) { + if (!areSimilarFloatArrays(val1, val2)) { + return false; + } + } else if (!areSimilarTypedArrays(val1, val2)) { + return false; + } // 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); + } else if (isSet(val1)) { + if (!isSet(val2) || val1.size !== val2.size) { + return false; + } + + return keyCheck(val1, val2, strict, memos, kIsSet); + } else if (isMap(val1)) { + if (!isMap(val2) || val1.size !== val2.size) { + return false; + } + + return keyCheck(val1, val2, strict, memos, kIsMap); + } else if (isAnyArrayBuffer(val1)) { + if (!areEqualArrayBuffers(val1, val2)) { + return false; + } + } else if (isBoxedPrimitive(val1) && !isEqualBoxedPrimitive(val1, val2)) { + return false; + } + + return keyCheck(val1, val2, strict, memos, kNoIterator); +} + +function getEnumerables(val, keys) { + return keys.filter(function (k) { + return propertyIsEnumerable(val, k); + }); +} + +function keyCheck(val1, val2, strict, memos, iterationType, aKeys) { + // For all remaining Object pairs, including Array, objects and Maps, + // equivalence is determined by having: + // a) The same number of owned enumerable properties + // b) The same set of keys/indexes (although not necessarily the same order) + // c) Equivalent values for every corresponding key/index + // d) For Sets and Maps, equal contents + // Note: this accounts for both named and indexed properties on Arrays. + if (arguments.length === 5) { + aKeys = Object.keys(val1); + 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 + + + var i = 0; + + for (; i < aKeys.length; i++) { + if (!hasOwnProperty(val2, aKeys[i])) { + return false; + } + } + + 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)) { + if (!propertyIsEnumerable(val2, key)) { + return false; + } + + aKeys.push(key); + count++; + } else if (propertyIsEnumerable(val2, key)) { + return false; + } + } + + var symbolKeysB = objectGetOwnPropertySymbols(val2); + + if (symbolKeysA.length !== symbolKeysB.length && getEnumerables(val2, symbolKeysB).length !== count) { + return false; + } + } else { + var _symbolKeysB = objectGetOwnPropertySymbols(val2); + + if (_symbolKeysB.length !== 0 && getEnumerables(val2, _symbolKeysB).length !== 0) { + return false; + } + } + } + + if (aKeys.length === 0 && (iterationType === kNoIterator || iterationType === kIsArray && val1.length === 0 || val1.size === 0)) { + return true; + } // Use memos to handle cycles. + + + if (memos === undefined) { + memos = { + val1: new Map(), + val2: new Map(), + position: 0 + }; + } else { + // We prevent up to two map.has(x) calls by directly retrieving the value + // and checking for undefined. The map can only contain numbers, so it is + // safe to check for undefined only. + var val2MemoA = memos.val1.get(val1); + + if (val2MemoA !== undefined) { + var val2MemoB = memos.val2.get(val2); + + if (val2MemoB !== undefined) { + return val2MemoA === val2MemoB; + } + } + + memos.position++; + } + + memos.val1.set(val1, memos.position); + memos.val2.set(val2, memos.position); + var areEq = objEquiv(val1, val2, strict, aKeys, memos, iterationType); + memos.val1.delete(val1); + memos.val2.delete(val2); + return areEq; +} + +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)) { + // Remove the matching element to make sure we do not check that again. + set.delete(val2); + return true; + } + } + + return false; +} // 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) { + switch (_typeof(prim)) { + case 'undefined': + return null; + + case 'object': + // Only pass in null as object! + return undefined; + + case 'symbol': + return false; + + case 'string': + prim = +prim; + // Loose equal entries exist only if the string is possible to convert to + // a regular number and not NaN. + // Fall through + + case 'number': + if (numberIsNaN(prim)) { + return false; + } + + } + + return true; +} + +function setMightHaveLoosePrim(a, b, prim) { + var altValue = findLooseMatchingPrimitives(prim); + if (altValue != null) return altValue; + return b.has(altValue) && !a.has(altValue); +} + +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) { + // This is a lazily initiated Set of entries which have to be compared + // pairwise. + var set = null; + 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 + // 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 + // 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 (!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 + // matching and only if it's not, go hunting for it. + + if (_typeof(_val) === 'object' && _val !== null) { + if (!setHasEqualElement(set, _val, strict, memo)) return false; + } else if (!strict && !a.has(_val) && !setHasEqualElement(set, _val, strict, memo)) { + return false; + } + } + + return set.size === 0; + } + + return true; +} + +function mapHasEqualEntry(set, map, key1, item1, strict, memo) { + // To be able to handle cases like: + // Map([[{}, 'a'], [{}, 'b']]) vs Map([[{}, 'b'], [{}, 'a']]) + // ... we need to consider *all* matching keys, not just the first we find. + 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)) { + set.delete(key2); + return true; + } + } + + 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]; + + if (_typeof(key) === 'object' && key !== null) { + if (set === null) { + set = new Set(); + } + + set.add(key); + } else { + // By directly retrieving the value we prevent another b.has(key) check in + // almost all possible cases. + 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 + // keys. + + if (!mapMightHaveLoosePrim(a, b, key, item1, memo)) return false; + + if (set === null) { + set = new Set(); + } + + set.add(key); + } + } + } + + 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)) { + return false; + } + } + + return set.size === 0; + } + + return true; +} + +function objEquiv(a, b, strict, keys, memos, iterationType) { + // Sets and maps don't have their entries accessible via normal object + // properties. + var i = 0; + + if (iterationType === kIsSet) { + if (!setEquiv(a, b, strict, memos)) { + return false; + } + } else if (iterationType === kIsMap) { + if (!mapEquiv(a, b, strict, memos)) { + return false; + } + } else if (iterationType === kIsArray) { + for (; i < a.length; i++) { + if (hasOwnProperty(a, i)) { + if (!hasOwnProperty(b, i) || !innerDeepEqual(a[i], b[i], strict, memos)) { + return false; + } + } else if (hasOwnProperty(b, i)) { + return false; + } else { + // Array is sparse. + 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)) { + return false; + } + } + + if (keysA.length !== Object.keys(b).length) { + return false; + } + + return true; + } + } + } // 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)) { + return false; + } + } + + return true; +} + +function isDeepEqual(val1, val2) { + return innerDeepEqual(val1, val2, kLoose); +} + +function isDeepStrictEqual(val1, val2) { + return innerDeepEqual(val1, val2, kStrict); +} + +module.exports = { + isDeepEqual: isDeepEqual, + isDeepStrictEqual: isDeepStrictEqual +}; \ No newline at end of file diff --git a/src/node_modules/assert/package.json b/src/node_modules/assert/package.json new file mode 100644 index 0000000..7d395d1 --- /dev/null +++ b/src/node_modules/assert/package.json @@ -0,0 +1,45 @@ +{ + "name": "assert", + "version": "2.0.0", + "description": "The assert module from Node.js, for the browser.", + "main": "build/assert.js", + "files": [ + "build/assert.js", + "build/internal" + ], + "license": "MIT", + "homepage": "https://github.com/browserify/commonjs-assert", + "repository": "browserify/commonjs-assert", + "scripts": { + "build": "babel assert.js test.js --out-dir build && babel internal --out-dir build/internal && babel test --out-dir build/test", + "prepare": "npm run build", + "dev": "babel assert.js test.js --watch --out-dir build & babel internal --watch --out-dir build/internal & babel test --watch --out-dir build/test", + "test": "npm run build && npm run test:nobuild", + "test:nobuild": "node build/test.js", + "test:source": "node test.js", + "test:browsers": "airtap build/test.js", + "test:browsers:local": "npm run test:browsers -- --local" + }, + "keywords": [ + "assert", + "browser" + ], + "devDependencies": { + "@babel/cli": "^7.4.4", + "@babel/core": "^7.4.4", + "@babel/preset-env": "^7.4.4", + "airtap": "^2.0.2", + "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" + }, + "dependencies": { + "es6-object-assign": "^1.1.0", + "is-nan": "^1.2.1", + "object-is": "^1.0.1", + "util": "^0.12.0" + } +} -- cgit