@noma.to/qwik-mock 0.0.0-semantically-released

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (92) hide show
  1. package/README.md +8 -0
  2. package/lib/index.qwik.cjs +6 -0
  3. package/lib/index.qwik.mjs +6 -0
  4. package/lib/lib/qwik-mock.qwik.cjs +14 -0
  5. package/lib/lib/qwik-mock.qwik.mjs +14 -0
  6. package/lib/node_modules/.pnpm/@jridgewell_sourcemap-codec@1.5.0/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.qwik.cjs +89 -0
  7. package/lib/node_modules/.pnpm/@jridgewell_sourcemap-codec@1.5.0/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.qwik.mjs +89 -0
  8. package/lib/node_modules/.pnpm/@vitest_expect@3.0.9/node_modules/@vitest/expect/dist/index.qwik.cjs +2190 -0
  9. package/lib/node_modules/.pnpm/@vitest_expect@3.0.9/node_modules/@vitest/expect/dist/index.qwik.mjs +2190 -0
  10. package/lib/node_modules/.pnpm/@vitest_pretty-format@3.0.9/node_modules/@vitest/pretty-format/dist/index.qwik.cjs +1499 -0
  11. package/lib/node_modules/.pnpm/@vitest_pretty-format@3.0.9/node_modules/@vitest/pretty-format/dist/index.qwik.mjs +1499 -0
  12. package/lib/node_modules/.pnpm/@vitest_runner@3.0.9/node_modules/@vitest/runner/dist/chunk-tasks.qwik.cjs +44 -0
  13. package/lib/node_modules/.pnpm/@vitest_runner@3.0.9/node_modules/@vitest/runner/dist/chunk-tasks.qwik.mjs +44 -0
  14. package/lib/node_modules/.pnpm/@vitest_runner@3.0.9/node_modules/@vitest/runner/dist/index.qwik.cjs +767 -0
  15. package/lib/node_modules/.pnpm/@vitest_runner@3.0.9/node_modules/@vitest/runner/dist/index.qwik.mjs +767 -0
  16. package/lib/node_modules/.pnpm/@vitest_snapshot@3.0.9/node_modules/@vitest/snapshot/dist/index.qwik.cjs +2149 -0
  17. package/lib/node_modules/.pnpm/@vitest_snapshot@3.0.9/node_modules/@vitest/snapshot/dist/index.qwik.mjs +2149 -0
  18. package/lib/node_modules/.pnpm/@vitest_spy@3.0.9/node_modules/@vitest/spy/dist/index.qwik.cjs +147 -0
  19. package/lib/node_modules/.pnpm/@vitest_spy@3.0.9/node_modules/@vitest/spy/dist/index.qwik.mjs +147 -0
  20. package/lib/node_modules/.pnpm/@vitest_utils@3.0.9/node_modules/@vitest/utils/dist/chunk-_commonjsHelpers.qwik.cjs +165 -0
  21. package/lib/node_modules/.pnpm/@vitest_utils@3.0.9/node_modules/@vitest/utils/dist/chunk-_commonjsHelpers.qwik.mjs +165 -0
  22. package/lib/node_modules/.pnpm/@vitest_utils@3.0.9/node_modules/@vitest/utils/dist/diff.qwik.cjs +1755 -0
  23. package/lib/node_modules/.pnpm/@vitest_utils@3.0.9/node_modules/@vitest/utils/dist/diff.qwik.mjs +1755 -0
  24. package/lib/node_modules/.pnpm/@vitest_utils@3.0.9/node_modules/@vitest/utils/dist/error.qwik.cjs +137 -0
  25. package/lib/node_modules/.pnpm/@vitest_utils@3.0.9/node_modules/@vitest/utils/dist/error.qwik.mjs +137 -0
  26. package/lib/node_modules/.pnpm/@vitest_utils@3.0.9/node_modules/@vitest/utils/dist/helpers.qwik.cjs +150 -0
  27. package/lib/node_modules/.pnpm/@vitest_utils@3.0.9/node_modules/@vitest/utils/dist/helpers.qwik.mjs +150 -0
  28. package/lib/node_modules/.pnpm/@vitest_utils@3.0.9/node_modules/@vitest/utils/dist/index.qwik.cjs +474 -0
  29. package/lib/node_modules/.pnpm/@vitest_utils@3.0.9/node_modules/@vitest/utils/dist/index.qwik.mjs +474 -0
  30. package/lib/node_modules/.pnpm/@vitest_utils@3.0.9/node_modules/@vitest/utils/dist/source-map.qwik.cjs +218 -0
  31. package/lib/node_modules/.pnpm/@vitest_utils@3.0.9/node_modules/@vitest/utils/dist/source-map.qwik.mjs +218 -0
  32. package/lib/node_modules/.pnpm/chai@5.2.0/node_modules/chai/chai.qwik.cjs +4237 -0
  33. package/lib/node_modules/.pnpm/chai@5.2.0/node_modules/chai/chai.qwik.mjs +4237 -0
  34. package/lib/node_modules/.pnpm/loupe@3.1.3/node_modules/loupe/lib/arguments.qwik.cjs +9 -0
  35. package/lib/node_modules/.pnpm/loupe@3.1.3/node_modules/loupe/lib/arguments.qwik.mjs +10 -0
  36. package/lib/node_modules/.pnpm/loupe@3.1.3/node_modules/loupe/lib/array.qwik.cjs +16 -0
  37. package/lib/node_modules/.pnpm/loupe@3.1.3/node_modules/loupe/lib/array.qwik.mjs +17 -0
  38. package/lib/node_modules/.pnpm/loupe@3.1.3/node_modules/loupe/lib/bigint.qwik.cjs +9 -0
  39. package/lib/node_modules/.pnpm/loupe@3.1.3/node_modules/loupe/lib/bigint.qwik.mjs +10 -0
  40. package/lib/node_modules/.pnpm/loupe@3.1.3/node_modules/loupe/lib/class.qwik.cjs +16 -0
  41. package/lib/node_modules/.pnpm/loupe@3.1.3/node_modules/loupe/lib/class.qwik.mjs +17 -0
  42. package/lib/node_modules/.pnpm/loupe@3.1.3/node_modules/loupe/lib/date.qwik.cjs +12 -0
  43. package/lib/node_modules/.pnpm/loupe@3.1.3/node_modules/loupe/lib/date.qwik.mjs +13 -0
  44. package/lib/node_modules/.pnpm/loupe@3.1.3/node_modules/loupe/lib/error.qwik.cjs +36 -0
  45. package/lib/node_modules/.pnpm/loupe@3.1.3/node_modules/loupe/lib/error.qwik.mjs +37 -0
  46. package/lib/node_modules/.pnpm/loupe@3.1.3/node_modules/loupe/lib/function.qwik.cjs +11 -0
  47. package/lib/node_modules/.pnpm/loupe@3.1.3/node_modules/loupe/lib/function.qwik.mjs +12 -0
  48. package/lib/node_modules/.pnpm/loupe@3.1.3/node_modules/loupe/lib/helpers.qwik.cjs +160 -0
  49. package/lib/node_modules/.pnpm/loupe@3.1.3/node_modules/loupe/lib/helpers.qwik.mjs +160 -0
  50. package/lib/node_modules/.pnpm/loupe@3.1.3/node_modules/loupe/lib/html.qwik.cjs +36 -0
  51. package/lib/node_modules/.pnpm/loupe@3.1.3/node_modules/loupe/lib/html.qwik.mjs +36 -0
  52. package/lib/node_modules/.pnpm/loupe@3.1.3/node_modules/loupe/lib/index.qwik.cjs +130 -0
  53. package/lib/node_modules/.pnpm/loupe@3.1.3/node_modules/loupe/lib/index.qwik.mjs +130 -0
  54. package/lib/node_modules/.pnpm/loupe@3.1.3/node_modules/loupe/lib/map.qwik.cjs +23 -0
  55. package/lib/node_modules/.pnpm/loupe@3.1.3/node_modules/loupe/lib/map.qwik.mjs +24 -0
  56. package/lib/node_modules/.pnpm/loupe@3.1.3/node_modules/loupe/lib/number.qwik.cjs +19 -0
  57. package/lib/node_modules/.pnpm/loupe@3.1.3/node_modules/loupe/lib/number.qwik.mjs +20 -0
  58. package/lib/node_modules/.pnpm/loupe@3.1.3/node_modules/loupe/lib/object.qwik.cjs +24 -0
  59. package/lib/node_modules/.pnpm/loupe@3.1.3/node_modules/loupe/lib/object.qwik.mjs +25 -0
  60. package/lib/node_modules/.pnpm/loupe@3.1.3/node_modules/loupe/lib/promise.qwik.cjs +17 -0
  61. package/lib/node_modules/.pnpm/loupe@3.1.3/node_modules/loupe/lib/promise.qwik.mjs +18 -0
  62. package/lib/node_modules/.pnpm/loupe@3.1.3/node_modules/loupe/lib/regexp.qwik.cjs +9 -0
  63. package/lib/node_modules/.pnpm/loupe@3.1.3/node_modules/loupe/lib/regexp.qwik.mjs +10 -0
  64. package/lib/node_modules/.pnpm/loupe@3.1.3/node_modules/loupe/lib/set.qwik.cjs +16 -0
  65. package/lib/node_modules/.pnpm/loupe@3.1.3/node_modules/loupe/lib/set.qwik.mjs +17 -0
  66. package/lib/node_modules/.pnpm/loupe@3.1.3/node_modules/loupe/lib/string.qwik.cjs +23 -0
  67. package/lib/node_modules/.pnpm/loupe@3.1.3/node_modules/loupe/lib/string.qwik.mjs +24 -0
  68. package/lib/node_modules/.pnpm/loupe@3.1.3/node_modules/loupe/lib/symbol.qwik.cjs +8 -0
  69. package/lib/node_modules/.pnpm/loupe@3.1.3/node_modules/loupe/lib/symbol.qwik.mjs +9 -0
  70. package/lib/node_modules/.pnpm/loupe@3.1.3/node_modules/loupe/lib/typedarray.qwik.cjs +34 -0
  71. package/lib/node_modules/.pnpm/loupe@3.1.3/node_modules/loupe/lib/typedarray.qwik.mjs +35 -0
  72. package/lib/node_modules/.pnpm/magic-string@0.30.17/node_modules/magic-string/dist/magic-string.es.qwik.cjs +979 -0
  73. package/lib/node_modules/.pnpm/magic-string@0.30.17/node_modules/magic-string/dist/magic-string.es.qwik.mjs +979 -0
  74. package/lib/node_modules/.pnpm/pathe@2.0.3/node_modules/pathe/dist/shared/pathe.M-eThtNZ.qwik.cjs +101 -0
  75. package/lib/node_modules/.pnpm/pathe@2.0.3/node_modules/pathe/dist/shared/pathe.M-eThtNZ.qwik.mjs +101 -0
  76. package/lib/node_modules/.pnpm/tinyrainbow@2.0.0/node_modules/tinyrainbow/dist/browser.qwik.cjs +4 -0
  77. package/lib/node_modules/.pnpm/tinyrainbow@2.0.0/node_modules/tinyrainbow/dist/browser.qwik.mjs +5 -0
  78. package/lib/node_modules/.pnpm/tinyrainbow@2.0.0/node_modules/tinyrainbow/dist/chunk-BVHSVHOK.qwik.cjs +80 -0
  79. package/lib/node_modules/.pnpm/tinyrainbow@2.0.0/node_modules/tinyrainbow/dist/chunk-BVHSVHOK.qwik.mjs +80 -0
  80. package/lib/node_modules/.pnpm/tinyspy@3.0.2/node_modules/tinyspy/dist/index.qwik.cjs +104 -0
  81. package/lib/node_modules/.pnpm/tinyspy@3.0.2/node_modules/tinyspy/dist/index.qwik.mjs +104 -0
  82. package/lib/node_modules/.pnpm/vitest@3.0.9_@types_node@22.13.8_@vitest_ui@3.0.9_jiti@2.4.2_jsdom@26.0.0/node_modules/vitest/dist/chunks/_commonjsHelpers.BFTU3MAI.qwik.cjs +8 -0
  83. package/lib/node_modules/.pnpm/vitest@3.0.9_@types_node@22.13.8_@vitest_ui@3.0.9_jiti@2.4.2_jsdom@26.0.0/node_modules/vitest/dist/chunks/_commonjsHelpers.BFTU3MAI.qwik.mjs +8 -0
  84. package/lib/node_modules/.pnpm/vitest@3.0.9_@types_node@22.13.8_@vitest_ui@3.0.9_jiti@2.4.2_jsdom@26.0.0/node_modules/vitest/dist/chunks/date.W2xKR2qe.qwik.cjs +56 -0
  85. package/lib/node_modules/.pnpm/vitest@3.0.9_@types_node@22.13.8_@vitest_ui@3.0.9_jiti@2.4.2_jsdom@26.0.0/node_modules/vitest/dist/chunks/date.W2xKR2qe.qwik.mjs +56 -0
  86. package/lib/node_modules/.pnpm/vitest@3.0.9_@types_node@22.13.8_@vitest_ui@3.0.9_jiti@2.4.2_jsdom@26.0.0/node_modules/vitest/dist/chunks/utils.C8RiOc4B.qwik.cjs +66 -0
  87. package/lib/node_modules/.pnpm/vitest@3.0.9_@types_node@22.13.8_@vitest_ui@3.0.9_jiti@2.4.2_jsdom@26.0.0/node_modules/vitest/dist/chunks/utils.C8RiOc4B.qwik.mjs +66 -0
  88. package/lib/node_modules/.pnpm/vitest@3.0.9_@types_node@22.13.8_@vitest_ui@3.0.9_jiti@2.4.2_jsdom@26.0.0/node_modules/vitest/dist/chunks/vi.nSCvwQ7l.qwik.cjs +2983 -0
  89. package/lib/node_modules/.pnpm/vitest@3.0.9_@types_node@22.13.8_@vitest_ui@3.0.9_jiti@2.4.2_jsdom@26.0.0/node_modules/vitest/dist/chunks/vi.nSCvwQ7l.qwik.mjs +2983 -0
  90. package/lib-types/index.d.ts +1 -0
  91. package/lib-types/lib/qwik-mock.d.ts +34 -0
  92. package/package.json +53 -0
@@ -0,0 +1,4237 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
4
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
5
+ var _a;
6
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
7
+ var __defProp2 = Object.defineProperty;
8
+ var __getOwnPropNames = Object.getOwnPropertyNames;
9
+ var __name = (target, value) => __defProp2(target, "name", { value, configurable: true });
10
+ var __commonJS = (cb, mod) => function __require() {
11
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
12
+ };
13
+ var __export = (target, all) => {
14
+ for (var name in all)
15
+ __defProp2(target, name, { get: all[name], enumerable: true });
16
+ };
17
+ var require_util = __commonJS({
18
+ "(disabled):util"() {
19
+ }
20
+ });
21
+ var utils_exports = {};
22
+ __export(utils_exports, {
23
+ addChainableMethod: () => addChainableMethod,
24
+ addLengthGuard: () => addLengthGuard,
25
+ addMethod: () => addMethod,
26
+ addProperty: () => addProperty,
27
+ checkError: () => check_error_exports,
28
+ compareByInspect: () => compareByInspect,
29
+ eql: () => deep_eql_default,
30
+ expectTypes: () => expectTypes,
31
+ flag: () => flag,
32
+ getActual: () => getActual,
33
+ getMessage: () => getMessage2,
34
+ getName: () => getName,
35
+ getOperator: () => getOperator,
36
+ getOwnEnumerableProperties: () => getOwnEnumerableProperties,
37
+ getOwnEnumerablePropertySymbols: () => getOwnEnumerablePropertySymbols,
38
+ getPathInfo: () => getPathInfo,
39
+ hasProperty: () => hasProperty,
40
+ inspect: () => inspect2,
41
+ isNaN: () => isNaN2,
42
+ isNumeric: () => isNumeric,
43
+ isProxyEnabled: () => isProxyEnabled,
44
+ isRegExp: () => isRegExp2,
45
+ objDisplay: () => objDisplay,
46
+ overwriteChainableMethod: () => overwriteChainableMethod,
47
+ overwriteMethod: () => overwriteMethod,
48
+ overwriteProperty: () => overwriteProperty,
49
+ proxify: () => proxify,
50
+ test: () => test,
51
+ transferFlags: () => transferFlags,
52
+ type: () => type
53
+ });
54
+ var check_error_exports = {};
55
+ __export(check_error_exports, {
56
+ compatibleConstructor: () => compatibleConstructor,
57
+ compatibleInstance: () => compatibleInstance,
58
+ compatibleMessage: () => compatibleMessage,
59
+ getConstructorName: () => getConstructorName,
60
+ getMessage: () => getMessage
61
+ });
62
+ function isErrorInstance(obj) {
63
+ return obj instanceof Error || Object.prototype.toString.call(obj) === "[object Error]";
64
+ }
65
+ __name(isErrorInstance, "isErrorInstance");
66
+ function isRegExp(obj) {
67
+ return Object.prototype.toString.call(obj) === "[object RegExp]";
68
+ }
69
+ __name(isRegExp, "isRegExp");
70
+ function compatibleInstance(thrown, errorLike) {
71
+ return isErrorInstance(errorLike) && thrown === errorLike;
72
+ }
73
+ __name(compatibleInstance, "compatibleInstance");
74
+ function compatibleConstructor(thrown, errorLike) {
75
+ if (isErrorInstance(errorLike)) {
76
+ return thrown.constructor === errorLike.constructor || thrown instanceof errorLike.constructor;
77
+ } else if ((typeof errorLike === "object" || typeof errorLike === "function") && errorLike.prototype) {
78
+ return thrown.constructor === errorLike || thrown instanceof errorLike;
79
+ }
80
+ return false;
81
+ }
82
+ __name(compatibleConstructor, "compatibleConstructor");
83
+ function compatibleMessage(thrown, errMatcher) {
84
+ const comparisonString = typeof thrown === "string" ? thrown : thrown.message;
85
+ if (isRegExp(errMatcher)) {
86
+ return errMatcher.test(comparisonString);
87
+ } else if (typeof errMatcher === "string") {
88
+ return comparisonString.indexOf(errMatcher) !== -1;
89
+ }
90
+ return false;
91
+ }
92
+ __name(compatibleMessage, "compatibleMessage");
93
+ function getConstructorName(errorLike) {
94
+ let constructorName = errorLike;
95
+ if (isErrorInstance(errorLike)) {
96
+ constructorName = errorLike.constructor.name;
97
+ } else if (typeof errorLike === "function") {
98
+ constructorName = errorLike.name;
99
+ if (constructorName === "") {
100
+ const newConstructorName = new errorLike().name;
101
+ constructorName = newConstructorName || constructorName;
102
+ }
103
+ }
104
+ return constructorName;
105
+ }
106
+ __name(getConstructorName, "getConstructorName");
107
+ function getMessage(errorLike) {
108
+ let msg = "";
109
+ if (errorLike && errorLike.message) {
110
+ msg = errorLike.message;
111
+ } else if (typeof errorLike === "string") {
112
+ msg = errorLike;
113
+ }
114
+ return msg;
115
+ }
116
+ __name(getMessage, "getMessage");
117
+ function flag(obj, key, value) {
118
+ var flags = obj.__flags || (obj.__flags = /* @__PURE__ */ Object.create(null));
119
+ if (arguments.length === 3) {
120
+ flags[key] = value;
121
+ } else {
122
+ return flags[key];
123
+ }
124
+ }
125
+ __name(flag, "flag");
126
+ function test(obj, args) {
127
+ var negate = flag(obj, "negate"), expr = args[0];
128
+ return negate ? !expr : expr;
129
+ }
130
+ __name(test, "test");
131
+ function type(obj) {
132
+ if (typeof obj === "undefined") {
133
+ return "undefined";
134
+ }
135
+ if (obj === null) {
136
+ return "null";
137
+ }
138
+ const stringTag = obj[Symbol.toStringTag];
139
+ if (typeof stringTag === "string") {
140
+ return stringTag;
141
+ }
142
+ const type3 = Object.prototype.toString.call(obj).slice(8, -1);
143
+ return type3;
144
+ }
145
+ __name(type, "type");
146
+ var canElideFrames = "captureStackTrace" in Error;
147
+ var AssertionError = (_a = class extends Error {
148
+ constructor(message = "Unspecified AssertionError", props, ssf) {
149
+ super(message);
150
+ __publicField(this, "message");
151
+ this.message = message;
152
+ if (canElideFrames) {
153
+ Error.captureStackTrace(this, ssf || _a);
154
+ }
155
+ for (const key in props) {
156
+ if (!(key in this)) {
157
+ this[key] = props[key];
158
+ }
159
+ }
160
+ }
161
+ get name() {
162
+ return "AssertionError";
163
+ }
164
+ get ok() {
165
+ return false;
166
+ }
167
+ toJSON(stack) {
168
+ return {
169
+ ...this,
170
+ name: this.name,
171
+ message: this.message,
172
+ ok: false,
173
+ stack: stack !== false ? this.stack : void 0
174
+ };
175
+ }
176
+ }, __name(_a, "AssertionError"), _a);
177
+ function expectTypes(obj, types) {
178
+ var flagMsg = flag(obj, "message");
179
+ var ssfi = flag(obj, "ssfi");
180
+ flagMsg = flagMsg ? flagMsg + ": " : "";
181
+ obj = flag(obj, "object");
182
+ types = types.map(function(t) {
183
+ return t.toLowerCase();
184
+ });
185
+ types.sort();
186
+ var str = types.map(function(t, index) {
187
+ var art = ~["a", "e", "i", "o", "u"].indexOf(t.charAt(0)) ? "an" : "a";
188
+ var or = types.length > 1 && index === types.length - 1 ? "or " : "";
189
+ return or + art + " " + t;
190
+ }).join(", ");
191
+ var objType = type(obj).toLowerCase();
192
+ if (!types.some(function(expected) {
193
+ return objType === expected;
194
+ })) {
195
+ throw new AssertionError(
196
+ flagMsg + "object tested must be " + str + ", but " + objType + " given",
197
+ void 0,
198
+ ssfi
199
+ );
200
+ }
201
+ }
202
+ __name(expectTypes, "expectTypes");
203
+ function getActual(obj, args) {
204
+ return args.length > 4 ? args[4] : obj._obj;
205
+ }
206
+ __name(getActual, "getActual");
207
+ var ansiColors = {
208
+ bold: ["1", "22"],
209
+ dim: ["2", "22"],
210
+ italic: ["3", "23"],
211
+ underline: ["4", "24"],
212
+ // 5 & 6 are blinking
213
+ inverse: ["7", "27"],
214
+ hidden: ["8", "28"],
215
+ strike: ["9", "29"],
216
+ // 10-20 are fonts
217
+ // 21-29 are resets for 1-9
218
+ black: ["30", "39"],
219
+ red: ["31", "39"],
220
+ green: ["32", "39"],
221
+ yellow: ["33", "39"],
222
+ blue: ["34", "39"],
223
+ magenta: ["35", "39"],
224
+ cyan: ["36", "39"],
225
+ white: ["37", "39"],
226
+ brightblack: ["30;1", "39"],
227
+ brightred: ["31;1", "39"],
228
+ brightgreen: ["32;1", "39"],
229
+ brightyellow: ["33;1", "39"],
230
+ brightblue: ["34;1", "39"],
231
+ brightmagenta: ["35;1", "39"],
232
+ brightcyan: ["36;1", "39"],
233
+ brightwhite: ["37;1", "39"],
234
+ grey: ["90", "39"]
235
+ };
236
+ var styles = {
237
+ special: "cyan",
238
+ number: "yellow",
239
+ bigint: "yellow",
240
+ boolean: "yellow",
241
+ undefined: "grey",
242
+ null: "bold",
243
+ string: "green",
244
+ symbol: "green",
245
+ date: "magenta",
246
+ regexp: "red"
247
+ };
248
+ var truncator = "…";
249
+ function colorise(value, styleType) {
250
+ const color = ansiColors[styles[styleType]] || ansiColors[styleType] || "";
251
+ if (!color) {
252
+ return String(value);
253
+ }
254
+ return `\x1B[${color[0]}m${String(value)}\x1B[${color[1]}m`;
255
+ }
256
+ __name(colorise, "colorise");
257
+ function normaliseOptions({
258
+ showHidden = false,
259
+ depth = 2,
260
+ colors = false,
261
+ customInspect = true,
262
+ showProxy = false,
263
+ maxArrayLength = Infinity,
264
+ breakLength = Infinity,
265
+ seen = [],
266
+ // eslint-disable-next-line no-shadow
267
+ truncate: truncate2 = Infinity,
268
+ stylize = String
269
+ } = {}, inspect3) {
270
+ const options = {
271
+ showHidden: Boolean(showHidden),
272
+ depth: Number(depth),
273
+ colors: Boolean(colors),
274
+ customInspect: Boolean(customInspect),
275
+ showProxy: Boolean(showProxy),
276
+ maxArrayLength: Number(maxArrayLength),
277
+ breakLength: Number(breakLength),
278
+ truncate: Number(truncate2),
279
+ seen,
280
+ inspect: inspect3,
281
+ stylize
282
+ };
283
+ if (options.colors) {
284
+ options.stylize = colorise;
285
+ }
286
+ return options;
287
+ }
288
+ __name(normaliseOptions, "normaliseOptions");
289
+ function isHighSurrogate(char) {
290
+ return char >= "\uD800" && char <= "\uDBFF";
291
+ }
292
+ __name(isHighSurrogate, "isHighSurrogate");
293
+ function truncate(string, length, tail = truncator) {
294
+ string = String(string);
295
+ const tailLength = tail.length;
296
+ const stringLength = string.length;
297
+ if (tailLength > length && stringLength > tailLength) {
298
+ return tail;
299
+ }
300
+ if (stringLength > length && stringLength > tailLength) {
301
+ let end = length - tailLength;
302
+ if (end > 0 && isHighSurrogate(string[end - 1])) {
303
+ end = end - 1;
304
+ }
305
+ return `${string.slice(0, end)}${tail}`;
306
+ }
307
+ return string;
308
+ }
309
+ __name(truncate, "truncate");
310
+ function inspectList(list, options, inspectItem, separator = ", ") {
311
+ inspectItem = inspectItem || options.inspect;
312
+ const size = list.length;
313
+ if (size === 0)
314
+ return "";
315
+ const originalLength = options.truncate;
316
+ let output = "";
317
+ let peek = "";
318
+ let truncated = "";
319
+ for (let i = 0; i < size; i += 1) {
320
+ const last = i + 1 === list.length;
321
+ const secondToLast = i + 2 === list.length;
322
+ truncated = `${truncator}(${list.length - i})`;
323
+ const value = list[i];
324
+ options.truncate = originalLength - output.length - (last ? 0 : separator.length);
325
+ const string = peek || inspectItem(value, options) + (last ? "" : separator);
326
+ const nextLength = output.length + string.length;
327
+ const truncatedLength = nextLength + truncated.length;
328
+ if (last && nextLength > originalLength && output.length + truncated.length <= originalLength) {
329
+ break;
330
+ }
331
+ if (!last && !secondToLast && truncatedLength > originalLength) {
332
+ break;
333
+ }
334
+ peek = last ? "" : inspectItem(list[i + 1], options) + (secondToLast ? "" : separator);
335
+ if (!last && secondToLast && truncatedLength > originalLength && nextLength + peek.length > originalLength) {
336
+ break;
337
+ }
338
+ output += string;
339
+ if (!last && !secondToLast && nextLength + peek.length >= originalLength) {
340
+ truncated = `${truncator}(${list.length - i - 1})`;
341
+ break;
342
+ }
343
+ truncated = "";
344
+ }
345
+ return `${output}${truncated}`;
346
+ }
347
+ __name(inspectList, "inspectList");
348
+ function quoteComplexKey(key) {
349
+ if (key.match(/^[a-zA-Z_][a-zA-Z_0-9]*$/)) {
350
+ return key;
351
+ }
352
+ return JSON.stringify(key).replace(/'/g, "\\'").replace(/\\"/g, '"').replace(/(^"|"$)/g, "'");
353
+ }
354
+ __name(quoteComplexKey, "quoteComplexKey");
355
+ function inspectProperty([key, value], options) {
356
+ options.truncate -= 2;
357
+ if (typeof key === "string") {
358
+ key = quoteComplexKey(key);
359
+ } else if (typeof key !== "number") {
360
+ key = `[${options.inspect(key, options)}]`;
361
+ }
362
+ options.truncate -= key.length;
363
+ value = options.inspect(value, options);
364
+ return `${key}: ${value}`;
365
+ }
366
+ __name(inspectProperty, "inspectProperty");
367
+ function inspectArray(array, options) {
368
+ const nonIndexProperties = Object.keys(array).slice(array.length);
369
+ if (!array.length && !nonIndexProperties.length)
370
+ return "[]";
371
+ options.truncate -= 4;
372
+ const listContents = inspectList(array, options);
373
+ options.truncate -= listContents.length;
374
+ let propertyContents = "";
375
+ if (nonIndexProperties.length) {
376
+ propertyContents = inspectList(nonIndexProperties.map((key) => [key, array[key]]), options, inspectProperty);
377
+ }
378
+ return `[ ${listContents}${propertyContents ? `, ${propertyContents}` : ""} ]`;
379
+ }
380
+ __name(inspectArray, "inspectArray");
381
+ var getArrayName = /* @__PURE__ */ __name((array) => {
382
+ if (typeof Buffer === "function" && array instanceof Buffer) {
383
+ return "Buffer";
384
+ }
385
+ if (array[Symbol.toStringTag]) {
386
+ return array[Symbol.toStringTag];
387
+ }
388
+ return array.constructor.name;
389
+ }, "getArrayName");
390
+ function inspectTypedArray(array, options) {
391
+ const name = getArrayName(array);
392
+ options.truncate -= name.length + 4;
393
+ const nonIndexProperties = Object.keys(array).slice(array.length);
394
+ if (!array.length && !nonIndexProperties.length)
395
+ return `${name}[]`;
396
+ let output = "";
397
+ for (let i = 0; i < array.length; i++) {
398
+ const string = `${options.stylize(truncate(array[i], options.truncate), "number")}${i === array.length - 1 ? "" : ", "}`;
399
+ options.truncate -= string.length;
400
+ if (array[i] !== array.length && options.truncate <= 3) {
401
+ output += `${truncator}(${array.length - array[i] + 1})`;
402
+ break;
403
+ }
404
+ output += string;
405
+ }
406
+ let propertyContents = "";
407
+ if (nonIndexProperties.length) {
408
+ propertyContents = inspectList(nonIndexProperties.map((key) => [key, array[key]]), options, inspectProperty);
409
+ }
410
+ return `${name}[ ${output}${propertyContents ? `, ${propertyContents}` : ""} ]`;
411
+ }
412
+ __name(inspectTypedArray, "inspectTypedArray");
413
+ function inspectDate(dateObject, options) {
414
+ const stringRepresentation = dateObject.toJSON();
415
+ if (stringRepresentation === null) {
416
+ return "Invalid Date";
417
+ }
418
+ const split = stringRepresentation.split("T");
419
+ const date = split[0];
420
+ return options.stylize(`${date}T${truncate(split[1], options.truncate - date.length - 1)}`, "date");
421
+ }
422
+ __name(inspectDate, "inspectDate");
423
+ function inspectFunction(func, options) {
424
+ const functionType = func[Symbol.toStringTag] || "Function";
425
+ const name = func.name;
426
+ if (!name) {
427
+ return options.stylize(`[${functionType}]`, "special");
428
+ }
429
+ return options.stylize(`[${functionType} ${truncate(name, options.truncate - 11)}]`, "special");
430
+ }
431
+ __name(inspectFunction, "inspectFunction");
432
+ function inspectMapEntry([key, value], options) {
433
+ options.truncate -= 4;
434
+ key = options.inspect(key, options);
435
+ options.truncate -= key.length;
436
+ value = options.inspect(value, options);
437
+ return `${key} => ${value}`;
438
+ }
439
+ __name(inspectMapEntry, "inspectMapEntry");
440
+ function mapToEntries(map) {
441
+ const entries = [];
442
+ map.forEach((value, key) => {
443
+ entries.push([key, value]);
444
+ });
445
+ return entries;
446
+ }
447
+ __name(mapToEntries, "mapToEntries");
448
+ function inspectMap(map, options) {
449
+ const size = map.size - 1;
450
+ if (size <= 0) {
451
+ return "Map{}";
452
+ }
453
+ options.truncate -= 7;
454
+ return `Map{ ${inspectList(mapToEntries(map), options, inspectMapEntry)} }`;
455
+ }
456
+ __name(inspectMap, "inspectMap");
457
+ var isNaN = Number.isNaN || ((i) => i !== i);
458
+ function inspectNumber(number, options) {
459
+ if (isNaN(number)) {
460
+ return options.stylize("NaN", "number");
461
+ }
462
+ if (number === Infinity) {
463
+ return options.stylize("Infinity", "number");
464
+ }
465
+ if (number === -Infinity) {
466
+ return options.stylize("-Infinity", "number");
467
+ }
468
+ if (number === 0) {
469
+ return options.stylize(1 / number === Infinity ? "+0" : "-0", "number");
470
+ }
471
+ return options.stylize(truncate(String(number), options.truncate), "number");
472
+ }
473
+ __name(inspectNumber, "inspectNumber");
474
+ function inspectBigInt(number, options) {
475
+ let nums = truncate(number.toString(), options.truncate - 1);
476
+ if (nums !== truncator)
477
+ nums += "n";
478
+ return options.stylize(nums, "bigint");
479
+ }
480
+ __name(inspectBigInt, "inspectBigInt");
481
+ function inspectRegExp(value, options) {
482
+ const flags = value.toString().split("/")[2];
483
+ const sourceLength = options.truncate - (2 + flags.length);
484
+ const source = value.source;
485
+ return options.stylize(`/${truncate(source, sourceLength)}/${flags}`, "regexp");
486
+ }
487
+ __name(inspectRegExp, "inspectRegExp");
488
+ function arrayFromSet(set2) {
489
+ const values = [];
490
+ set2.forEach((value) => {
491
+ values.push(value);
492
+ });
493
+ return values;
494
+ }
495
+ __name(arrayFromSet, "arrayFromSet");
496
+ function inspectSet(set2, options) {
497
+ if (set2.size === 0)
498
+ return "Set{}";
499
+ options.truncate -= 7;
500
+ return `Set{ ${inspectList(arrayFromSet(set2), options)} }`;
501
+ }
502
+ __name(inspectSet, "inspectSet");
503
+ var stringEscapeChars = new RegExp("['\\u0000-\\u001f\\u007f-\\u009f\\u00ad\\u0600-\\u0604\\u070f\\u17b4\\u17b5\\u200c-\\u200f\\u2028-\\u202f\\u2060-\\u206f\\ufeff\\ufff0-\\uffff]", "g");
504
+ var escapeCharacters = {
505
+ "\b": "\\b",
506
+ " ": "\\t",
507
+ "\n": "\\n",
508
+ "\f": "\\f",
509
+ "\r": "\\r",
510
+ "'": "\\'",
511
+ "\\": "\\\\"
512
+ };
513
+ var hex = 16;
514
+ function escape(char) {
515
+ return escapeCharacters[char] || `\\u${`0000${char.charCodeAt(0).toString(hex)}`.slice(-4)}`;
516
+ }
517
+ __name(escape, "escape");
518
+ function inspectString(string, options) {
519
+ if (stringEscapeChars.test(string)) {
520
+ string = string.replace(stringEscapeChars, escape);
521
+ }
522
+ return options.stylize(`'${truncate(string, options.truncate - 2)}'`, "string");
523
+ }
524
+ __name(inspectString, "inspectString");
525
+ function inspectSymbol(value) {
526
+ if ("description" in Symbol.prototype) {
527
+ return value.description ? `Symbol(${value.description})` : "Symbol()";
528
+ }
529
+ return value.toString();
530
+ }
531
+ __name(inspectSymbol, "inspectSymbol");
532
+ var getPromiseValue = /* @__PURE__ */ __name(() => "Promise{…}", "getPromiseValue");
533
+ try {
534
+ const { getPromiseDetails, kPending, kRejected } = process.binding("util");
535
+ if (Array.isArray(getPromiseDetails(Promise.resolve()))) {
536
+ getPromiseValue = /* @__PURE__ */ __name((value, options) => {
537
+ const [state, innerValue] = getPromiseDetails(value);
538
+ if (state === kPending) {
539
+ return "Promise{<pending>}";
540
+ }
541
+ return `Promise${state === kRejected ? "!" : ""}{${options.inspect(innerValue, options)}}`;
542
+ }, "getPromiseValue");
543
+ }
544
+ } catch (notNode) {
545
+ }
546
+ var promise_default = getPromiseValue;
547
+ function inspectObject(object, options) {
548
+ const properties = Object.getOwnPropertyNames(object);
549
+ const symbols = Object.getOwnPropertySymbols ? Object.getOwnPropertySymbols(object) : [];
550
+ if (properties.length === 0 && symbols.length === 0) {
551
+ return "{}";
552
+ }
553
+ options.truncate -= 4;
554
+ options.seen = options.seen || [];
555
+ if (options.seen.includes(object)) {
556
+ return "[Circular]";
557
+ }
558
+ options.seen.push(object);
559
+ const propertyContents = inspectList(properties.map((key) => [key, object[key]]), options, inspectProperty);
560
+ const symbolContents = inspectList(symbols.map((key) => [key, object[key]]), options, inspectProperty);
561
+ options.seen.pop();
562
+ let sep = "";
563
+ if (propertyContents && symbolContents) {
564
+ sep = ", ";
565
+ }
566
+ return `{ ${propertyContents}${sep}${symbolContents} }`;
567
+ }
568
+ __name(inspectObject, "inspectObject");
569
+ var toStringTag = typeof Symbol !== "undefined" && Symbol.toStringTag ? Symbol.toStringTag : false;
570
+ function inspectClass(value, options) {
571
+ let name = "";
572
+ if (toStringTag && toStringTag in value) {
573
+ name = value[toStringTag];
574
+ }
575
+ name = name || value.constructor.name;
576
+ if (!name || name === "_class") {
577
+ name = "<Anonymous Class>";
578
+ }
579
+ options.truncate -= name.length;
580
+ return `${name}${inspectObject(value, options)}`;
581
+ }
582
+ __name(inspectClass, "inspectClass");
583
+ function inspectArguments(args, options) {
584
+ if (args.length === 0)
585
+ return "Arguments[]";
586
+ options.truncate -= 13;
587
+ return `Arguments[ ${inspectList(args, options)} ]`;
588
+ }
589
+ __name(inspectArguments, "inspectArguments");
590
+ var errorKeys = [
591
+ "stack",
592
+ "line",
593
+ "column",
594
+ "name",
595
+ "message",
596
+ "fileName",
597
+ "lineNumber",
598
+ "columnNumber",
599
+ "number",
600
+ "description",
601
+ "cause"
602
+ ];
603
+ function inspectObject2(error, options) {
604
+ const properties = Object.getOwnPropertyNames(error).filter((key) => errorKeys.indexOf(key) === -1);
605
+ const name = error.name;
606
+ options.truncate -= name.length;
607
+ let message = "";
608
+ if (typeof error.message === "string") {
609
+ message = truncate(error.message, options.truncate);
610
+ } else {
611
+ properties.unshift("message");
612
+ }
613
+ message = message ? `: ${message}` : "";
614
+ options.truncate -= message.length + 5;
615
+ options.seen = options.seen || [];
616
+ if (options.seen.includes(error)) {
617
+ return "[Circular]";
618
+ }
619
+ options.seen.push(error);
620
+ const propertyContents = inspectList(properties.map((key) => [key, error[key]]), options, inspectProperty);
621
+ return `${name}${message}${propertyContents ? ` { ${propertyContents} }` : ""}`;
622
+ }
623
+ __name(inspectObject2, "inspectObject");
624
+ function inspectAttribute([key, value], options) {
625
+ options.truncate -= 3;
626
+ if (!value) {
627
+ return `${options.stylize(String(key), "yellow")}`;
628
+ }
629
+ return `${options.stylize(String(key), "yellow")}=${options.stylize(`"${value}"`, "string")}`;
630
+ }
631
+ __name(inspectAttribute, "inspectAttribute");
632
+ function inspectHTMLCollection(collection, options) {
633
+ return inspectList(collection, options, inspectHTML, "\n");
634
+ }
635
+ __name(inspectHTMLCollection, "inspectHTMLCollection");
636
+ function inspectHTML(element, options) {
637
+ const properties = element.getAttributeNames();
638
+ const name = element.tagName.toLowerCase();
639
+ const head = options.stylize(`<${name}`, "special");
640
+ const headClose = options.stylize(`>`, "special");
641
+ const tail = options.stylize(`</${name}>`, "special");
642
+ options.truncate -= name.length * 2 + 5;
643
+ let propertyContents = "";
644
+ if (properties.length > 0) {
645
+ propertyContents += " ";
646
+ propertyContents += inspectList(properties.map((key) => [key, element.getAttribute(key)]), options, inspectAttribute, " ");
647
+ }
648
+ options.truncate -= propertyContents.length;
649
+ const truncate2 = options.truncate;
650
+ let children = inspectHTMLCollection(element.children, options);
651
+ if (children && children.length > truncate2) {
652
+ children = `${truncator}(${element.children.length})`;
653
+ }
654
+ return `${head}${propertyContents}${headClose}${children}${tail}`;
655
+ }
656
+ __name(inspectHTML, "inspectHTML");
657
+ var symbolsSupported = typeof Symbol === "function" && typeof Symbol.for === "function";
658
+ var chaiInspect = symbolsSupported ? Symbol.for("chai/inspect") : "@@chai/inspect";
659
+ var nodeInspect = false;
660
+ try {
661
+ const nodeUtil = require_util();
662
+ nodeInspect = nodeUtil.inspect ? nodeUtil.inspect.custom : false;
663
+ } catch (noNodeInspect) {
664
+ nodeInspect = false;
665
+ }
666
+ var constructorMap = /* @__PURE__ */ new WeakMap();
667
+ var stringTagMap = {};
668
+ var baseTypesMap = {
669
+ undefined: (value, options) => options.stylize("undefined", "undefined"),
670
+ null: (value, options) => options.stylize("null", "null"),
671
+ boolean: (value, options) => options.stylize(String(value), "boolean"),
672
+ Boolean: (value, options) => options.stylize(String(value), "boolean"),
673
+ number: inspectNumber,
674
+ Number: inspectNumber,
675
+ bigint: inspectBigInt,
676
+ BigInt: inspectBigInt,
677
+ string: inspectString,
678
+ String: inspectString,
679
+ function: inspectFunction,
680
+ Function: inspectFunction,
681
+ symbol: inspectSymbol,
682
+ // A Symbol polyfill will return `Symbol` not `symbol` from typedetect
683
+ Symbol: inspectSymbol,
684
+ Array: inspectArray,
685
+ Date: inspectDate,
686
+ Map: inspectMap,
687
+ Set: inspectSet,
688
+ RegExp: inspectRegExp,
689
+ Promise: promise_default,
690
+ // WeakSet, WeakMap are totally opaque to us
691
+ WeakSet: (value, options) => options.stylize("WeakSet{…}", "special"),
692
+ WeakMap: (value, options) => options.stylize("WeakMap{…}", "special"),
693
+ Arguments: inspectArguments,
694
+ Int8Array: inspectTypedArray,
695
+ Uint8Array: inspectTypedArray,
696
+ Uint8ClampedArray: inspectTypedArray,
697
+ Int16Array: inspectTypedArray,
698
+ Uint16Array: inspectTypedArray,
699
+ Int32Array: inspectTypedArray,
700
+ Uint32Array: inspectTypedArray,
701
+ Float32Array: inspectTypedArray,
702
+ Float64Array: inspectTypedArray,
703
+ Generator: () => "",
704
+ DataView: () => "",
705
+ ArrayBuffer: () => "",
706
+ Error: inspectObject2,
707
+ HTMLCollection: inspectHTMLCollection,
708
+ NodeList: inspectHTMLCollection
709
+ };
710
+ var inspectCustom = /* @__PURE__ */ __name((value, options, type3) => {
711
+ if (chaiInspect in value && typeof value[chaiInspect] === "function") {
712
+ return value[chaiInspect](options);
713
+ }
714
+ if (nodeInspect && nodeInspect in value && typeof value[nodeInspect] === "function") {
715
+ return value[nodeInspect](options.depth, options);
716
+ }
717
+ if ("inspect" in value && typeof value.inspect === "function") {
718
+ return value.inspect(options.depth, options);
719
+ }
720
+ if ("constructor" in value && constructorMap.has(value.constructor)) {
721
+ return constructorMap.get(value.constructor)(value, options);
722
+ }
723
+ if (stringTagMap[type3]) {
724
+ return stringTagMap[type3](value, options);
725
+ }
726
+ return "";
727
+ }, "inspectCustom");
728
+ var toString = Object.prototype.toString;
729
+ function inspect(value, opts = {}) {
730
+ const options = normaliseOptions(opts, inspect);
731
+ const { customInspect } = options;
732
+ let type3 = value === null ? "null" : typeof value;
733
+ if (type3 === "object") {
734
+ type3 = toString.call(value).slice(8, -1);
735
+ }
736
+ if (type3 in baseTypesMap) {
737
+ return baseTypesMap[type3](value, options);
738
+ }
739
+ if (customInspect && value) {
740
+ const output = inspectCustom(value, options, type3);
741
+ if (output) {
742
+ if (typeof output === "string")
743
+ return output;
744
+ return inspect(output, options);
745
+ }
746
+ }
747
+ const proto = value ? Object.getPrototypeOf(value) : false;
748
+ if (proto === Object.prototype || proto === null) {
749
+ return inspectObject(value, options);
750
+ }
751
+ if (value && typeof HTMLElement === "function" && value instanceof HTMLElement) {
752
+ return inspectHTML(value, options);
753
+ }
754
+ if ("constructor" in value) {
755
+ if (value.constructor !== Object) {
756
+ return inspectClass(value, options);
757
+ }
758
+ return inspectObject(value, options);
759
+ }
760
+ if (value === Object(value)) {
761
+ return inspectObject(value, options);
762
+ }
763
+ return options.stylize(String(value), type3);
764
+ }
765
+ __name(inspect, "inspect");
766
+ var config = {
767
+ /**
768
+ * ### config.includeStack
769
+ *
770
+ * User configurable property, influences whether stack trace
771
+ * is included in Assertion error message. Default of false
772
+ * suppresses stack trace in the error message.
773
+ *
774
+ * chai.config.includeStack = true; // enable stack on error
775
+ *
776
+ * @param {boolean}
777
+ * @public
778
+ */
779
+ includeStack: false,
780
+ /**
781
+ * ### config.showDiff
782
+ *
783
+ * User configurable property, influences whether or not
784
+ * the `showDiff` flag should be included in the thrown
785
+ * AssertionErrors. `false` will always be `false`; `true`
786
+ * will be true when the assertion has requested a diff
787
+ * be shown.
788
+ *
789
+ * @param {boolean}
790
+ * @public
791
+ */
792
+ showDiff: true,
793
+ /**
794
+ * ### config.truncateThreshold
795
+ *
796
+ * User configurable property, sets length threshold for actual and
797
+ * expected values in assertion errors. If this threshold is exceeded, for
798
+ * example for large data structures, the value is replaced with something
799
+ * like `[ Array(3) ]` or `{ Object (prop1, prop2) }`.
800
+ *
801
+ * Set it to zero if you want to disable truncating altogether.
802
+ *
803
+ * This is especially userful when doing assertions on arrays: having this
804
+ * set to a reasonable large value makes the failure messages readily
805
+ * inspectable.
806
+ *
807
+ * chai.config.truncateThreshold = 0; // disable truncating
808
+ *
809
+ * @param {number}
810
+ * @public
811
+ */
812
+ truncateThreshold: 40,
813
+ /**
814
+ * ### config.useProxy
815
+ *
816
+ * User configurable property, defines if chai will use a Proxy to throw
817
+ * an error when a non-existent property is read, which protects users
818
+ * from typos when using property-based assertions.
819
+ *
820
+ * Set it to false if you want to disable this feature.
821
+ *
822
+ * chai.config.useProxy = false; // disable use of Proxy
823
+ *
824
+ * This feature is automatically disabled regardless of this config value
825
+ * in environments that don't support proxies.
826
+ *
827
+ * @param {boolean}
828
+ * @public
829
+ */
830
+ useProxy: true,
831
+ /**
832
+ * ### config.proxyExcludedKeys
833
+ *
834
+ * User configurable property, defines which properties should be ignored
835
+ * instead of throwing an error if they do not exist on the assertion.
836
+ * This is only applied if the environment Chai is running in supports proxies and
837
+ * if the `useProxy` configuration setting is enabled.
838
+ * By default, `then` and `inspect` will not throw an error if they do not exist on the
839
+ * assertion object because the `.inspect` property is read by `util.inspect` (for example, when
840
+ * using `console.log` on the assertion object) and `.then` is necessary for promise type-checking.
841
+ *
842
+ * // By default these keys will not throw an error if they do not exist on the assertion object
843
+ * chai.config.proxyExcludedKeys = ['then', 'inspect'];
844
+ *
845
+ * @param {Array}
846
+ * @public
847
+ */
848
+ proxyExcludedKeys: ["then", "catch", "inspect", "toJSON"],
849
+ /**
850
+ * ### config.deepEqual
851
+ *
852
+ * User configurable property, defines which a custom function to use for deepEqual
853
+ * comparisons.
854
+ * By default, the function used is the one from the `deep-eql` package without custom comparator.
855
+ *
856
+ * // use a custom comparator
857
+ * chai.config.deepEqual = (expected, actual) => {
858
+ * return chai.util.eql(expected, actual, {
859
+ * comparator: (expected, actual) => {
860
+ * // for non number comparison, use the default behavior
861
+ * if(typeof expected !== 'number') return null;
862
+ * // allow a difference of 10 between compared numbers
863
+ * return typeof actual === 'number' && Math.abs(actual - expected) < 10
864
+ * }
865
+ * })
866
+ * };
867
+ *
868
+ * @param {Function}
869
+ * @public
870
+ */
871
+ deepEqual: null
872
+ };
873
+ function inspect2(obj, showHidden, depth, colors) {
874
+ var options = {
875
+ colors,
876
+ depth: typeof depth === "undefined" ? 2 : depth,
877
+ showHidden,
878
+ truncate: config.truncateThreshold ? config.truncateThreshold : Infinity
879
+ };
880
+ return inspect(obj, options);
881
+ }
882
+ __name(inspect2, "inspect");
883
+ function objDisplay(obj) {
884
+ var str = inspect2(obj), type3 = Object.prototype.toString.call(obj);
885
+ if (config.truncateThreshold && str.length >= config.truncateThreshold) {
886
+ if (type3 === "[object Function]") {
887
+ return !obj.name || obj.name === "" ? "[Function]" : "[Function: " + obj.name + "]";
888
+ } else if (type3 === "[object Array]") {
889
+ return "[ Array(" + obj.length + ") ]";
890
+ } else if (type3 === "[object Object]") {
891
+ var keys = Object.keys(obj), kstr = keys.length > 2 ? keys.splice(0, 2).join(", ") + ", ..." : keys.join(", ");
892
+ return "{ Object (" + kstr + ") }";
893
+ } else {
894
+ return str;
895
+ }
896
+ } else {
897
+ return str;
898
+ }
899
+ }
900
+ __name(objDisplay, "objDisplay");
901
+ function getMessage2(obj, args) {
902
+ var negate = flag(obj, "negate"), val = flag(obj, "object"), expected = args[3], actual = getActual(obj, args), msg = negate ? args[2] : args[1], flagMsg = flag(obj, "message");
903
+ if (typeof msg === "function")
904
+ msg = msg();
905
+ msg = msg || "";
906
+ msg = msg.replace(/#\{this\}/g, function() {
907
+ return objDisplay(val);
908
+ }).replace(/#\{act\}/g, function() {
909
+ return objDisplay(actual);
910
+ }).replace(/#\{exp\}/g, function() {
911
+ return objDisplay(expected);
912
+ });
913
+ return flagMsg ? flagMsg + ": " + msg : msg;
914
+ }
915
+ __name(getMessage2, "getMessage");
916
+ function transferFlags(assertion, object, includeAll) {
917
+ var flags = assertion.__flags || (assertion.__flags = /* @__PURE__ */ Object.create(null));
918
+ if (!object.__flags) {
919
+ object.__flags = /* @__PURE__ */ Object.create(null);
920
+ }
921
+ includeAll = arguments.length === 3 ? includeAll : true;
922
+ for (var flag3 in flags) {
923
+ if (includeAll || flag3 !== "object" && flag3 !== "ssfi" && flag3 !== "lockSsfi" && flag3 != "message") {
924
+ object.__flags[flag3] = flags[flag3];
925
+ }
926
+ }
927
+ }
928
+ __name(transferFlags, "transferFlags");
929
+ function type2(obj) {
930
+ if (typeof obj === "undefined") {
931
+ return "undefined";
932
+ }
933
+ if (obj === null) {
934
+ return "null";
935
+ }
936
+ const stringTag = obj[Symbol.toStringTag];
937
+ if (typeof stringTag === "string") {
938
+ return stringTag;
939
+ }
940
+ const sliceStart = 8;
941
+ const sliceEnd = -1;
942
+ return Object.prototype.toString.call(obj).slice(sliceStart, sliceEnd);
943
+ }
944
+ __name(type2, "type");
945
+ function FakeMap() {
946
+ this._key = "chai/deep-eql__" + Math.random() + Date.now();
947
+ }
948
+ __name(FakeMap, "FakeMap");
949
+ FakeMap.prototype = {
950
+ get: /* @__PURE__ */ __name(function get(key) {
951
+ return key[this._key];
952
+ }, "get"),
953
+ set: /* @__PURE__ */ __name(function set(key, value) {
954
+ if (Object.isExtensible(key)) {
955
+ Object.defineProperty(key, this._key, {
956
+ value,
957
+ configurable: true
958
+ });
959
+ }
960
+ }, "set")
961
+ };
962
+ var MemoizeMap = typeof WeakMap === "function" ? WeakMap : FakeMap;
963
+ function memoizeCompare(leftHandOperand, rightHandOperand, memoizeMap) {
964
+ if (!memoizeMap || isPrimitive(leftHandOperand) || isPrimitive(rightHandOperand)) {
965
+ return null;
966
+ }
967
+ var leftHandMap = memoizeMap.get(leftHandOperand);
968
+ if (leftHandMap) {
969
+ var result = leftHandMap.get(rightHandOperand);
970
+ if (typeof result === "boolean") {
971
+ return result;
972
+ }
973
+ }
974
+ return null;
975
+ }
976
+ __name(memoizeCompare, "memoizeCompare");
977
+ function memoizeSet(leftHandOperand, rightHandOperand, memoizeMap, result) {
978
+ if (!memoizeMap || isPrimitive(leftHandOperand) || isPrimitive(rightHandOperand)) {
979
+ return;
980
+ }
981
+ var leftHandMap = memoizeMap.get(leftHandOperand);
982
+ if (leftHandMap) {
983
+ leftHandMap.set(rightHandOperand, result);
984
+ } else {
985
+ leftHandMap = new MemoizeMap();
986
+ leftHandMap.set(rightHandOperand, result);
987
+ memoizeMap.set(leftHandOperand, leftHandMap);
988
+ }
989
+ }
990
+ __name(memoizeSet, "memoizeSet");
991
+ var deep_eql_default = deepEqual;
992
+ function deepEqual(leftHandOperand, rightHandOperand, options) {
993
+ if (options && options.comparator) {
994
+ return extensiveDeepEqual(leftHandOperand, rightHandOperand, options);
995
+ }
996
+ var simpleResult = simpleEqual(leftHandOperand, rightHandOperand);
997
+ if (simpleResult !== null) {
998
+ return simpleResult;
999
+ }
1000
+ return extensiveDeepEqual(leftHandOperand, rightHandOperand, options);
1001
+ }
1002
+ __name(deepEqual, "deepEqual");
1003
+ function simpleEqual(leftHandOperand, rightHandOperand) {
1004
+ if (leftHandOperand === rightHandOperand) {
1005
+ return leftHandOperand !== 0 || 1 / leftHandOperand === 1 / rightHandOperand;
1006
+ }
1007
+ if (leftHandOperand !== leftHandOperand && // eslint-disable-line no-self-compare
1008
+ rightHandOperand !== rightHandOperand) {
1009
+ return true;
1010
+ }
1011
+ if (isPrimitive(leftHandOperand) || isPrimitive(rightHandOperand)) {
1012
+ return false;
1013
+ }
1014
+ return null;
1015
+ }
1016
+ __name(simpleEqual, "simpleEqual");
1017
+ function extensiveDeepEqual(leftHandOperand, rightHandOperand, options) {
1018
+ options = options || {};
1019
+ options.memoize = options.memoize === false ? false : options.memoize || new MemoizeMap();
1020
+ var comparator = options && options.comparator;
1021
+ var memoizeResultLeft = memoizeCompare(leftHandOperand, rightHandOperand, options.memoize);
1022
+ if (memoizeResultLeft !== null) {
1023
+ return memoizeResultLeft;
1024
+ }
1025
+ var memoizeResultRight = memoizeCompare(rightHandOperand, leftHandOperand, options.memoize);
1026
+ if (memoizeResultRight !== null) {
1027
+ return memoizeResultRight;
1028
+ }
1029
+ if (comparator) {
1030
+ var comparatorResult = comparator(leftHandOperand, rightHandOperand);
1031
+ if (comparatorResult === false || comparatorResult === true) {
1032
+ memoizeSet(leftHandOperand, rightHandOperand, options.memoize, comparatorResult);
1033
+ return comparatorResult;
1034
+ }
1035
+ var simpleResult = simpleEqual(leftHandOperand, rightHandOperand);
1036
+ if (simpleResult !== null) {
1037
+ return simpleResult;
1038
+ }
1039
+ }
1040
+ var leftHandType = type2(leftHandOperand);
1041
+ if (leftHandType !== type2(rightHandOperand)) {
1042
+ memoizeSet(leftHandOperand, rightHandOperand, options.memoize, false);
1043
+ return false;
1044
+ }
1045
+ memoizeSet(leftHandOperand, rightHandOperand, options.memoize, true);
1046
+ var result = extensiveDeepEqualByType(leftHandOperand, rightHandOperand, leftHandType, options);
1047
+ memoizeSet(leftHandOperand, rightHandOperand, options.memoize, result);
1048
+ return result;
1049
+ }
1050
+ __name(extensiveDeepEqual, "extensiveDeepEqual");
1051
+ function extensiveDeepEqualByType(leftHandOperand, rightHandOperand, leftHandType, options) {
1052
+ switch (leftHandType) {
1053
+ case "String":
1054
+ case "Number":
1055
+ case "Boolean":
1056
+ case "Date":
1057
+ return deepEqual(leftHandOperand.valueOf(), rightHandOperand.valueOf());
1058
+ case "Promise":
1059
+ case "Symbol":
1060
+ case "function":
1061
+ case "WeakMap":
1062
+ case "WeakSet":
1063
+ return leftHandOperand === rightHandOperand;
1064
+ case "Error":
1065
+ return keysEqual(leftHandOperand, rightHandOperand, ["name", "message", "code"], options);
1066
+ case "Arguments":
1067
+ case "Int8Array":
1068
+ case "Uint8Array":
1069
+ case "Uint8ClampedArray":
1070
+ case "Int16Array":
1071
+ case "Uint16Array":
1072
+ case "Int32Array":
1073
+ case "Uint32Array":
1074
+ case "Float32Array":
1075
+ case "Float64Array":
1076
+ case "Array":
1077
+ return iterableEqual(leftHandOperand, rightHandOperand, options);
1078
+ case "RegExp":
1079
+ return regexpEqual(leftHandOperand, rightHandOperand);
1080
+ case "Generator":
1081
+ return generatorEqual(leftHandOperand, rightHandOperand, options);
1082
+ case "DataView":
1083
+ return iterableEqual(new Uint8Array(leftHandOperand.buffer), new Uint8Array(rightHandOperand.buffer), options);
1084
+ case "ArrayBuffer":
1085
+ return iterableEqual(new Uint8Array(leftHandOperand), new Uint8Array(rightHandOperand), options);
1086
+ case "Set":
1087
+ return entriesEqual(leftHandOperand, rightHandOperand, options);
1088
+ case "Map":
1089
+ return entriesEqual(leftHandOperand, rightHandOperand, options);
1090
+ case "Temporal.PlainDate":
1091
+ case "Temporal.PlainTime":
1092
+ case "Temporal.PlainDateTime":
1093
+ case "Temporal.Instant":
1094
+ case "Temporal.ZonedDateTime":
1095
+ case "Temporal.PlainYearMonth":
1096
+ case "Temporal.PlainMonthDay":
1097
+ return leftHandOperand.equals(rightHandOperand);
1098
+ case "Temporal.Duration":
1099
+ return leftHandOperand.total("nanoseconds") === rightHandOperand.total("nanoseconds");
1100
+ case "Temporal.TimeZone":
1101
+ case "Temporal.Calendar":
1102
+ return leftHandOperand.toString() === rightHandOperand.toString();
1103
+ default:
1104
+ return objectEqual(leftHandOperand, rightHandOperand, options);
1105
+ }
1106
+ }
1107
+ __name(extensiveDeepEqualByType, "extensiveDeepEqualByType");
1108
+ function regexpEqual(leftHandOperand, rightHandOperand) {
1109
+ return leftHandOperand.toString() === rightHandOperand.toString();
1110
+ }
1111
+ __name(regexpEqual, "regexpEqual");
1112
+ function entriesEqual(leftHandOperand, rightHandOperand, options) {
1113
+ try {
1114
+ if (leftHandOperand.size !== rightHandOperand.size) {
1115
+ return false;
1116
+ }
1117
+ if (leftHandOperand.size === 0) {
1118
+ return true;
1119
+ }
1120
+ } catch (sizeError) {
1121
+ return false;
1122
+ }
1123
+ var leftHandItems = [];
1124
+ var rightHandItems = [];
1125
+ leftHandOperand.forEach(/* @__PURE__ */ __name(function gatherEntries(key, value) {
1126
+ leftHandItems.push([key, value]);
1127
+ }, "gatherEntries"));
1128
+ rightHandOperand.forEach(/* @__PURE__ */ __name(function gatherEntries(key, value) {
1129
+ rightHandItems.push([key, value]);
1130
+ }, "gatherEntries"));
1131
+ return iterableEqual(leftHandItems.sort(), rightHandItems.sort(), options);
1132
+ }
1133
+ __name(entriesEqual, "entriesEqual");
1134
+ function iterableEqual(leftHandOperand, rightHandOperand, options) {
1135
+ var length = leftHandOperand.length;
1136
+ if (length !== rightHandOperand.length) {
1137
+ return false;
1138
+ }
1139
+ if (length === 0) {
1140
+ return true;
1141
+ }
1142
+ var index = -1;
1143
+ while (++index < length) {
1144
+ if (deepEqual(leftHandOperand[index], rightHandOperand[index], options) === false) {
1145
+ return false;
1146
+ }
1147
+ }
1148
+ return true;
1149
+ }
1150
+ __name(iterableEqual, "iterableEqual");
1151
+ function generatorEqual(leftHandOperand, rightHandOperand, options) {
1152
+ return iterableEqual(getGeneratorEntries(leftHandOperand), getGeneratorEntries(rightHandOperand), options);
1153
+ }
1154
+ __name(generatorEqual, "generatorEqual");
1155
+ function hasIteratorFunction(target) {
1156
+ return typeof Symbol !== "undefined" && typeof target === "object" && typeof Symbol.iterator !== "undefined" && typeof target[Symbol.iterator] === "function";
1157
+ }
1158
+ __name(hasIteratorFunction, "hasIteratorFunction");
1159
+ function getIteratorEntries(target) {
1160
+ if (hasIteratorFunction(target)) {
1161
+ try {
1162
+ return getGeneratorEntries(target[Symbol.iterator]());
1163
+ } catch (iteratorError) {
1164
+ return [];
1165
+ }
1166
+ }
1167
+ return [];
1168
+ }
1169
+ __name(getIteratorEntries, "getIteratorEntries");
1170
+ function getGeneratorEntries(generator) {
1171
+ var generatorResult = generator.next();
1172
+ var accumulator = [generatorResult.value];
1173
+ while (generatorResult.done === false) {
1174
+ generatorResult = generator.next();
1175
+ accumulator.push(generatorResult.value);
1176
+ }
1177
+ return accumulator;
1178
+ }
1179
+ __name(getGeneratorEntries, "getGeneratorEntries");
1180
+ function getEnumerableKeys(target) {
1181
+ var keys = [];
1182
+ for (var key in target) {
1183
+ keys.push(key);
1184
+ }
1185
+ return keys;
1186
+ }
1187
+ __name(getEnumerableKeys, "getEnumerableKeys");
1188
+ function getEnumerableSymbols(target) {
1189
+ var keys = [];
1190
+ var allKeys = Object.getOwnPropertySymbols(target);
1191
+ for (var i = 0; i < allKeys.length; i += 1) {
1192
+ var key = allKeys[i];
1193
+ if (Object.getOwnPropertyDescriptor(target, key).enumerable) {
1194
+ keys.push(key);
1195
+ }
1196
+ }
1197
+ return keys;
1198
+ }
1199
+ __name(getEnumerableSymbols, "getEnumerableSymbols");
1200
+ function keysEqual(leftHandOperand, rightHandOperand, keys, options) {
1201
+ var length = keys.length;
1202
+ if (length === 0) {
1203
+ return true;
1204
+ }
1205
+ for (var i = 0; i < length; i += 1) {
1206
+ if (deepEqual(leftHandOperand[keys[i]], rightHandOperand[keys[i]], options) === false) {
1207
+ return false;
1208
+ }
1209
+ }
1210
+ return true;
1211
+ }
1212
+ __name(keysEqual, "keysEqual");
1213
+ function objectEqual(leftHandOperand, rightHandOperand, options) {
1214
+ var leftHandKeys = getEnumerableKeys(leftHandOperand);
1215
+ var rightHandKeys = getEnumerableKeys(rightHandOperand);
1216
+ var leftHandSymbols = getEnumerableSymbols(leftHandOperand);
1217
+ var rightHandSymbols = getEnumerableSymbols(rightHandOperand);
1218
+ leftHandKeys = leftHandKeys.concat(leftHandSymbols);
1219
+ rightHandKeys = rightHandKeys.concat(rightHandSymbols);
1220
+ if (leftHandKeys.length && leftHandKeys.length === rightHandKeys.length) {
1221
+ if (iterableEqual(mapSymbols(leftHandKeys).sort(), mapSymbols(rightHandKeys).sort()) === false) {
1222
+ return false;
1223
+ }
1224
+ return keysEqual(leftHandOperand, rightHandOperand, leftHandKeys, options);
1225
+ }
1226
+ var leftHandEntries = getIteratorEntries(leftHandOperand);
1227
+ var rightHandEntries = getIteratorEntries(rightHandOperand);
1228
+ if (leftHandEntries.length && leftHandEntries.length === rightHandEntries.length) {
1229
+ leftHandEntries.sort();
1230
+ rightHandEntries.sort();
1231
+ return iterableEqual(leftHandEntries, rightHandEntries, options);
1232
+ }
1233
+ if (leftHandKeys.length === 0 && leftHandEntries.length === 0 && rightHandKeys.length === 0 && rightHandEntries.length === 0) {
1234
+ return true;
1235
+ }
1236
+ return false;
1237
+ }
1238
+ __name(objectEqual, "objectEqual");
1239
+ function isPrimitive(value) {
1240
+ return value === null || typeof value !== "object";
1241
+ }
1242
+ __name(isPrimitive, "isPrimitive");
1243
+ function mapSymbols(arr) {
1244
+ return arr.map(/* @__PURE__ */ __name(function mapSymbol(entry) {
1245
+ if (typeof entry === "symbol") {
1246
+ return entry.toString();
1247
+ }
1248
+ return entry;
1249
+ }, "mapSymbol"));
1250
+ }
1251
+ __name(mapSymbols, "mapSymbols");
1252
+ function hasProperty(obj, name) {
1253
+ if (typeof obj === "undefined" || obj === null) {
1254
+ return false;
1255
+ }
1256
+ return name in Object(obj);
1257
+ }
1258
+ __name(hasProperty, "hasProperty");
1259
+ function parsePath(path) {
1260
+ const str = path.replace(/([^\\])\[/g, "$1.[");
1261
+ const parts = str.match(/(\\\.|[^.]+?)+/g);
1262
+ return parts.map((value) => {
1263
+ if (value === "constructor" || value === "__proto__" || value === "prototype") {
1264
+ return {};
1265
+ }
1266
+ const regexp = /^\[(\d+)\]$/;
1267
+ const mArr = regexp.exec(value);
1268
+ let parsed = null;
1269
+ if (mArr) {
1270
+ parsed = { i: parseFloat(mArr[1]) };
1271
+ } else {
1272
+ parsed = { p: value.replace(/\\([.[\]])/g, "$1") };
1273
+ }
1274
+ return parsed;
1275
+ });
1276
+ }
1277
+ __name(parsePath, "parsePath");
1278
+ function internalGetPathValue(obj, parsed, pathDepth) {
1279
+ let temporaryValue = obj;
1280
+ let res = null;
1281
+ pathDepth = typeof pathDepth === "undefined" ? parsed.length : pathDepth;
1282
+ for (let i = 0; i < pathDepth; i++) {
1283
+ const part = parsed[i];
1284
+ if (temporaryValue) {
1285
+ if (typeof part.p === "undefined") {
1286
+ temporaryValue = temporaryValue[part.i];
1287
+ } else {
1288
+ temporaryValue = temporaryValue[part.p];
1289
+ }
1290
+ if (i === pathDepth - 1) {
1291
+ res = temporaryValue;
1292
+ }
1293
+ }
1294
+ }
1295
+ return res;
1296
+ }
1297
+ __name(internalGetPathValue, "internalGetPathValue");
1298
+ function getPathInfo(obj, path) {
1299
+ const parsed = parsePath(path);
1300
+ const last = parsed[parsed.length - 1];
1301
+ const info = {
1302
+ parent: parsed.length > 1 ? internalGetPathValue(obj, parsed, parsed.length - 1) : obj,
1303
+ name: last.p || last.i,
1304
+ value: internalGetPathValue(obj, parsed)
1305
+ };
1306
+ info.exists = hasProperty(info.parent, info.name);
1307
+ return info;
1308
+ }
1309
+ __name(getPathInfo, "getPathInfo");
1310
+ function Assertion(obj, msg, ssfi, lockSsfi) {
1311
+ flag(this, "ssfi", ssfi || Assertion);
1312
+ flag(this, "lockSsfi", lockSsfi);
1313
+ flag(this, "object", obj);
1314
+ flag(this, "message", msg);
1315
+ flag(this, "eql", config.deepEqual || deep_eql_default);
1316
+ return proxify(this);
1317
+ }
1318
+ __name(Assertion, "Assertion");
1319
+ Object.defineProperty(Assertion, "includeStack", {
1320
+ get: function() {
1321
+ console.warn(
1322
+ "Assertion.includeStack is deprecated, use chai.config.includeStack instead."
1323
+ );
1324
+ return config.includeStack;
1325
+ },
1326
+ set: function(value) {
1327
+ console.warn(
1328
+ "Assertion.includeStack is deprecated, use chai.config.includeStack instead."
1329
+ );
1330
+ config.includeStack = value;
1331
+ }
1332
+ });
1333
+ Object.defineProperty(Assertion, "showDiff", {
1334
+ get: function() {
1335
+ console.warn(
1336
+ "Assertion.showDiff is deprecated, use chai.config.showDiff instead."
1337
+ );
1338
+ return config.showDiff;
1339
+ },
1340
+ set: function(value) {
1341
+ console.warn(
1342
+ "Assertion.showDiff is deprecated, use chai.config.showDiff instead."
1343
+ );
1344
+ config.showDiff = value;
1345
+ }
1346
+ });
1347
+ Assertion.addProperty = function(name, fn) {
1348
+ addProperty(this.prototype, name, fn);
1349
+ };
1350
+ Assertion.addMethod = function(name, fn) {
1351
+ addMethod(this.prototype, name, fn);
1352
+ };
1353
+ Assertion.addChainableMethod = function(name, fn, chainingBehavior) {
1354
+ addChainableMethod(this.prototype, name, fn, chainingBehavior);
1355
+ };
1356
+ Assertion.overwriteProperty = function(name, fn) {
1357
+ overwriteProperty(this.prototype, name, fn);
1358
+ };
1359
+ Assertion.overwriteMethod = function(name, fn) {
1360
+ overwriteMethod(this.prototype, name, fn);
1361
+ };
1362
+ Assertion.overwriteChainableMethod = function(name, fn, chainingBehavior) {
1363
+ overwriteChainableMethod(this.prototype, name, fn, chainingBehavior);
1364
+ };
1365
+ Assertion.prototype.assert = function(expr, msg, negateMsg, expected, _actual, showDiff) {
1366
+ var ok = test(this, arguments);
1367
+ if (false !== showDiff)
1368
+ showDiff = true;
1369
+ if (void 0 === expected && void 0 === _actual)
1370
+ showDiff = false;
1371
+ if (true !== config.showDiff)
1372
+ showDiff = false;
1373
+ if (!ok) {
1374
+ msg = getMessage2(this, arguments);
1375
+ var actual = getActual(this, arguments);
1376
+ var assertionErrorObjectProperties = {
1377
+ actual,
1378
+ expected,
1379
+ showDiff
1380
+ };
1381
+ var operator = getOperator(this, arguments);
1382
+ if (operator) {
1383
+ assertionErrorObjectProperties.operator = operator;
1384
+ }
1385
+ throw new AssertionError(
1386
+ msg,
1387
+ assertionErrorObjectProperties,
1388
+ config.includeStack ? this.assert : flag(this, "ssfi")
1389
+ );
1390
+ }
1391
+ };
1392
+ Object.defineProperty(Assertion.prototype, "_obj", {
1393
+ get: function() {
1394
+ return flag(this, "object");
1395
+ },
1396
+ set: function(val) {
1397
+ flag(this, "object", val);
1398
+ }
1399
+ });
1400
+ function isProxyEnabled() {
1401
+ return config.useProxy && typeof Proxy !== "undefined" && typeof Reflect !== "undefined";
1402
+ }
1403
+ __name(isProxyEnabled, "isProxyEnabled");
1404
+ function addProperty(ctx, name, getter) {
1405
+ getter = getter === void 0 ? function() {
1406
+ } : getter;
1407
+ Object.defineProperty(ctx, name, {
1408
+ get: /* @__PURE__ */ __name(function propertyGetter() {
1409
+ if (!isProxyEnabled() && !flag(this, "lockSsfi")) {
1410
+ flag(this, "ssfi", propertyGetter);
1411
+ }
1412
+ var result = getter.call(this);
1413
+ if (result !== void 0)
1414
+ return result;
1415
+ var newAssertion = new Assertion();
1416
+ transferFlags(this, newAssertion);
1417
+ return newAssertion;
1418
+ }, "propertyGetter"),
1419
+ configurable: true
1420
+ });
1421
+ }
1422
+ __name(addProperty, "addProperty");
1423
+ var fnLengthDesc = Object.getOwnPropertyDescriptor(function() {
1424
+ }, "length");
1425
+ function addLengthGuard(fn, assertionName, isChainable) {
1426
+ if (!fnLengthDesc.configurable)
1427
+ return fn;
1428
+ Object.defineProperty(fn, "length", {
1429
+ get: function() {
1430
+ if (isChainable) {
1431
+ throw Error(
1432
+ "Invalid Chai property: " + assertionName + '.length. Due to a compatibility issue, "length" cannot directly follow "' + assertionName + '". Use "' + assertionName + '.lengthOf" instead.'
1433
+ );
1434
+ }
1435
+ throw Error(
1436
+ "Invalid Chai property: " + assertionName + '.length. See docs for proper usage of "' + assertionName + '".'
1437
+ );
1438
+ }
1439
+ });
1440
+ return fn;
1441
+ }
1442
+ __name(addLengthGuard, "addLengthGuard");
1443
+ function getProperties(object) {
1444
+ var result = Object.getOwnPropertyNames(object);
1445
+ function addProperty2(property) {
1446
+ if (result.indexOf(property) === -1) {
1447
+ result.push(property);
1448
+ }
1449
+ }
1450
+ __name(addProperty2, "addProperty");
1451
+ var proto = Object.getPrototypeOf(object);
1452
+ while (proto !== null) {
1453
+ Object.getOwnPropertyNames(proto).forEach(addProperty2);
1454
+ proto = Object.getPrototypeOf(proto);
1455
+ }
1456
+ return result;
1457
+ }
1458
+ __name(getProperties, "getProperties");
1459
+ var builtins = ["__flags", "__methods", "_obj", "assert"];
1460
+ function proxify(obj, nonChainableMethodName) {
1461
+ if (!isProxyEnabled())
1462
+ return obj;
1463
+ return new Proxy(obj, {
1464
+ get: /* @__PURE__ */ __name(function proxyGetter(target, property) {
1465
+ if (typeof property === "string" && config.proxyExcludedKeys.indexOf(property) === -1 && !Reflect.has(target, property)) {
1466
+ if (nonChainableMethodName) {
1467
+ throw Error(
1468
+ "Invalid Chai property: " + nonChainableMethodName + "." + property + '. See docs for proper usage of "' + nonChainableMethodName + '".'
1469
+ );
1470
+ }
1471
+ var suggestion = null;
1472
+ var suggestionDistance = 4;
1473
+ getProperties(target).forEach(function(prop) {
1474
+ if (
1475
+ // we actually mean to check `Object.prototype` here
1476
+ // eslint-disable-next-line no-prototype-builtins
1477
+ !Object.prototype.hasOwnProperty(prop) && builtins.indexOf(prop) === -1
1478
+ ) {
1479
+ var dist = stringDistanceCapped(property, prop, suggestionDistance);
1480
+ if (dist < suggestionDistance) {
1481
+ suggestion = prop;
1482
+ suggestionDistance = dist;
1483
+ }
1484
+ }
1485
+ });
1486
+ if (suggestion !== null) {
1487
+ throw Error(
1488
+ "Invalid Chai property: " + property + '. Did you mean "' + suggestion + '"?'
1489
+ );
1490
+ } else {
1491
+ throw Error("Invalid Chai property: " + property);
1492
+ }
1493
+ }
1494
+ if (builtins.indexOf(property) === -1 && !flag(target, "lockSsfi")) {
1495
+ flag(target, "ssfi", proxyGetter);
1496
+ }
1497
+ return Reflect.get(target, property);
1498
+ }, "proxyGetter")
1499
+ });
1500
+ }
1501
+ __name(proxify, "proxify");
1502
+ function stringDistanceCapped(strA, strB, cap) {
1503
+ if (Math.abs(strA.length - strB.length) >= cap) {
1504
+ return cap;
1505
+ }
1506
+ var memo = [];
1507
+ for (let i = 0; i <= strA.length; i++) {
1508
+ memo[i] = Array(strB.length + 1).fill(0);
1509
+ memo[i][0] = i;
1510
+ }
1511
+ for (let j = 0; j < strB.length; j++) {
1512
+ memo[0][j] = j;
1513
+ }
1514
+ for (let i = 1; i <= strA.length; i++) {
1515
+ var ch = strA.charCodeAt(i - 1);
1516
+ for (let j = 1; j <= strB.length; j++) {
1517
+ if (Math.abs(i - j) >= cap) {
1518
+ memo[i][j] = cap;
1519
+ continue;
1520
+ }
1521
+ memo[i][j] = Math.min(
1522
+ memo[i - 1][j] + 1,
1523
+ memo[i][j - 1] + 1,
1524
+ memo[i - 1][j - 1] + (ch === strB.charCodeAt(j - 1) ? 0 : 1)
1525
+ );
1526
+ }
1527
+ }
1528
+ return memo[strA.length][strB.length];
1529
+ }
1530
+ __name(stringDistanceCapped, "stringDistanceCapped");
1531
+ function addMethod(ctx, name, method) {
1532
+ var methodWrapper = /* @__PURE__ */ __name(function() {
1533
+ if (!flag(this, "lockSsfi")) {
1534
+ flag(this, "ssfi", methodWrapper);
1535
+ }
1536
+ var result = method.apply(this, arguments);
1537
+ if (result !== void 0)
1538
+ return result;
1539
+ var newAssertion = new Assertion();
1540
+ transferFlags(this, newAssertion);
1541
+ return newAssertion;
1542
+ }, "methodWrapper");
1543
+ addLengthGuard(methodWrapper, name, false);
1544
+ ctx[name] = proxify(methodWrapper, name);
1545
+ }
1546
+ __name(addMethod, "addMethod");
1547
+ function overwriteProperty(ctx, name, getter) {
1548
+ var _get = Object.getOwnPropertyDescriptor(ctx, name), _super = /* @__PURE__ */ __name(function() {
1549
+ }, "_super");
1550
+ if (_get && "function" === typeof _get.get)
1551
+ _super = _get.get;
1552
+ Object.defineProperty(ctx, name, {
1553
+ get: /* @__PURE__ */ __name(function overwritingPropertyGetter() {
1554
+ if (!isProxyEnabled() && !flag(this, "lockSsfi")) {
1555
+ flag(this, "ssfi", overwritingPropertyGetter);
1556
+ }
1557
+ var origLockSsfi = flag(this, "lockSsfi");
1558
+ flag(this, "lockSsfi", true);
1559
+ var result = getter(_super).call(this);
1560
+ flag(this, "lockSsfi", origLockSsfi);
1561
+ if (result !== void 0) {
1562
+ return result;
1563
+ }
1564
+ var newAssertion = new Assertion();
1565
+ transferFlags(this, newAssertion);
1566
+ return newAssertion;
1567
+ }, "overwritingPropertyGetter"),
1568
+ configurable: true
1569
+ });
1570
+ }
1571
+ __name(overwriteProperty, "overwriteProperty");
1572
+ function overwriteMethod(ctx, name, method) {
1573
+ var _method = ctx[name], _super = /* @__PURE__ */ __name(function() {
1574
+ throw new Error(name + " is not a function");
1575
+ }, "_super");
1576
+ if (_method && "function" === typeof _method)
1577
+ _super = _method;
1578
+ var overwritingMethodWrapper = /* @__PURE__ */ __name(function() {
1579
+ if (!flag(this, "lockSsfi")) {
1580
+ flag(this, "ssfi", overwritingMethodWrapper);
1581
+ }
1582
+ var origLockSsfi = flag(this, "lockSsfi");
1583
+ flag(this, "lockSsfi", true);
1584
+ var result = method(_super).apply(this, arguments);
1585
+ flag(this, "lockSsfi", origLockSsfi);
1586
+ if (result !== void 0) {
1587
+ return result;
1588
+ }
1589
+ var newAssertion = new Assertion();
1590
+ transferFlags(this, newAssertion);
1591
+ return newAssertion;
1592
+ }, "overwritingMethodWrapper");
1593
+ addLengthGuard(overwritingMethodWrapper, name, false);
1594
+ ctx[name] = proxify(overwritingMethodWrapper, name);
1595
+ }
1596
+ __name(overwriteMethod, "overwriteMethod");
1597
+ var canSetPrototype = typeof Object.setPrototypeOf === "function";
1598
+ var testFn = /* @__PURE__ */ __name(function() {
1599
+ }, "testFn");
1600
+ var excludeNames = Object.getOwnPropertyNames(testFn).filter(function(name) {
1601
+ var propDesc = Object.getOwnPropertyDescriptor(testFn, name);
1602
+ if (typeof propDesc !== "object")
1603
+ return true;
1604
+ return !propDesc.configurable;
1605
+ });
1606
+ var call = Function.prototype.call;
1607
+ var apply = Function.prototype.apply;
1608
+ function addChainableMethod(ctx, name, method, chainingBehavior) {
1609
+ if (typeof chainingBehavior !== "function") {
1610
+ chainingBehavior = /* @__PURE__ */ __name(function() {
1611
+ }, "chainingBehavior");
1612
+ }
1613
+ var chainableBehavior = {
1614
+ method,
1615
+ chainingBehavior
1616
+ };
1617
+ if (!ctx.__methods) {
1618
+ ctx.__methods = {};
1619
+ }
1620
+ ctx.__methods[name] = chainableBehavior;
1621
+ Object.defineProperty(ctx, name, {
1622
+ get: /* @__PURE__ */ __name(function chainableMethodGetter() {
1623
+ chainableBehavior.chainingBehavior.call(this);
1624
+ var chainableMethodWrapper = /* @__PURE__ */ __name(function() {
1625
+ if (!flag(this, "lockSsfi")) {
1626
+ flag(this, "ssfi", chainableMethodWrapper);
1627
+ }
1628
+ var result = chainableBehavior.method.apply(this, arguments);
1629
+ if (result !== void 0) {
1630
+ return result;
1631
+ }
1632
+ var newAssertion = new Assertion();
1633
+ transferFlags(this, newAssertion);
1634
+ return newAssertion;
1635
+ }, "chainableMethodWrapper");
1636
+ addLengthGuard(chainableMethodWrapper, name, true);
1637
+ if (canSetPrototype) {
1638
+ var prototype = Object.create(this);
1639
+ prototype.call = call;
1640
+ prototype.apply = apply;
1641
+ Object.setPrototypeOf(chainableMethodWrapper, prototype);
1642
+ } else {
1643
+ var asserterNames = Object.getOwnPropertyNames(ctx);
1644
+ asserterNames.forEach(function(asserterName) {
1645
+ if (excludeNames.indexOf(asserterName) !== -1) {
1646
+ return;
1647
+ }
1648
+ var pd = Object.getOwnPropertyDescriptor(ctx, asserterName);
1649
+ Object.defineProperty(chainableMethodWrapper, asserterName, pd);
1650
+ });
1651
+ }
1652
+ transferFlags(this, chainableMethodWrapper);
1653
+ return proxify(chainableMethodWrapper);
1654
+ }, "chainableMethodGetter"),
1655
+ configurable: true
1656
+ });
1657
+ }
1658
+ __name(addChainableMethod, "addChainableMethod");
1659
+ function overwriteChainableMethod(ctx, name, method, chainingBehavior) {
1660
+ var chainableBehavior = ctx.__methods[name];
1661
+ var _chainingBehavior = chainableBehavior.chainingBehavior;
1662
+ chainableBehavior.chainingBehavior = /* @__PURE__ */ __name(function overwritingChainableMethodGetter() {
1663
+ var result = chainingBehavior(_chainingBehavior).call(this);
1664
+ if (result !== void 0) {
1665
+ return result;
1666
+ }
1667
+ var newAssertion = new Assertion();
1668
+ transferFlags(this, newAssertion);
1669
+ return newAssertion;
1670
+ }, "overwritingChainableMethodGetter");
1671
+ var _method = chainableBehavior.method;
1672
+ chainableBehavior.method = /* @__PURE__ */ __name(function overwritingChainableMethodWrapper() {
1673
+ var result = method(_method).apply(this, arguments);
1674
+ if (result !== void 0) {
1675
+ return result;
1676
+ }
1677
+ var newAssertion = new Assertion();
1678
+ transferFlags(this, newAssertion);
1679
+ return newAssertion;
1680
+ }, "overwritingChainableMethodWrapper");
1681
+ }
1682
+ __name(overwriteChainableMethod, "overwriteChainableMethod");
1683
+ function compareByInspect(a, b) {
1684
+ return inspect2(a) < inspect2(b) ? -1 : 1;
1685
+ }
1686
+ __name(compareByInspect, "compareByInspect");
1687
+ function getOwnEnumerablePropertySymbols(obj) {
1688
+ if (typeof Object.getOwnPropertySymbols !== "function")
1689
+ return [];
1690
+ return Object.getOwnPropertySymbols(obj).filter(function(sym) {
1691
+ return Object.getOwnPropertyDescriptor(obj, sym).enumerable;
1692
+ });
1693
+ }
1694
+ __name(getOwnEnumerablePropertySymbols, "getOwnEnumerablePropertySymbols");
1695
+ function getOwnEnumerableProperties(obj) {
1696
+ return Object.keys(obj).concat(getOwnEnumerablePropertySymbols(obj));
1697
+ }
1698
+ __name(getOwnEnumerableProperties, "getOwnEnumerableProperties");
1699
+ var isNaN2 = Number.isNaN;
1700
+ function isObjectType(obj) {
1701
+ var objectType = type(obj);
1702
+ var objectTypes = ["Array", "Object", "Function"];
1703
+ return objectTypes.indexOf(objectType) !== -1;
1704
+ }
1705
+ __name(isObjectType, "isObjectType");
1706
+ function getOperator(obj, args) {
1707
+ var operator = flag(obj, "operator");
1708
+ var negate = flag(obj, "negate");
1709
+ var expected = args[3];
1710
+ var msg = negate ? args[2] : args[1];
1711
+ if (operator) {
1712
+ return operator;
1713
+ }
1714
+ if (typeof msg === "function")
1715
+ msg = msg();
1716
+ msg = msg || "";
1717
+ if (!msg) {
1718
+ return void 0;
1719
+ }
1720
+ if (/\shave\s/.test(msg)) {
1721
+ return void 0;
1722
+ }
1723
+ var isObject = isObjectType(expected);
1724
+ if (/\snot\s/.test(msg)) {
1725
+ return isObject ? "notDeepStrictEqual" : "notStrictEqual";
1726
+ }
1727
+ return isObject ? "deepStrictEqual" : "strictEqual";
1728
+ }
1729
+ __name(getOperator, "getOperator");
1730
+ function getName(fn) {
1731
+ return fn.name;
1732
+ }
1733
+ __name(getName, "getName");
1734
+ function isRegExp2(obj) {
1735
+ return Object.prototype.toString.call(obj) === "[object RegExp]";
1736
+ }
1737
+ __name(isRegExp2, "isRegExp");
1738
+ function isNumeric(obj) {
1739
+ return ["Number", "BigInt"].includes(type(obj));
1740
+ }
1741
+ __name(isNumeric, "isNumeric");
1742
+ var { flag: flag2 } = utils_exports;
1743
+ [
1744
+ "to",
1745
+ "be",
1746
+ "been",
1747
+ "is",
1748
+ "and",
1749
+ "has",
1750
+ "have",
1751
+ "with",
1752
+ "that",
1753
+ "which",
1754
+ "at",
1755
+ "of",
1756
+ "same",
1757
+ "but",
1758
+ "does",
1759
+ "still",
1760
+ "also"
1761
+ ].forEach(function(chain) {
1762
+ Assertion.addProperty(chain);
1763
+ });
1764
+ Assertion.addProperty("not", function() {
1765
+ flag2(this, "negate", true);
1766
+ });
1767
+ Assertion.addProperty("deep", function() {
1768
+ flag2(this, "deep", true);
1769
+ });
1770
+ Assertion.addProperty("nested", function() {
1771
+ flag2(this, "nested", true);
1772
+ });
1773
+ Assertion.addProperty("own", function() {
1774
+ flag2(this, "own", true);
1775
+ });
1776
+ Assertion.addProperty("ordered", function() {
1777
+ flag2(this, "ordered", true);
1778
+ });
1779
+ Assertion.addProperty("any", function() {
1780
+ flag2(this, "any", true);
1781
+ flag2(this, "all", false);
1782
+ });
1783
+ Assertion.addProperty("all", function() {
1784
+ flag2(this, "all", true);
1785
+ flag2(this, "any", false);
1786
+ });
1787
+ var functionTypes = {
1788
+ function: [
1789
+ "function",
1790
+ "asyncfunction",
1791
+ "generatorfunction",
1792
+ "asyncgeneratorfunction"
1793
+ ],
1794
+ asyncfunction: ["asyncfunction", "asyncgeneratorfunction"],
1795
+ generatorfunction: ["generatorfunction", "asyncgeneratorfunction"],
1796
+ asyncgeneratorfunction: ["asyncgeneratorfunction"]
1797
+ };
1798
+ function an(type3, msg) {
1799
+ if (msg)
1800
+ flag2(this, "message", msg);
1801
+ type3 = type3.toLowerCase();
1802
+ var obj = flag2(this, "object"), article = ~["a", "e", "i", "o", "u"].indexOf(type3.charAt(0)) ? "an " : "a ";
1803
+ const detectedType = type(obj).toLowerCase();
1804
+ if (functionTypes["function"].includes(type3)) {
1805
+ this.assert(
1806
+ functionTypes[type3].includes(detectedType),
1807
+ "expected #{this} to be " + article + type3,
1808
+ "expected #{this} not to be " + article + type3
1809
+ );
1810
+ } else {
1811
+ this.assert(
1812
+ type3 === detectedType,
1813
+ "expected #{this} to be " + article + type3,
1814
+ "expected #{this} not to be " + article + type3
1815
+ );
1816
+ }
1817
+ }
1818
+ __name(an, "an");
1819
+ Assertion.addChainableMethod("an", an);
1820
+ Assertion.addChainableMethod("a", an);
1821
+ function SameValueZero(a, b) {
1822
+ return isNaN2(a) && isNaN2(b) || a === b;
1823
+ }
1824
+ __name(SameValueZero, "SameValueZero");
1825
+ function includeChainingBehavior() {
1826
+ flag2(this, "contains", true);
1827
+ }
1828
+ __name(includeChainingBehavior, "includeChainingBehavior");
1829
+ function include(val, msg) {
1830
+ if (msg)
1831
+ flag2(this, "message", msg);
1832
+ var obj = flag2(this, "object"), objType = type(obj).toLowerCase(), flagMsg = flag2(this, "message"), negate = flag2(this, "negate"), ssfi = flag2(this, "ssfi"), isDeep = flag2(this, "deep"), descriptor = isDeep ? "deep " : "", isEql = isDeep ? flag2(this, "eql") : SameValueZero;
1833
+ flagMsg = flagMsg ? flagMsg + ": " : "";
1834
+ var included = false;
1835
+ switch (objType) {
1836
+ case "string":
1837
+ included = obj.indexOf(val) !== -1;
1838
+ break;
1839
+ case "weakset":
1840
+ if (isDeep) {
1841
+ throw new AssertionError(
1842
+ flagMsg + "unable to use .deep.include with WeakSet",
1843
+ void 0,
1844
+ ssfi
1845
+ );
1846
+ }
1847
+ included = obj.has(val);
1848
+ break;
1849
+ case "map":
1850
+ obj.forEach(function(item) {
1851
+ included = included || isEql(item, val);
1852
+ });
1853
+ break;
1854
+ case "set":
1855
+ if (isDeep) {
1856
+ obj.forEach(function(item) {
1857
+ included = included || isEql(item, val);
1858
+ });
1859
+ } else {
1860
+ included = obj.has(val);
1861
+ }
1862
+ break;
1863
+ case "array":
1864
+ if (isDeep) {
1865
+ included = obj.some(function(item) {
1866
+ return isEql(item, val);
1867
+ });
1868
+ } else {
1869
+ included = obj.indexOf(val) !== -1;
1870
+ }
1871
+ break;
1872
+ default:
1873
+ if (val !== Object(val)) {
1874
+ throw new AssertionError(
1875
+ flagMsg + "the given combination of arguments (" + objType + " and " + type(val).toLowerCase() + ") is invalid for this assertion. You can use an array, a map, an object, a set, a string, or a weakset instead of a " + type(val).toLowerCase(),
1876
+ void 0,
1877
+ ssfi
1878
+ );
1879
+ }
1880
+ var props = Object.keys(val), firstErr = null, numErrs = 0;
1881
+ props.forEach(function(prop) {
1882
+ var propAssertion = new Assertion(obj);
1883
+ transferFlags(this, propAssertion, true);
1884
+ flag2(propAssertion, "lockSsfi", true);
1885
+ if (!negate || props.length === 1) {
1886
+ propAssertion.property(prop, val[prop]);
1887
+ return;
1888
+ }
1889
+ try {
1890
+ propAssertion.property(prop, val[prop]);
1891
+ } catch (err) {
1892
+ if (!check_error_exports.compatibleConstructor(err, AssertionError)) {
1893
+ throw err;
1894
+ }
1895
+ if (firstErr === null)
1896
+ firstErr = err;
1897
+ numErrs++;
1898
+ }
1899
+ }, this);
1900
+ if (negate && props.length > 1 && numErrs === props.length) {
1901
+ throw firstErr;
1902
+ }
1903
+ return;
1904
+ }
1905
+ this.assert(
1906
+ included,
1907
+ "expected #{this} to " + descriptor + "include " + inspect2(val),
1908
+ "expected #{this} to not " + descriptor + "include " + inspect2(val)
1909
+ );
1910
+ }
1911
+ __name(include, "include");
1912
+ Assertion.addChainableMethod("include", include, includeChainingBehavior);
1913
+ Assertion.addChainableMethod("contain", include, includeChainingBehavior);
1914
+ Assertion.addChainableMethod("contains", include, includeChainingBehavior);
1915
+ Assertion.addChainableMethod("includes", include, includeChainingBehavior);
1916
+ Assertion.addProperty("ok", function() {
1917
+ this.assert(
1918
+ flag2(this, "object"),
1919
+ "expected #{this} to be truthy",
1920
+ "expected #{this} to be falsy"
1921
+ );
1922
+ });
1923
+ Assertion.addProperty("true", function() {
1924
+ this.assert(
1925
+ true === flag2(this, "object"),
1926
+ "expected #{this} to be true",
1927
+ "expected #{this} to be false",
1928
+ flag2(this, "negate") ? false : true
1929
+ );
1930
+ });
1931
+ Assertion.addProperty("numeric", function() {
1932
+ const object = flag2(this, "object");
1933
+ this.assert(
1934
+ ["Number", "BigInt"].includes(type(object)),
1935
+ "expected #{this} to be numeric",
1936
+ "expected #{this} to not be numeric",
1937
+ flag2(this, "negate") ? false : true
1938
+ );
1939
+ });
1940
+ Assertion.addProperty("callable", function() {
1941
+ const val = flag2(this, "object");
1942
+ const ssfi = flag2(this, "ssfi");
1943
+ const message = flag2(this, "message");
1944
+ const msg = message ? `${message}: ` : "";
1945
+ const negate = flag2(this, "negate");
1946
+ const assertionMessage = negate ? `${msg}expected ${inspect2(val)} not to be a callable function` : `${msg}expected ${inspect2(val)} to be a callable function`;
1947
+ const isCallable = [
1948
+ "Function",
1949
+ "AsyncFunction",
1950
+ "GeneratorFunction",
1951
+ "AsyncGeneratorFunction"
1952
+ ].includes(type(val));
1953
+ if (isCallable && negate || !isCallable && !negate) {
1954
+ throw new AssertionError(assertionMessage, void 0, ssfi);
1955
+ }
1956
+ });
1957
+ Assertion.addProperty("false", function() {
1958
+ this.assert(
1959
+ false === flag2(this, "object"),
1960
+ "expected #{this} to be false",
1961
+ "expected #{this} to be true",
1962
+ flag2(this, "negate") ? true : false
1963
+ );
1964
+ });
1965
+ Assertion.addProperty("null", function() {
1966
+ this.assert(
1967
+ null === flag2(this, "object"),
1968
+ "expected #{this} to be null",
1969
+ "expected #{this} not to be null"
1970
+ );
1971
+ });
1972
+ Assertion.addProperty("undefined", function() {
1973
+ this.assert(
1974
+ void 0 === flag2(this, "object"),
1975
+ "expected #{this} to be undefined",
1976
+ "expected #{this} not to be undefined"
1977
+ );
1978
+ });
1979
+ Assertion.addProperty("NaN", function() {
1980
+ this.assert(
1981
+ isNaN2(flag2(this, "object")),
1982
+ "expected #{this} to be NaN",
1983
+ "expected #{this} not to be NaN"
1984
+ );
1985
+ });
1986
+ function assertExist() {
1987
+ var val = flag2(this, "object");
1988
+ this.assert(
1989
+ val !== null && val !== void 0,
1990
+ "expected #{this} to exist",
1991
+ "expected #{this} to not exist"
1992
+ );
1993
+ }
1994
+ __name(assertExist, "assertExist");
1995
+ Assertion.addProperty("exist", assertExist);
1996
+ Assertion.addProperty("exists", assertExist);
1997
+ Assertion.addProperty("empty", function() {
1998
+ var val = flag2(this, "object"), ssfi = flag2(this, "ssfi"), flagMsg = flag2(this, "message"), itemsCount;
1999
+ flagMsg = flagMsg ? flagMsg + ": " : "";
2000
+ switch (type(val).toLowerCase()) {
2001
+ case "array":
2002
+ case "string":
2003
+ itemsCount = val.length;
2004
+ break;
2005
+ case "map":
2006
+ case "set":
2007
+ itemsCount = val.size;
2008
+ break;
2009
+ case "weakmap":
2010
+ case "weakset":
2011
+ throw new AssertionError(
2012
+ flagMsg + ".empty was passed a weak collection",
2013
+ void 0,
2014
+ ssfi
2015
+ );
2016
+ case "function":
2017
+ var msg = flagMsg + ".empty was passed a function " + getName(val);
2018
+ throw new AssertionError(msg.trim(), void 0, ssfi);
2019
+ default:
2020
+ if (val !== Object(val)) {
2021
+ throw new AssertionError(
2022
+ flagMsg + ".empty was passed non-string primitive " + inspect2(val),
2023
+ void 0,
2024
+ ssfi
2025
+ );
2026
+ }
2027
+ itemsCount = Object.keys(val).length;
2028
+ }
2029
+ this.assert(
2030
+ 0 === itemsCount,
2031
+ "expected #{this} to be empty",
2032
+ "expected #{this} not to be empty"
2033
+ );
2034
+ });
2035
+ function checkArguments() {
2036
+ var obj = flag2(this, "object"), type3 = type(obj);
2037
+ this.assert(
2038
+ "Arguments" === type3,
2039
+ "expected #{this} to be arguments but got " + type3,
2040
+ "expected #{this} to not be arguments"
2041
+ );
2042
+ }
2043
+ __name(checkArguments, "checkArguments");
2044
+ Assertion.addProperty("arguments", checkArguments);
2045
+ Assertion.addProperty("Arguments", checkArguments);
2046
+ function assertEqual(val, msg) {
2047
+ if (msg)
2048
+ flag2(this, "message", msg);
2049
+ var obj = flag2(this, "object");
2050
+ if (flag2(this, "deep")) {
2051
+ var prevLockSsfi = flag2(this, "lockSsfi");
2052
+ flag2(this, "lockSsfi", true);
2053
+ this.eql(val);
2054
+ flag2(this, "lockSsfi", prevLockSsfi);
2055
+ } else {
2056
+ this.assert(
2057
+ val === obj,
2058
+ "expected #{this} to equal #{exp}",
2059
+ "expected #{this} to not equal #{exp}",
2060
+ val,
2061
+ this._obj,
2062
+ true
2063
+ );
2064
+ }
2065
+ }
2066
+ __name(assertEqual, "assertEqual");
2067
+ Assertion.addMethod("equal", assertEqual);
2068
+ Assertion.addMethod("equals", assertEqual);
2069
+ Assertion.addMethod("eq", assertEqual);
2070
+ function assertEql(obj, msg) {
2071
+ if (msg)
2072
+ flag2(this, "message", msg);
2073
+ var eql = flag2(this, "eql");
2074
+ this.assert(
2075
+ eql(obj, flag2(this, "object")),
2076
+ "expected #{this} to deeply equal #{exp}",
2077
+ "expected #{this} to not deeply equal #{exp}",
2078
+ obj,
2079
+ this._obj,
2080
+ true
2081
+ );
2082
+ }
2083
+ __name(assertEql, "assertEql");
2084
+ Assertion.addMethod("eql", assertEql);
2085
+ Assertion.addMethod("eqls", assertEql);
2086
+ function assertAbove(n, msg) {
2087
+ if (msg)
2088
+ flag2(this, "message", msg);
2089
+ var obj = flag2(this, "object"), doLength = flag2(this, "doLength"), flagMsg = flag2(this, "message"), msgPrefix = flagMsg ? flagMsg + ": " : "", ssfi = flag2(this, "ssfi"), objType = type(obj).toLowerCase(), nType = type(n).toLowerCase();
2090
+ if (doLength && objType !== "map" && objType !== "set") {
2091
+ new Assertion(obj, flagMsg, ssfi, true).to.have.property("length");
2092
+ }
2093
+ if (!doLength && objType === "date" && nType !== "date") {
2094
+ throw new AssertionError(
2095
+ msgPrefix + "the argument to above must be a date",
2096
+ void 0,
2097
+ ssfi
2098
+ );
2099
+ } else if (!isNumeric(n) && (doLength || isNumeric(obj))) {
2100
+ throw new AssertionError(
2101
+ msgPrefix + "the argument to above must be a number",
2102
+ void 0,
2103
+ ssfi
2104
+ );
2105
+ } else if (!doLength && objType !== "date" && !isNumeric(obj)) {
2106
+ var printObj = objType === "string" ? "'" + obj + "'" : obj;
2107
+ throw new AssertionError(
2108
+ msgPrefix + "expected " + printObj + " to be a number or a date",
2109
+ void 0,
2110
+ ssfi
2111
+ );
2112
+ }
2113
+ if (doLength) {
2114
+ var descriptor = "length", itemsCount;
2115
+ if (objType === "map" || objType === "set") {
2116
+ descriptor = "size";
2117
+ itemsCount = obj.size;
2118
+ } else {
2119
+ itemsCount = obj.length;
2120
+ }
2121
+ this.assert(
2122
+ itemsCount > n,
2123
+ "expected #{this} to have a " + descriptor + " above #{exp} but got #{act}",
2124
+ "expected #{this} to not have a " + descriptor + " above #{exp}",
2125
+ n,
2126
+ itemsCount
2127
+ );
2128
+ } else {
2129
+ this.assert(
2130
+ obj > n,
2131
+ "expected #{this} to be above #{exp}",
2132
+ "expected #{this} to be at most #{exp}",
2133
+ n
2134
+ );
2135
+ }
2136
+ }
2137
+ __name(assertAbove, "assertAbove");
2138
+ Assertion.addMethod("above", assertAbove);
2139
+ Assertion.addMethod("gt", assertAbove);
2140
+ Assertion.addMethod("greaterThan", assertAbove);
2141
+ function assertLeast(n, msg) {
2142
+ if (msg)
2143
+ flag2(this, "message", msg);
2144
+ var obj = flag2(this, "object"), doLength = flag2(this, "doLength"), flagMsg = flag2(this, "message"), msgPrefix = flagMsg ? flagMsg + ": " : "", ssfi = flag2(this, "ssfi"), objType = type(obj).toLowerCase(), nType = type(n).toLowerCase(), errorMessage, shouldThrow = true;
2145
+ if (doLength && objType !== "map" && objType !== "set") {
2146
+ new Assertion(obj, flagMsg, ssfi, true).to.have.property("length");
2147
+ }
2148
+ if (!doLength && objType === "date" && nType !== "date") {
2149
+ errorMessage = msgPrefix + "the argument to least must be a date";
2150
+ } else if (!isNumeric(n) && (doLength || isNumeric(obj))) {
2151
+ errorMessage = msgPrefix + "the argument to least must be a number";
2152
+ } else if (!doLength && objType !== "date" && !isNumeric(obj)) {
2153
+ var printObj = objType === "string" ? "'" + obj + "'" : obj;
2154
+ errorMessage = msgPrefix + "expected " + printObj + " to be a number or a date";
2155
+ } else {
2156
+ shouldThrow = false;
2157
+ }
2158
+ if (shouldThrow) {
2159
+ throw new AssertionError(errorMessage, void 0, ssfi);
2160
+ }
2161
+ if (doLength) {
2162
+ var descriptor = "length", itemsCount;
2163
+ if (objType === "map" || objType === "set") {
2164
+ descriptor = "size";
2165
+ itemsCount = obj.size;
2166
+ } else {
2167
+ itemsCount = obj.length;
2168
+ }
2169
+ this.assert(
2170
+ itemsCount >= n,
2171
+ "expected #{this} to have a " + descriptor + " at least #{exp} but got #{act}",
2172
+ "expected #{this} to have a " + descriptor + " below #{exp}",
2173
+ n,
2174
+ itemsCount
2175
+ );
2176
+ } else {
2177
+ this.assert(
2178
+ obj >= n,
2179
+ "expected #{this} to be at least #{exp}",
2180
+ "expected #{this} to be below #{exp}",
2181
+ n
2182
+ );
2183
+ }
2184
+ }
2185
+ __name(assertLeast, "assertLeast");
2186
+ Assertion.addMethod("least", assertLeast);
2187
+ Assertion.addMethod("gte", assertLeast);
2188
+ Assertion.addMethod("greaterThanOrEqual", assertLeast);
2189
+ function assertBelow(n, msg) {
2190
+ if (msg)
2191
+ flag2(this, "message", msg);
2192
+ var obj = flag2(this, "object"), doLength = flag2(this, "doLength"), flagMsg = flag2(this, "message"), msgPrefix = flagMsg ? flagMsg + ": " : "", ssfi = flag2(this, "ssfi"), objType = type(obj).toLowerCase(), nType = type(n).toLowerCase(), errorMessage, shouldThrow = true;
2193
+ if (doLength && objType !== "map" && objType !== "set") {
2194
+ new Assertion(obj, flagMsg, ssfi, true).to.have.property("length");
2195
+ }
2196
+ if (!doLength && objType === "date" && nType !== "date") {
2197
+ errorMessage = msgPrefix + "the argument to below must be a date";
2198
+ } else if (!isNumeric(n) && (doLength || isNumeric(obj))) {
2199
+ errorMessage = msgPrefix + "the argument to below must be a number";
2200
+ } else if (!doLength && objType !== "date" && !isNumeric(obj)) {
2201
+ var printObj = objType === "string" ? "'" + obj + "'" : obj;
2202
+ errorMessage = msgPrefix + "expected " + printObj + " to be a number or a date";
2203
+ } else {
2204
+ shouldThrow = false;
2205
+ }
2206
+ if (shouldThrow) {
2207
+ throw new AssertionError(errorMessage, void 0, ssfi);
2208
+ }
2209
+ if (doLength) {
2210
+ var descriptor = "length", itemsCount;
2211
+ if (objType === "map" || objType === "set") {
2212
+ descriptor = "size";
2213
+ itemsCount = obj.size;
2214
+ } else {
2215
+ itemsCount = obj.length;
2216
+ }
2217
+ this.assert(
2218
+ itemsCount < n,
2219
+ "expected #{this} to have a " + descriptor + " below #{exp} but got #{act}",
2220
+ "expected #{this} to not have a " + descriptor + " below #{exp}",
2221
+ n,
2222
+ itemsCount
2223
+ );
2224
+ } else {
2225
+ this.assert(
2226
+ obj < n,
2227
+ "expected #{this} to be below #{exp}",
2228
+ "expected #{this} to be at least #{exp}",
2229
+ n
2230
+ );
2231
+ }
2232
+ }
2233
+ __name(assertBelow, "assertBelow");
2234
+ Assertion.addMethod("below", assertBelow);
2235
+ Assertion.addMethod("lt", assertBelow);
2236
+ Assertion.addMethod("lessThan", assertBelow);
2237
+ function assertMost(n, msg) {
2238
+ if (msg)
2239
+ flag2(this, "message", msg);
2240
+ var obj = flag2(this, "object"), doLength = flag2(this, "doLength"), flagMsg = flag2(this, "message"), msgPrefix = flagMsg ? flagMsg + ": " : "", ssfi = flag2(this, "ssfi"), objType = type(obj).toLowerCase(), nType = type(n).toLowerCase(), errorMessage, shouldThrow = true;
2241
+ if (doLength && objType !== "map" && objType !== "set") {
2242
+ new Assertion(obj, flagMsg, ssfi, true).to.have.property("length");
2243
+ }
2244
+ if (!doLength && objType === "date" && nType !== "date") {
2245
+ errorMessage = msgPrefix + "the argument to most must be a date";
2246
+ } else if (!isNumeric(n) && (doLength || isNumeric(obj))) {
2247
+ errorMessage = msgPrefix + "the argument to most must be a number";
2248
+ } else if (!doLength && objType !== "date" && !isNumeric(obj)) {
2249
+ var printObj = objType === "string" ? "'" + obj + "'" : obj;
2250
+ errorMessage = msgPrefix + "expected " + printObj + " to be a number or a date";
2251
+ } else {
2252
+ shouldThrow = false;
2253
+ }
2254
+ if (shouldThrow) {
2255
+ throw new AssertionError(errorMessage, void 0, ssfi);
2256
+ }
2257
+ if (doLength) {
2258
+ var descriptor = "length", itemsCount;
2259
+ if (objType === "map" || objType === "set") {
2260
+ descriptor = "size";
2261
+ itemsCount = obj.size;
2262
+ } else {
2263
+ itemsCount = obj.length;
2264
+ }
2265
+ this.assert(
2266
+ itemsCount <= n,
2267
+ "expected #{this} to have a " + descriptor + " at most #{exp} but got #{act}",
2268
+ "expected #{this} to have a " + descriptor + " above #{exp}",
2269
+ n,
2270
+ itemsCount
2271
+ );
2272
+ } else {
2273
+ this.assert(
2274
+ obj <= n,
2275
+ "expected #{this} to be at most #{exp}",
2276
+ "expected #{this} to be above #{exp}",
2277
+ n
2278
+ );
2279
+ }
2280
+ }
2281
+ __name(assertMost, "assertMost");
2282
+ Assertion.addMethod("most", assertMost);
2283
+ Assertion.addMethod("lte", assertMost);
2284
+ Assertion.addMethod("lessThanOrEqual", assertMost);
2285
+ Assertion.addMethod("within", function(start, finish, msg) {
2286
+ if (msg)
2287
+ flag2(this, "message", msg);
2288
+ var obj = flag2(this, "object"), doLength = flag2(this, "doLength"), flagMsg = flag2(this, "message"), msgPrefix = flagMsg ? flagMsg + ": " : "", ssfi = flag2(this, "ssfi"), objType = type(obj).toLowerCase(), startType = type(start).toLowerCase(), finishType = type(finish).toLowerCase(), errorMessage, shouldThrow = true, range = startType === "date" && finishType === "date" ? start.toISOString() + ".." + finish.toISOString() : start + ".." + finish;
2289
+ if (doLength && objType !== "map" && objType !== "set") {
2290
+ new Assertion(obj, flagMsg, ssfi, true).to.have.property("length");
2291
+ }
2292
+ if (!doLength && objType === "date" && (startType !== "date" || finishType !== "date")) {
2293
+ errorMessage = msgPrefix + "the arguments to within must be dates";
2294
+ } else if ((!isNumeric(start) || !isNumeric(finish)) && (doLength || isNumeric(obj))) {
2295
+ errorMessage = msgPrefix + "the arguments to within must be numbers";
2296
+ } else if (!doLength && objType !== "date" && !isNumeric(obj)) {
2297
+ var printObj = objType === "string" ? "'" + obj + "'" : obj;
2298
+ errorMessage = msgPrefix + "expected " + printObj + " to be a number or a date";
2299
+ } else {
2300
+ shouldThrow = false;
2301
+ }
2302
+ if (shouldThrow) {
2303
+ throw new AssertionError(errorMessage, void 0, ssfi);
2304
+ }
2305
+ if (doLength) {
2306
+ var descriptor = "length", itemsCount;
2307
+ if (objType === "map" || objType === "set") {
2308
+ descriptor = "size";
2309
+ itemsCount = obj.size;
2310
+ } else {
2311
+ itemsCount = obj.length;
2312
+ }
2313
+ this.assert(
2314
+ itemsCount >= start && itemsCount <= finish,
2315
+ "expected #{this} to have a " + descriptor + " within " + range,
2316
+ "expected #{this} to not have a " + descriptor + " within " + range
2317
+ );
2318
+ } else {
2319
+ this.assert(
2320
+ obj >= start && obj <= finish,
2321
+ "expected #{this} to be within " + range,
2322
+ "expected #{this} to not be within " + range
2323
+ );
2324
+ }
2325
+ });
2326
+ function assertInstanceOf(constructor, msg) {
2327
+ if (msg)
2328
+ flag2(this, "message", msg);
2329
+ var target = flag2(this, "object");
2330
+ var ssfi = flag2(this, "ssfi");
2331
+ var flagMsg = flag2(this, "message");
2332
+ try {
2333
+ var isInstanceOf = target instanceof constructor;
2334
+ } catch (err) {
2335
+ if (err instanceof TypeError) {
2336
+ flagMsg = flagMsg ? flagMsg + ": " : "";
2337
+ throw new AssertionError(
2338
+ flagMsg + "The instanceof assertion needs a constructor but " + type(constructor) + " was given.",
2339
+ void 0,
2340
+ ssfi
2341
+ );
2342
+ }
2343
+ throw err;
2344
+ }
2345
+ var name = getName(constructor);
2346
+ if (name == null) {
2347
+ name = "an unnamed constructor";
2348
+ }
2349
+ this.assert(
2350
+ isInstanceOf,
2351
+ "expected #{this} to be an instance of " + name,
2352
+ "expected #{this} to not be an instance of " + name
2353
+ );
2354
+ }
2355
+ __name(assertInstanceOf, "assertInstanceOf");
2356
+ Assertion.addMethod("instanceof", assertInstanceOf);
2357
+ Assertion.addMethod("instanceOf", assertInstanceOf);
2358
+ function assertProperty(name, val, msg) {
2359
+ if (msg)
2360
+ flag2(this, "message", msg);
2361
+ var isNested = flag2(this, "nested"), isOwn = flag2(this, "own"), flagMsg = flag2(this, "message"), obj = flag2(this, "object"), ssfi = flag2(this, "ssfi"), nameType = typeof name;
2362
+ flagMsg = flagMsg ? flagMsg + ": " : "";
2363
+ if (isNested) {
2364
+ if (nameType !== "string") {
2365
+ throw new AssertionError(
2366
+ flagMsg + "the argument to property must be a string when using nested syntax",
2367
+ void 0,
2368
+ ssfi
2369
+ );
2370
+ }
2371
+ } else {
2372
+ if (nameType !== "string" && nameType !== "number" && nameType !== "symbol") {
2373
+ throw new AssertionError(
2374
+ flagMsg + "the argument to property must be a string, number, or symbol",
2375
+ void 0,
2376
+ ssfi
2377
+ );
2378
+ }
2379
+ }
2380
+ if (isNested && isOwn) {
2381
+ throw new AssertionError(
2382
+ flagMsg + 'The "nested" and "own" flags cannot be combined.',
2383
+ void 0,
2384
+ ssfi
2385
+ );
2386
+ }
2387
+ if (obj === null || obj === void 0) {
2388
+ throw new AssertionError(
2389
+ flagMsg + "Target cannot be null or undefined.",
2390
+ void 0,
2391
+ ssfi
2392
+ );
2393
+ }
2394
+ var isDeep = flag2(this, "deep"), negate = flag2(this, "negate"), pathInfo = isNested ? getPathInfo(obj, name) : null, value = isNested ? pathInfo.value : obj[name], isEql = isDeep ? flag2(this, "eql") : (val1, val2) => val1 === val2;
2395
+ var descriptor = "";
2396
+ if (isDeep)
2397
+ descriptor += "deep ";
2398
+ if (isOwn)
2399
+ descriptor += "own ";
2400
+ if (isNested)
2401
+ descriptor += "nested ";
2402
+ descriptor += "property ";
2403
+ var hasProperty2;
2404
+ if (isOwn)
2405
+ hasProperty2 = Object.prototype.hasOwnProperty.call(obj, name);
2406
+ else if (isNested)
2407
+ hasProperty2 = pathInfo.exists;
2408
+ else
2409
+ hasProperty2 = hasProperty(obj, name);
2410
+ if (!negate || arguments.length === 1) {
2411
+ this.assert(
2412
+ hasProperty2,
2413
+ "expected #{this} to have " + descriptor + inspect2(name),
2414
+ "expected #{this} to not have " + descriptor + inspect2(name)
2415
+ );
2416
+ }
2417
+ if (arguments.length > 1) {
2418
+ this.assert(
2419
+ hasProperty2 && isEql(val, value),
2420
+ "expected #{this} to have " + descriptor + inspect2(name) + " of #{exp}, but got #{act}",
2421
+ "expected #{this} to not have " + descriptor + inspect2(name) + " of #{act}",
2422
+ val,
2423
+ value
2424
+ );
2425
+ }
2426
+ flag2(this, "object", value);
2427
+ }
2428
+ __name(assertProperty, "assertProperty");
2429
+ Assertion.addMethod("property", assertProperty);
2430
+ function assertOwnProperty(_name, _value, _msg) {
2431
+ flag2(this, "own", true);
2432
+ assertProperty.apply(this, arguments);
2433
+ }
2434
+ __name(assertOwnProperty, "assertOwnProperty");
2435
+ Assertion.addMethod("ownProperty", assertOwnProperty);
2436
+ Assertion.addMethod("haveOwnProperty", assertOwnProperty);
2437
+ function assertOwnPropertyDescriptor(name, descriptor, msg) {
2438
+ if (typeof descriptor === "string") {
2439
+ msg = descriptor;
2440
+ descriptor = null;
2441
+ }
2442
+ if (msg)
2443
+ flag2(this, "message", msg);
2444
+ var obj = flag2(this, "object");
2445
+ var actualDescriptor = Object.getOwnPropertyDescriptor(Object(obj), name);
2446
+ var eql = flag2(this, "eql");
2447
+ if (actualDescriptor && descriptor) {
2448
+ this.assert(
2449
+ eql(descriptor, actualDescriptor),
2450
+ "expected the own property descriptor for " + inspect2(name) + " on #{this} to match " + inspect2(descriptor) + ", got " + inspect2(actualDescriptor),
2451
+ "expected the own property descriptor for " + inspect2(name) + " on #{this} to not match " + inspect2(descriptor),
2452
+ descriptor,
2453
+ actualDescriptor,
2454
+ true
2455
+ );
2456
+ } else {
2457
+ this.assert(
2458
+ actualDescriptor,
2459
+ "expected #{this} to have an own property descriptor for " + inspect2(name),
2460
+ "expected #{this} to not have an own property descriptor for " + inspect2(name)
2461
+ );
2462
+ }
2463
+ flag2(this, "object", actualDescriptor);
2464
+ }
2465
+ __name(assertOwnPropertyDescriptor, "assertOwnPropertyDescriptor");
2466
+ Assertion.addMethod("ownPropertyDescriptor", assertOwnPropertyDescriptor);
2467
+ Assertion.addMethod("haveOwnPropertyDescriptor", assertOwnPropertyDescriptor);
2468
+ function assertLengthChain() {
2469
+ flag2(this, "doLength", true);
2470
+ }
2471
+ __name(assertLengthChain, "assertLengthChain");
2472
+ function assertLength(n, msg) {
2473
+ if (msg)
2474
+ flag2(this, "message", msg);
2475
+ var obj = flag2(this, "object"), objType = type(obj).toLowerCase(), flagMsg = flag2(this, "message"), ssfi = flag2(this, "ssfi"), descriptor = "length", itemsCount;
2476
+ switch (objType) {
2477
+ case "map":
2478
+ case "set":
2479
+ descriptor = "size";
2480
+ itemsCount = obj.size;
2481
+ break;
2482
+ default:
2483
+ new Assertion(obj, flagMsg, ssfi, true).to.have.property("length");
2484
+ itemsCount = obj.length;
2485
+ }
2486
+ this.assert(
2487
+ itemsCount == n,
2488
+ "expected #{this} to have a " + descriptor + " of #{exp} but got #{act}",
2489
+ "expected #{this} to not have a " + descriptor + " of #{act}",
2490
+ n,
2491
+ itemsCount
2492
+ );
2493
+ }
2494
+ __name(assertLength, "assertLength");
2495
+ Assertion.addChainableMethod("length", assertLength, assertLengthChain);
2496
+ Assertion.addChainableMethod("lengthOf", assertLength, assertLengthChain);
2497
+ function assertMatch(re, msg) {
2498
+ if (msg)
2499
+ flag2(this, "message", msg);
2500
+ var obj = flag2(this, "object");
2501
+ this.assert(
2502
+ re.exec(obj),
2503
+ "expected #{this} to match " + re,
2504
+ "expected #{this} not to match " + re
2505
+ );
2506
+ }
2507
+ __name(assertMatch, "assertMatch");
2508
+ Assertion.addMethod("match", assertMatch);
2509
+ Assertion.addMethod("matches", assertMatch);
2510
+ Assertion.addMethod("string", function(str, msg) {
2511
+ if (msg)
2512
+ flag2(this, "message", msg);
2513
+ var obj = flag2(this, "object"), flagMsg = flag2(this, "message"), ssfi = flag2(this, "ssfi");
2514
+ new Assertion(obj, flagMsg, ssfi, true).is.a("string");
2515
+ this.assert(
2516
+ ~obj.indexOf(str),
2517
+ "expected #{this} to contain " + inspect2(str),
2518
+ "expected #{this} to not contain " + inspect2(str)
2519
+ );
2520
+ });
2521
+ function assertKeys(keys) {
2522
+ var obj = flag2(this, "object"), objType = type(obj), keysType = type(keys), ssfi = flag2(this, "ssfi"), isDeep = flag2(this, "deep"), str, deepStr = "", actual, ok = true, flagMsg = flag2(this, "message");
2523
+ flagMsg = flagMsg ? flagMsg + ": " : "";
2524
+ var mixedArgsMsg = flagMsg + "when testing keys against an object or an array you must give a single Array|Object|String argument or multiple String arguments";
2525
+ if (objType === "Map" || objType === "Set") {
2526
+ deepStr = isDeep ? "deeply " : "";
2527
+ actual = [];
2528
+ obj.forEach(function(val, key) {
2529
+ actual.push(key);
2530
+ });
2531
+ if (keysType !== "Array") {
2532
+ keys = Array.prototype.slice.call(arguments);
2533
+ }
2534
+ } else {
2535
+ actual = getOwnEnumerableProperties(obj);
2536
+ switch (keysType) {
2537
+ case "Array":
2538
+ if (arguments.length > 1) {
2539
+ throw new AssertionError(mixedArgsMsg, void 0, ssfi);
2540
+ }
2541
+ break;
2542
+ case "Object":
2543
+ if (arguments.length > 1) {
2544
+ throw new AssertionError(mixedArgsMsg, void 0, ssfi);
2545
+ }
2546
+ keys = Object.keys(keys);
2547
+ break;
2548
+ default:
2549
+ keys = Array.prototype.slice.call(arguments);
2550
+ }
2551
+ keys = keys.map(function(val) {
2552
+ return typeof val === "symbol" ? val : String(val);
2553
+ });
2554
+ }
2555
+ if (!keys.length) {
2556
+ throw new AssertionError(flagMsg + "keys required", void 0, ssfi);
2557
+ }
2558
+ var len = keys.length, any = flag2(this, "any"), all = flag2(this, "all"), expected = keys, isEql = isDeep ? flag2(this, "eql") : (val1, val2) => val1 === val2;
2559
+ if (!any && !all) {
2560
+ all = true;
2561
+ }
2562
+ if (any) {
2563
+ ok = expected.some(function(expectedKey) {
2564
+ return actual.some(function(actualKey) {
2565
+ return isEql(expectedKey, actualKey);
2566
+ });
2567
+ });
2568
+ }
2569
+ if (all) {
2570
+ ok = expected.every(function(expectedKey) {
2571
+ return actual.some(function(actualKey) {
2572
+ return isEql(expectedKey, actualKey);
2573
+ });
2574
+ });
2575
+ if (!flag2(this, "contains")) {
2576
+ ok = ok && keys.length == actual.length;
2577
+ }
2578
+ }
2579
+ if (len > 1) {
2580
+ keys = keys.map(function(key) {
2581
+ return inspect2(key);
2582
+ });
2583
+ var last = keys.pop();
2584
+ if (all) {
2585
+ str = keys.join(", ") + ", and " + last;
2586
+ }
2587
+ if (any) {
2588
+ str = keys.join(", ") + ", or " + last;
2589
+ }
2590
+ } else {
2591
+ str = inspect2(keys[0]);
2592
+ }
2593
+ str = (len > 1 ? "keys " : "key ") + str;
2594
+ str = (flag2(this, "contains") ? "contain " : "have ") + str;
2595
+ this.assert(
2596
+ ok,
2597
+ "expected #{this} to " + deepStr + str,
2598
+ "expected #{this} to not " + deepStr + str,
2599
+ expected.slice(0).sort(compareByInspect),
2600
+ actual.sort(compareByInspect),
2601
+ true
2602
+ );
2603
+ }
2604
+ __name(assertKeys, "assertKeys");
2605
+ Assertion.addMethod("keys", assertKeys);
2606
+ Assertion.addMethod("key", assertKeys);
2607
+ function assertThrows(errorLike, errMsgMatcher, msg) {
2608
+ if (msg)
2609
+ flag2(this, "message", msg);
2610
+ var obj = flag2(this, "object"), ssfi = flag2(this, "ssfi"), flagMsg = flag2(this, "message"), negate = flag2(this, "negate") || false;
2611
+ new Assertion(obj, flagMsg, ssfi, true).is.a("function");
2612
+ if (isRegExp2(errorLike) || typeof errorLike === "string") {
2613
+ errMsgMatcher = errorLike;
2614
+ errorLike = null;
2615
+ }
2616
+ let caughtErr;
2617
+ let errorWasThrown = false;
2618
+ try {
2619
+ obj();
2620
+ } catch (err) {
2621
+ errorWasThrown = true;
2622
+ caughtErr = err;
2623
+ }
2624
+ var everyArgIsUndefined = errorLike === void 0 && errMsgMatcher === void 0;
2625
+ var everyArgIsDefined = Boolean(errorLike && errMsgMatcher);
2626
+ var errorLikeFail = false;
2627
+ var errMsgMatcherFail = false;
2628
+ if (everyArgIsUndefined || !everyArgIsUndefined && !negate) {
2629
+ var errorLikeString = "an error";
2630
+ if (errorLike instanceof Error) {
2631
+ errorLikeString = "#{exp}";
2632
+ } else if (errorLike) {
2633
+ errorLikeString = check_error_exports.getConstructorName(errorLike);
2634
+ }
2635
+ let actual = caughtErr;
2636
+ if (caughtErr instanceof Error) {
2637
+ actual = caughtErr.toString();
2638
+ } else if (typeof caughtErr === "string") {
2639
+ actual = caughtErr;
2640
+ } else if (caughtErr && (typeof caughtErr === "object" || typeof caughtErr === "function")) {
2641
+ try {
2642
+ actual = check_error_exports.getConstructorName(caughtErr);
2643
+ } catch (_err) {
2644
+ }
2645
+ }
2646
+ this.assert(
2647
+ errorWasThrown,
2648
+ "expected #{this} to throw " + errorLikeString,
2649
+ "expected #{this} to not throw an error but #{act} was thrown",
2650
+ errorLike && errorLike.toString(),
2651
+ actual
2652
+ );
2653
+ }
2654
+ if (errorLike && caughtErr) {
2655
+ if (errorLike instanceof Error) {
2656
+ var isCompatibleInstance = check_error_exports.compatibleInstance(
2657
+ caughtErr,
2658
+ errorLike
2659
+ );
2660
+ if (isCompatibleInstance === negate) {
2661
+ if (everyArgIsDefined && negate) {
2662
+ errorLikeFail = true;
2663
+ } else {
2664
+ this.assert(
2665
+ negate,
2666
+ "expected #{this} to throw #{exp} but #{act} was thrown",
2667
+ "expected #{this} to not throw #{exp}" + (caughtErr && !negate ? " but #{act} was thrown" : ""),
2668
+ errorLike.toString(),
2669
+ caughtErr.toString()
2670
+ );
2671
+ }
2672
+ }
2673
+ }
2674
+ var isCompatibleConstructor = check_error_exports.compatibleConstructor(
2675
+ caughtErr,
2676
+ errorLike
2677
+ );
2678
+ if (isCompatibleConstructor === negate) {
2679
+ if (everyArgIsDefined && negate) {
2680
+ errorLikeFail = true;
2681
+ } else {
2682
+ this.assert(
2683
+ negate,
2684
+ "expected #{this} to throw #{exp} but #{act} was thrown",
2685
+ "expected #{this} to not throw #{exp}" + (caughtErr ? " but #{act} was thrown" : ""),
2686
+ errorLike instanceof Error ? errorLike.toString() : errorLike && check_error_exports.getConstructorName(errorLike),
2687
+ caughtErr instanceof Error ? caughtErr.toString() : caughtErr && check_error_exports.getConstructorName(caughtErr)
2688
+ );
2689
+ }
2690
+ }
2691
+ }
2692
+ if (caughtErr && errMsgMatcher !== void 0 && errMsgMatcher !== null) {
2693
+ var placeholder = "including";
2694
+ if (isRegExp2(errMsgMatcher)) {
2695
+ placeholder = "matching";
2696
+ }
2697
+ var isCompatibleMessage = check_error_exports.compatibleMessage(
2698
+ caughtErr,
2699
+ errMsgMatcher
2700
+ );
2701
+ if (isCompatibleMessage === negate) {
2702
+ if (everyArgIsDefined && negate) {
2703
+ errMsgMatcherFail = true;
2704
+ } else {
2705
+ this.assert(
2706
+ negate,
2707
+ "expected #{this} to throw error " + placeholder + " #{exp} but got #{act}",
2708
+ "expected #{this} to throw error not " + placeholder + " #{exp}",
2709
+ errMsgMatcher,
2710
+ check_error_exports.getMessage(caughtErr)
2711
+ );
2712
+ }
2713
+ }
2714
+ }
2715
+ if (errorLikeFail && errMsgMatcherFail) {
2716
+ this.assert(
2717
+ negate,
2718
+ "expected #{this} to throw #{exp} but #{act} was thrown",
2719
+ "expected #{this} to not throw #{exp}" + (caughtErr ? " but #{act} was thrown" : ""),
2720
+ errorLike instanceof Error ? errorLike.toString() : errorLike && check_error_exports.getConstructorName(errorLike),
2721
+ caughtErr instanceof Error ? caughtErr.toString() : caughtErr && check_error_exports.getConstructorName(caughtErr)
2722
+ );
2723
+ }
2724
+ flag2(this, "object", caughtErr);
2725
+ }
2726
+ __name(assertThrows, "assertThrows");
2727
+ Assertion.addMethod("throw", assertThrows);
2728
+ Assertion.addMethod("throws", assertThrows);
2729
+ Assertion.addMethod("Throw", assertThrows);
2730
+ function respondTo(method, msg) {
2731
+ if (msg)
2732
+ flag2(this, "message", msg);
2733
+ var obj = flag2(this, "object"), itself = flag2(this, "itself"), context = "function" === typeof obj && !itself ? obj.prototype[method] : obj[method];
2734
+ this.assert(
2735
+ "function" === typeof context,
2736
+ "expected #{this} to respond to " + inspect2(method),
2737
+ "expected #{this} to not respond to " + inspect2(method)
2738
+ );
2739
+ }
2740
+ __name(respondTo, "respondTo");
2741
+ Assertion.addMethod("respondTo", respondTo);
2742
+ Assertion.addMethod("respondsTo", respondTo);
2743
+ Assertion.addProperty("itself", function() {
2744
+ flag2(this, "itself", true);
2745
+ });
2746
+ function satisfy(matcher, msg) {
2747
+ if (msg)
2748
+ flag2(this, "message", msg);
2749
+ var obj = flag2(this, "object");
2750
+ var result = matcher(obj);
2751
+ this.assert(
2752
+ result,
2753
+ "expected #{this} to satisfy " + objDisplay(matcher),
2754
+ "expected #{this} to not satisfy" + objDisplay(matcher),
2755
+ flag2(this, "negate") ? false : true,
2756
+ result
2757
+ );
2758
+ }
2759
+ __name(satisfy, "satisfy");
2760
+ Assertion.addMethod("satisfy", satisfy);
2761
+ Assertion.addMethod("satisfies", satisfy);
2762
+ function closeTo(expected, delta, msg) {
2763
+ if (msg)
2764
+ flag2(this, "message", msg);
2765
+ var obj = flag2(this, "object"), flagMsg = flag2(this, "message"), ssfi = flag2(this, "ssfi");
2766
+ new Assertion(obj, flagMsg, ssfi, true).is.numeric;
2767
+ let message = "A `delta` value is required for `closeTo`";
2768
+ if (delta == void 0)
2769
+ throw new AssertionError(
2770
+ flagMsg ? `${flagMsg}: ${message}` : message,
2771
+ void 0,
2772
+ ssfi
2773
+ );
2774
+ new Assertion(delta, flagMsg, ssfi, true).is.numeric;
2775
+ message = "A `expected` value is required for `closeTo`";
2776
+ if (expected == void 0)
2777
+ throw new AssertionError(
2778
+ flagMsg ? `${flagMsg}: ${message}` : message,
2779
+ void 0,
2780
+ ssfi
2781
+ );
2782
+ new Assertion(expected, flagMsg, ssfi, true).is.numeric;
2783
+ const abs = /* @__PURE__ */ __name((x) => x < 0n ? -x : x, "abs");
2784
+ const strip = /* @__PURE__ */ __name((number) => parseFloat(parseFloat(number).toPrecision(12)), "strip");
2785
+ this.assert(
2786
+ strip(abs(obj - expected)) <= delta,
2787
+ "expected #{this} to be close to " + expected + " +/- " + delta,
2788
+ "expected #{this} not to be close to " + expected + " +/- " + delta
2789
+ );
2790
+ }
2791
+ __name(closeTo, "closeTo");
2792
+ Assertion.addMethod("closeTo", closeTo);
2793
+ Assertion.addMethod("approximately", closeTo);
2794
+ function isSubsetOf(_subset, _superset, cmp, contains, ordered) {
2795
+ let superset = Array.from(_superset);
2796
+ let subset = Array.from(_subset);
2797
+ if (!contains) {
2798
+ if (subset.length !== superset.length)
2799
+ return false;
2800
+ superset = superset.slice();
2801
+ }
2802
+ return subset.every(function(elem, idx) {
2803
+ if (ordered)
2804
+ return cmp ? cmp(elem, superset[idx]) : elem === superset[idx];
2805
+ if (!cmp) {
2806
+ var matchIdx = superset.indexOf(elem);
2807
+ if (matchIdx === -1)
2808
+ return false;
2809
+ if (!contains)
2810
+ superset.splice(matchIdx, 1);
2811
+ return true;
2812
+ }
2813
+ return superset.some(function(elem2, matchIdx2) {
2814
+ if (!cmp(elem, elem2))
2815
+ return false;
2816
+ if (!contains)
2817
+ superset.splice(matchIdx2, 1);
2818
+ return true;
2819
+ });
2820
+ });
2821
+ }
2822
+ __name(isSubsetOf, "isSubsetOf");
2823
+ Assertion.addMethod("members", function(subset, msg) {
2824
+ if (msg)
2825
+ flag2(this, "message", msg);
2826
+ var obj = flag2(this, "object"), flagMsg = flag2(this, "message"), ssfi = flag2(this, "ssfi");
2827
+ new Assertion(obj, flagMsg, ssfi, true).to.be.iterable;
2828
+ new Assertion(subset, flagMsg, ssfi, true).to.be.iterable;
2829
+ var contains = flag2(this, "contains");
2830
+ var ordered = flag2(this, "ordered");
2831
+ var subject, failMsg, failNegateMsg;
2832
+ if (contains) {
2833
+ subject = ordered ? "an ordered superset" : "a superset";
2834
+ failMsg = "expected #{this} to be " + subject + " of #{exp}";
2835
+ failNegateMsg = "expected #{this} to not be " + subject + " of #{exp}";
2836
+ } else {
2837
+ subject = ordered ? "ordered members" : "members";
2838
+ failMsg = "expected #{this} to have the same " + subject + " as #{exp}";
2839
+ failNegateMsg = "expected #{this} to not have the same " + subject + " as #{exp}";
2840
+ }
2841
+ var cmp = flag2(this, "deep") ? flag2(this, "eql") : void 0;
2842
+ this.assert(
2843
+ isSubsetOf(subset, obj, cmp, contains, ordered),
2844
+ failMsg,
2845
+ failNegateMsg,
2846
+ subset,
2847
+ obj,
2848
+ true
2849
+ );
2850
+ });
2851
+ Assertion.addProperty("iterable", function(msg) {
2852
+ if (msg)
2853
+ flag2(this, "message", msg);
2854
+ var obj = flag2(this, "object");
2855
+ this.assert(
2856
+ obj != void 0 && obj[Symbol.iterator],
2857
+ "expected #{this} to be an iterable",
2858
+ "expected #{this} to not be an iterable",
2859
+ obj
2860
+ );
2861
+ });
2862
+ function oneOf(list, msg) {
2863
+ if (msg)
2864
+ flag2(this, "message", msg);
2865
+ var expected = flag2(this, "object"), flagMsg = flag2(this, "message"), ssfi = flag2(this, "ssfi"), contains = flag2(this, "contains"), isDeep = flag2(this, "deep"), eql = flag2(this, "eql");
2866
+ new Assertion(list, flagMsg, ssfi, true).to.be.an("array");
2867
+ if (contains) {
2868
+ this.assert(
2869
+ list.some(function(possibility) {
2870
+ return expected.indexOf(possibility) > -1;
2871
+ }),
2872
+ "expected #{this} to contain one of #{exp}",
2873
+ "expected #{this} to not contain one of #{exp}",
2874
+ list,
2875
+ expected
2876
+ );
2877
+ } else {
2878
+ if (isDeep) {
2879
+ this.assert(
2880
+ list.some(function(possibility) {
2881
+ return eql(expected, possibility);
2882
+ }),
2883
+ "expected #{this} to deeply equal one of #{exp}",
2884
+ "expected #{this} to deeply equal one of #{exp}",
2885
+ list,
2886
+ expected
2887
+ );
2888
+ } else {
2889
+ this.assert(
2890
+ list.indexOf(expected) > -1,
2891
+ "expected #{this} to be one of #{exp}",
2892
+ "expected #{this} to not be one of #{exp}",
2893
+ list,
2894
+ expected
2895
+ );
2896
+ }
2897
+ }
2898
+ }
2899
+ __name(oneOf, "oneOf");
2900
+ Assertion.addMethod("oneOf", oneOf);
2901
+ function assertChanges(subject, prop, msg) {
2902
+ if (msg)
2903
+ flag2(this, "message", msg);
2904
+ var fn = flag2(this, "object"), flagMsg = flag2(this, "message"), ssfi = flag2(this, "ssfi");
2905
+ new Assertion(fn, flagMsg, ssfi, true).is.a("function");
2906
+ var initial;
2907
+ if (!prop) {
2908
+ new Assertion(subject, flagMsg, ssfi, true).is.a("function");
2909
+ initial = subject();
2910
+ } else {
2911
+ new Assertion(subject, flagMsg, ssfi, true).to.have.property(prop);
2912
+ initial = subject[prop];
2913
+ }
2914
+ fn();
2915
+ var final = prop === void 0 || prop === null ? subject() : subject[prop];
2916
+ var msgObj = prop === void 0 || prop === null ? initial : "." + prop;
2917
+ flag2(this, "deltaMsgObj", msgObj);
2918
+ flag2(this, "initialDeltaValue", initial);
2919
+ flag2(this, "finalDeltaValue", final);
2920
+ flag2(this, "deltaBehavior", "change");
2921
+ flag2(this, "realDelta", final !== initial);
2922
+ this.assert(
2923
+ initial !== final,
2924
+ "expected " + msgObj + " to change",
2925
+ "expected " + msgObj + " to not change"
2926
+ );
2927
+ }
2928
+ __name(assertChanges, "assertChanges");
2929
+ Assertion.addMethod("change", assertChanges);
2930
+ Assertion.addMethod("changes", assertChanges);
2931
+ function assertIncreases(subject, prop, msg) {
2932
+ if (msg)
2933
+ flag2(this, "message", msg);
2934
+ var fn = flag2(this, "object"), flagMsg = flag2(this, "message"), ssfi = flag2(this, "ssfi");
2935
+ new Assertion(fn, flagMsg, ssfi, true).is.a("function");
2936
+ var initial;
2937
+ if (!prop) {
2938
+ new Assertion(subject, flagMsg, ssfi, true).is.a("function");
2939
+ initial = subject();
2940
+ } else {
2941
+ new Assertion(subject, flagMsg, ssfi, true).to.have.property(prop);
2942
+ initial = subject[prop];
2943
+ }
2944
+ new Assertion(initial, flagMsg, ssfi, true).is.a("number");
2945
+ fn();
2946
+ var final = prop === void 0 || prop === null ? subject() : subject[prop];
2947
+ var msgObj = prop === void 0 || prop === null ? initial : "." + prop;
2948
+ flag2(this, "deltaMsgObj", msgObj);
2949
+ flag2(this, "initialDeltaValue", initial);
2950
+ flag2(this, "finalDeltaValue", final);
2951
+ flag2(this, "deltaBehavior", "increase");
2952
+ flag2(this, "realDelta", final - initial);
2953
+ this.assert(
2954
+ final - initial > 0,
2955
+ "expected " + msgObj + " to increase",
2956
+ "expected " + msgObj + " to not increase"
2957
+ );
2958
+ }
2959
+ __name(assertIncreases, "assertIncreases");
2960
+ Assertion.addMethod("increase", assertIncreases);
2961
+ Assertion.addMethod("increases", assertIncreases);
2962
+ function assertDecreases(subject, prop, msg) {
2963
+ if (msg)
2964
+ flag2(this, "message", msg);
2965
+ var fn = flag2(this, "object"), flagMsg = flag2(this, "message"), ssfi = flag2(this, "ssfi");
2966
+ new Assertion(fn, flagMsg, ssfi, true).is.a("function");
2967
+ var initial;
2968
+ if (!prop) {
2969
+ new Assertion(subject, flagMsg, ssfi, true).is.a("function");
2970
+ initial = subject();
2971
+ } else {
2972
+ new Assertion(subject, flagMsg, ssfi, true).to.have.property(prop);
2973
+ initial = subject[prop];
2974
+ }
2975
+ new Assertion(initial, flagMsg, ssfi, true).is.a("number");
2976
+ fn();
2977
+ var final = prop === void 0 || prop === null ? subject() : subject[prop];
2978
+ var msgObj = prop === void 0 || prop === null ? initial : "." + prop;
2979
+ flag2(this, "deltaMsgObj", msgObj);
2980
+ flag2(this, "initialDeltaValue", initial);
2981
+ flag2(this, "finalDeltaValue", final);
2982
+ flag2(this, "deltaBehavior", "decrease");
2983
+ flag2(this, "realDelta", initial - final);
2984
+ this.assert(
2985
+ final - initial < 0,
2986
+ "expected " + msgObj + " to decrease",
2987
+ "expected " + msgObj + " to not decrease"
2988
+ );
2989
+ }
2990
+ __name(assertDecreases, "assertDecreases");
2991
+ Assertion.addMethod("decrease", assertDecreases);
2992
+ Assertion.addMethod("decreases", assertDecreases);
2993
+ function assertDelta(delta, msg) {
2994
+ if (msg)
2995
+ flag2(this, "message", msg);
2996
+ var msgObj = flag2(this, "deltaMsgObj");
2997
+ var initial = flag2(this, "initialDeltaValue");
2998
+ var final = flag2(this, "finalDeltaValue");
2999
+ var behavior = flag2(this, "deltaBehavior");
3000
+ var realDelta = flag2(this, "realDelta");
3001
+ var expression;
3002
+ if (behavior === "change") {
3003
+ expression = Math.abs(final - initial) === Math.abs(delta);
3004
+ } else {
3005
+ expression = realDelta === Math.abs(delta);
3006
+ }
3007
+ this.assert(
3008
+ expression,
3009
+ "expected " + msgObj + " to " + behavior + " by " + delta,
3010
+ "expected " + msgObj + " to not " + behavior + " by " + delta
3011
+ );
3012
+ }
3013
+ __name(assertDelta, "assertDelta");
3014
+ Assertion.addMethod("by", assertDelta);
3015
+ Assertion.addProperty("extensible", function() {
3016
+ var obj = flag2(this, "object");
3017
+ var isExtensible = obj === Object(obj) && Object.isExtensible(obj);
3018
+ this.assert(
3019
+ isExtensible,
3020
+ "expected #{this} to be extensible",
3021
+ "expected #{this} to not be extensible"
3022
+ );
3023
+ });
3024
+ Assertion.addProperty("sealed", function() {
3025
+ var obj = flag2(this, "object");
3026
+ var isSealed = obj === Object(obj) ? Object.isSealed(obj) : true;
3027
+ this.assert(
3028
+ isSealed,
3029
+ "expected #{this} to be sealed",
3030
+ "expected #{this} to not be sealed"
3031
+ );
3032
+ });
3033
+ Assertion.addProperty("frozen", function() {
3034
+ var obj = flag2(this, "object");
3035
+ var isFrozen = obj === Object(obj) ? Object.isFrozen(obj) : true;
3036
+ this.assert(
3037
+ isFrozen,
3038
+ "expected #{this} to be frozen",
3039
+ "expected #{this} to not be frozen"
3040
+ );
3041
+ });
3042
+ Assertion.addProperty("finite", function(_msg) {
3043
+ var obj = flag2(this, "object");
3044
+ this.assert(
3045
+ typeof obj === "number" && isFinite(obj),
3046
+ "expected #{this} to be a finite number",
3047
+ "expected #{this} to not be a finite number"
3048
+ );
3049
+ });
3050
+ function compareSubset(expected, actual) {
3051
+ if (expected === actual) {
3052
+ return true;
3053
+ }
3054
+ if (typeof actual !== typeof expected) {
3055
+ return false;
3056
+ }
3057
+ if (typeof expected !== "object" || expected === null) {
3058
+ return expected === actual;
3059
+ }
3060
+ if (!actual) {
3061
+ return false;
3062
+ }
3063
+ if (Array.isArray(expected)) {
3064
+ if (!Array.isArray(actual)) {
3065
+ return false;
3066
+ }
3067
+ return expected.every(function(exp) {
3068
+ return actual.some(function(act) {
3069
+ return compareSubset(exp, act);
3070
+ });
3071
+ });
3072
+ }
3073
+ if (expected instanceof Date) {
3074
+ if (actual instanceof Date) {
3075
+ return expected.getTime() === actual.getTime();
3076
+ } else {
3077
+ return false;
3078
+ }
3079
+ }
3080
+ return Object.keys(expected).every(function(key) {
3081
+ var expectedValue = expected[key];
3082
+ var actualValue = actual[key];
3083
+ if (typeof expectedValue === "object" && expectedValue !== null && actualValue !== null) {
3084
+ return compareSubset(expectedValue, actualValue);
3085
+ }
3086
+ if (typeof expectedValue === "function") {
3087
+ return expectedValue(actualValue);
3088
+ }
3089
+ return actualValue === expectedValue;
3090
+ });
3091
+ }
3092
+ __name(compareSubset, "compareSubset");
3093
+ Assertion.addMethod("containSubset", function(expected) {
3094
+ const actual = flag(this, "object");
3095
+ const showDiff = config.showDiff;
3096
+ this.assert(
3097
+ compareSubset(expected, actual),
3098
+ "expected #{act} to contain subset #{exp}",
3099
+ "expected #{act} to not contain subset #{exp}",
3100
+ expected,
3101
+ actual,
3102
+ showDiff
3103
+ );
3104
+ });
3105
+ function expect(val, message) {
3106
+ return new Assertion(val, message);
3107
+ }
3108
+ __name(expect, "expect");
3109
+ expect.fail = function(actual, expected, message, operator) {
3110
+ if (arguments.length < 2) {
3111
+ message = actual;
3112
+ actual = void 0;
3113
+ }
3114
+ message = message || "expect.fail()";
3115
+ throw new AssertionError(
3116
+ message,
3117
+ {
3118
+ actual,
3119
+ expected,
3120
+ operator
3121
+ },
3122
+ expect.fail
3123
+ );
3124
+ };
3125
+ var should_exports = {};
3126
+ __export(should_exports, {
3127
+ Should: () => Should,
3128
+ should: () => should
3129
+ });
3130
+ function loadShould() {
3131
+ function shouldGetter() {
3132
+ if (this instanceof String || this instanceof Number || this instanceof Boolean || typeof Symbol === "function" && this instanceof Symbol || typeof BigInt === "function" && this instanceof BigInt) {
3133
+ return new Assertion(this.valueOf(), null, shouldGetter);
3134
+ }
3135
+ return new Assertion(this, null, shouldGetter);
3136
+ }
3137
+ __name(shouldGetter, "shouldGetter");
3138
+ function shouldSetter(value) {
3139
+ Object.defineProperty(this, "should", {
3140
+ value,
3141
+ enumerable: true,
3142
+ configurable: true,
3143
+ writable: true
3144
+ });
3145
+ }
3146
+ __name(shouldSetter, "shouldSetter");
3147
+ Object.defineProperty(Object.prototype, "should", {
3148
+ set: shouldSetter,
3149
+ get: shouldGetter,
3150
+ configurable: true
3151
+ });
3152
+ var should2 = {};
3153
+ should2.fail = function(actual, expected, message, operator) {
3154
+ if (arguments.length < 2) {
3155
+ message = actual;
3156
+ actual = void 0;
3157
+ }
3158
+ message = message || "should.fail()";
3159
+ throw new AssertionError(
3160
+ message,
3161
+ {
3162
+ actual,
3163
+ expected,
3164
+ operator
3165
+ },
3166
+ should2.fail
3167
+ );
3168
+ };
3169
+ should2.equal = function(actual, expected, message) {
3170
+ new Assertion(actual, message).to.equal(expected);
3171
+ };
3172
+ should2.Throw = function(fn, errt, errs, msg) {
3173
+ new Assertion(fn, msg).to.Throw(errt, errs);
3174
+ };
3175
+ should2.exist = function(val, msg) {
3176
+ new Assertion(val, msg).to.exist;
3177
+ };
3178
+ should2.not = {};
3179
+ should2.not.equal = function(actual, expected, msg) {
3180
+ new Assertion(actual, msg).to.not.equal(expected);
3181
+ };
3182
+ should2.not.Throw = function(fn, errt, errs, msg) {
3183
+ new Assertion(fn, msg).to.not.Throw(errt, errs);
3184
+ };
3185
+ should2.not.exist = function(val, msg) {
3186
+ new Assertion(val, msg).to.not.exist;
3187
+ };
3188
+ should2["throw"] = should2["Throw"];
3189
+ should2.not["throw"] = should2.not["Throw"];
3190
+ return should2;
3191
+ }
3192
+ __name(loadShould, "loadShould");
3193
+ var should = loadShould;
3194
+ var Should = loadShould;
3195
+ function assert(express, errmsg) {
3196
+ var test2 = new Assertion(null, null, assert, true);
3197
+ test2.assert(express, errmsg, "[ negation message unavailable ]");
3198
+ }
3199
+ __name(assert, "assert");
3200
+ assert.fail = function(actual, expected, message, operator) {
3201
+ if (arguments.length < 2) {
3202
+ message = actual;
3203
+ actual = void 0;
3204
+ }
3205
+ message = message || "assert.fail()";
3206
+ throw new AssertionError(
3207
+ message,
3208
+ {
3209
+ actual,
3210
+ expected,
3211
+ operator
3212
+ },
3213
+ assert.fail
3214
+ );
3215
+ };
3216
+ assert.isOk = function(val, msg) {
3217
+ new Assertion(val, msg, assert.isOk, true).is.ok;
3218
+ };
3219
+ assert.isNotOk = function(val, msg) {
3220
+ new Assertion(val, msg, assert.isNotOk, true).is.not.ok;
3221
+ };
3222
+ assert.equal = function(act, exp, msg) {
3223
+ var test2 = new Assertion(act, msg, assert.equal, true);
3224
+ test2.assert(
3225
+ exp == flag(test2, "object"),
3226
+ "expected #{this} to equal #{exp}",
3227
+ "expected #{this} to not equal #{act}",
3228
+ exp,
3229
+ act,
3230
+ true
3231
+ );
3232
+ };
3233
+ assert.notEqual = function(act, exp, msg) {
3234
+ var test2 = new Assertion(act, msg, assert.notEqual, true);
3235
+ test2.assert(
3236
+ exp != flag(test2, "object"),
3237
+ "expected #{this} to not equal #{exp}",
3238
+ "expected #{this} to equal #{act}",
3239
+ exp,
3240
+ act,
3241
+ true
3242
+ );
3243
+ };
3244
+ assert.strictEqual = function(act, exp, msg) {
3245
+ new Assertion(act, msg, assert.strictEqual, true).to.equal(exp);
3246
+ };
3247
+ assert.notStrictEqual = function(act, exp, msg) {
3248
+ new Assertion(act, msg, assert.notStrictEqual, true).to.not.equal(exp);
3249
+ };
3250
+ assert.deepEqual = assert.deepStrictEqual = function(act, exp, msg) {
3251
+ new Assertion(act, msg, assert.deepEqual, true).to.eql(exp);
3252
+ };
3253
+ assert.notDeepEqual = function(act, exp, msg) {
3254
+ new Assertion(act, msg, assert.notDeepEqual, true).to.not.eql(exp);
3255
+ };
3256
+ assert.isAbove = function(val, abv, msg) {
3257
+ new Assertion(val, msg, assert.isAbove, true).to.be.above(abv);
3258
+ };
3259
+ assert.isAtLeast = function(val, atlst, msg) {
3260
+ new Assertion(val, msg, assert.isAtLeast, true).to.be.least(atlst);
3261
+ };
3262
+ assert.isBelow = function(val, blw, msg) {
3263
+ new Assertion(val, msg, assert.isBelow, true).to.be.below(blw);
3264
+ };
3265
+ assert.isAtMost = function(val, atmst, msg) {
3266
+ new Assertion(val, msg, assert.isAtMost, true).to.be.most(atmst);
3267
+ };
3268
+ assert.isTrue = function(val, msg) {
3269
+ new Assertion(val, msg, assert.isTrue, true).is["true"];
3270
+ };
3271
+ assert.isNotTrue = function(val, msg) {
3272
+ new Assertion(val, msg, assert.isNotTrue, true).to.not.equal(true);
3273
+ };
3274
+ assert.isFalse = function(val, msg) {
3275
+ new Assertion(val, msg, assert.isFalse, true).is["false"];
3276
+ };
3277
+ assert.isNotFalse = function(val, msg) {
3278
+ new Assertion(val, msg, assert.isNotFalse, true).to.not.equal(false);
3279
+ };
3280
+ assert.isNull = function(val, msg) {
3281
+ new Assertion(val, msg, assert.isNull, true).to.equal(null);
3282
+ };
3283
+ assert.isNotNull = function(val, msg) {
3284
+ new Assertion(val, msg, assert.isNotNull, true).to.not.equal(null);
3285
+ };
3286
+ assert.isNaN = function(val, msg) {
3287
+ new Assertion(val, msg, assert.isNaN, true).to.be.NaN;
3288
+ };
3289
+ assert.isNotNaN = function(value, message) {
3290
+ new Assertion(value, message, assert.isNotNaN, true).not.to.be.NaN;
3291
+ };
3292
+ assert.exists = function(val, msg) {
3293
+ new Assertion(val, msg, assert.exists, true).to.exist;
3294
+ };
3295
+ assert.notExists = function(val, msg) {
3296
+ new Assertion(val, msg, assert.notExists, true).to.not.exist;
3297
+ };
3298
+ assert.isUndefined = function(val, msg) {
3299
+ new Assertion(val, msg, assert.isUndefined, true).to.equal(void 0);
3300
+ };
3301
+ assert.isDefined = function(val, msg) {
3302
+ new Assertion(val, msg, assert.isDefined, true).to.not.equal(void 0);
3303
+ };
3304
+ assert.isCallable = function(value, message) {
3305
+ new Assertion(value, message, assert.isCallable, true).is.callable;
3306
+ };
3307
+ assert.isNotCallable = function(value, message) {
3308
+ new Assertion(value, message, assert.isNotCallable, true).is.not.callable;
3309
+ };
3310
+ assert.isObject = function(val, msg) {
3311
+ new Assertion(val, msg, assert.isObject, true).to.be.a("object");
3312
+ };
3313
+ assert.isNotObject = function(val, msg) {
3314
+ new Assertion(val, msg, assert.isNotObject, true).to.not.be.a("object");
3315
+ };
3316
+ assert.isArray = function(val, msg) {
3317
+ new Assertion(val, msg, assert.isArray, true).to.be.an("array");
3318
+ };
3319
+ assert.isNotArray = function(val, msg) {
3320
+ new Assertion(val, msg, assert.isNotArray, true).to.not.be.an("array");
3321
+ };
3322
+ assert.isString = function(val, msg) {
3323
+ new Assertion(val, msg, assert.isString, true).to.be.a("string");
3324
+ };
3325
+ assert.isNotString = function(val, msg) {
3326
+ new Assertion(val, msg, assert.isNotString, true).to.not.be.a("string");
3327
+ };
3328
+ assert.isNumber = function(val, msg) {
3329
+ new Assertion(val, msg, assert.isNumber, true).to.be.a("number");
3330
+ };
3331
+ assert.isNotNumber = function(val, msg) {
3332
+ new Assertion(val, msg, assert.isNotNumber, true).to.not.be.a("number");
3333
+ };
3334
+ assert.isNumeric = function(val, msg) {
3335
+ new Assertion(val, msg, assert.isNumeric, true).is.numeric;
3336
+ };
3337
+ assert.isNotNumeric = function(val, msg) {
3338
+ new Assertion(val, msg, assert.isNotNumeric, true).is.not.numeric;
3339
+ };
3340
+ assert.isFinite = function(val, msg) {
3341
+ new Assertion(val, msg, assert.isFinite, true).to.be.finite;
3342
+ };
3343
+ assert.isBoolean = function(val, msg) {
3344
+ new Assertion(val, msg, assert.isBoolean, true).to.be.a("boolean");
3345
+ };
3346
+ assert.isNotBoolean = function(val, msg) {
3347
+ new Assertion(val, msg, assert.isNotBoolean, true).to.not.be.a("boolean");
3348
+ };
3349
+ assert.typeOf = function(val, type3, msg) {
3350
+ new Assertion(val, msg, assert.typeOf, true).to.be.a(type3);
3351
+ };
3352
+ assert.notTypeOf = function(value, type3, message) {
3353
+ new Assertion(value, message, assert.notTypeOf, true).to.not.be.a(type3);
3354
+ };
3355
+ assert.instanceOf = function(val, type3, msg) {
3356
+ new Assertion(val, msg, assert.instanceOf, true).to.be.instanceOf(type3);
3357
+ };
3358
+ assert.notInstanceOf = function(val, type3, msg) {
3359
+ new Assertion(val, msg, assert.notInstanceOf, true).to.not.be.instanceOf(
3360
+ type3
3361
+ );
3362
+ };
3363
+ assert.include = function(exp, inc, msg) {
3364
+ new Assertion(exp, msg, assert.include, true).include(inc);
3365
+ };
3366
+ assert.notInclude = function(exp, inc, msg) {
3367
+ new Assertion(exp, msg, assert.notInclude, true).not.include(inc);
3368
+ };
3369
+ assert.deepInclude = function(exp, inc, msg) {
3370
+ new Assertion(exp, msg, assert.deepInclude, true).deep.include(inc);
3371
+ };
3372
+ assert.notDeepInclude = function(exp, inc, msg) {
3373
+ new Assertion(exp, msg, assert.notDeepInclude, true).not.deep.include(inc);
3374
+ };
3375
+ assert.nestedInclude = function(exp, inc, msg) {
3376
+ new Assertion(exp, msg, assert.nestedInclude, true).nested.include(inc);
3377
+ };
3378
+ assert.notNestedInclude = function(exp, inc, msg) {
3379
+ new Assertion(exp, msg, assert.notNestedInclude, true).not.nested.include(
3380
+ inc
3381
+ );
3382
+ };
3383
+ assert.deepNestedInclude = function(exp, inc, msg) {
3384
+ new Assertion(exp, msg, assert.deepNestedInclude, true).deep.nested.include(
3385
+ inc
3386
+ );
3387
+ };
3388
+ assert.notDeepNestedInclude = function(exp, inc, msg) {
3389
+ new Assertion(
3390
+ exp,
3391
+ msg,
3392
+ assert.notDeepNestedInclude,
3393
+ true
3394
+ ).not.deep.nested.include(inc);
3395
+ };
3396
+ assert.ownInclude = function(exp, inc, msg) {
3397
+ new Assertion(exp, msg, assert.ownInclude, true).own.include(inc);
3398
+ };
3399
+ assert.notOwnInclude = function(exp, inc, msg) {
3400
+ new Assertion(exp, msg, assert.notOwnInclude, true).not.own.include(inc);
3401
+ };
3402
+ assert.deepOwnInclude = function(exp, inc, msg) {
3403
+ new Assertion(exp, msg, assert.deepOwnInclude, true).deep.own.include(inc);
3404
+ };
3405
+ assert.notDeepOwnInclude = function(exp, inc, msg) {
3406
+ new Assertion(exp, msg, assert.notDeepOwnInclude, true).not.deep.own.include(
3407
+ inc
3408
+ );
3409
+ };
3410
+ assert.match = function(exp, re, msg) {
3411
+ new Assertion(exp, msg, assert.match, true).to.match(re);
3412
+ };
3413
+ assert.notMatch = function(exp, re, msg) {
3414
+ new Assertion(exp, msg, assert.notMatch, true).to.not.match(re);
3415
+ };
3416
+ assert.property = function(obj, prop, msg) {
3417
+ new Assertion(obj, msg, assert.property, true).to.have.property(prop);
3418
+ };
3419
+ assert.notProperty = function(obj, prop, msg) {
3420
+ new Assertion(obj, msg, assert.notProperty, true).to.not.have.property(prop);
3421
+ };
3422
+ assert.propertyVal = function(obj, prop, val, msg) {
3423
+ new Assertion(obj, msg, assert.propertyVal, true).to.have.property(prop, val);
3424
+ };
3425
+ assert.notPropertyVal = function(obj, prop, val, msg) {
3426
+ new Assertion(obj, msg, assert.notPropertyVal, true).to.not.have.property(
3427
+ prop,
3428
+ val
3429
+ );
3430
+ };
3431
+ assert.deepPropertyVal = function(obj, prop, val, msg) {
3432
+ new Assertion(obj, msg, assert.deepPropertyVal, true).to.have.deep.property(
3433
+ prop,
3434
+ val
3435
+ );
3436
+ };
3437
+ assert.notDeepPropertyVal = function(obj, prop, val, msg) {
3438
+ new Assertion(
3439
+ obj,
3440
+ msg,
3441
+ assert.notDeepPropertyVal,
3442
+ true
3443
+ ).to.not.have.deep.property(prop, val);
3444
+ };
3445
+ assert.ownProperty = function(obj, prop, msg) {
3446
+ new Assertion(obj, msg, assert.ownProperty, true).to.have.own.property(prop);
3447
+ };
3448
+ assert.notOwnProperty = function(obj, prop, msg) {
3449
+ new Assertion(obj, msg, assert.notOwnProperty, true).to.not.have.own.property(
3450
+ prop
3451
+ );
3452
+ };
3453
+ assert.ownPropertyVal = function(obj, prop, value, msg) {
3454
+ new Assertion(obj, msg, assert.ownPropertyVal, true).to.have.own.property(
3455
+ prop,
3456
+ value
3457
+ );
3458
+ };
3459
+ assert.notOwnPropertyVal = function(obj, prop, value, msg) {
3460
+ new Assertion(
3461
+ obj,
3462
+ msg,
3463
+ assert.notOwnPropertyVal,
3464
+ true
3465
+ ).to.not.have.own.property(prop, value);
3466
+ };
3467
+ assert.deepOwnPropertyVal = function(obj, prop, value, msg) {
3468
+ new Assertion(
3469
+ obj,
3470
+ msg,
3471
+ assert.deepOwnPropertyVal,
3472
+ true
3473
+ ).to.have.deep.own.property(prop, value);
3474
+ };
3475
+ assert.notDeepOwnPropertyVal = function(obj, prop, value, msg) {
3476
+ new Assertion(
3477
+ obj,
3478
+ msg,
3479
+ assert.notDeepOwnPropertyVal,
3480
+ true
3481
+ ).to.not.have.deep.own.property(prop, value);
3482
+ };
3483
+ assert.nestedProperty = function(obj, prop, msg) {
3484
+ new Assertion(obj, msg, assert.nestedProperty, true).to.have.nested.property(
3485
+ prop
3486
+ );
3487
+ };
3488
+ assert.notNestedProperty = function(obj, prop, msg) {
3489
+ new Assertion(
3490
+ obj,
3491
+ msg,
3492
+ assert.notNestedProperty,
3493
+ true
3494
+ ).to.not.have.nested.property(prop);
3495
+ };
3496
+ assert.nestedPropertyVal = function(obj, prop, val, msg) {
3497
+ new Assertion(
3498
+ obj,
3499
+ msg,
3500
+ assert.nestedPropertyVal,
3501
+ true
3502
+ ).to.have.nested.property(prop, val);
3503
+ };
3504
+ assert.notNestedPropertyVal = function(obj, prop, val, msg) {
3505
+ new Assertion(
3506
+ obj,
3507
+ msg,
3508
+ assert.notNestedPropertyVal,
3509
+ true
3510
+ ).to.not.have.nested.property(prop, val);
3511
+ };
3512
+ assert.deepNestedPropertyVal = function(obj, prop, val, msg) {
3513
+ new Assertion(
3514
+ obj,
3515
+ msg,
3516
+ assert.deepNestedPropertyVal,
3517
+ true
3518
+ ).to.have.deep.nested.property(prop, val);
3519
+ };
3520
+ assert.notDeepNestedPropertyVal = function(obj, prop, val, msg) {
3521
+ new Assertion(
3522
+ obj,
3523
+ msg,
3524
+ assert.notDeepNestedPropertyVal,
3525
+ true
3526
+ ).to.not.have.deep.nested.property(prop, val);
3527
+ };
3528
+ assert.lengthOf = function(exp, len, msg) {
3529
+ new Assertion(exp, msg, assert.lengthOf, true).to.have.lengthOf(len);
3530
+ };
3531
+ assert.hasAnyKeys = function(obj, keys, msg) {
3532
+ new Assertion(obj, msg, assert.hasAnyKeys, true).to.have.any.keys(keys);
3533
+ };
3534
+ assert.hasAllKeys = function(obj, keys, msg) {
3535
+ new Assertion(obj, msg, assert.hasAllKeys, true).to.have.all.keys(keys);
3536
+ };
3537
+ assert.containsAllKeys = function(obj, keys, msg) {
3538
+ new Assertion(obj, msg, assert.containsAllKeys, true).to.contain.all.keys(
3539
+ keys
3540
+ );
3541
+ };
3542
+ assert.doesNotHaveAnyKeys = function(obj, keys, msg) {
3543
+ new Assertion(obj, msg, assert.doesNotHaveAnyKeys, true).to.not.have.any.keys(
3544
+ keys
3545
+ );
3546
+ };
3547
+ assert.doesNotHaveAllKeys = function(obj, keys, msg) {
3548
+ new Assertion(obj, msg, assert.doesNotHaveAllKeys, true).to.not.have.all.keys(
3549
+ keys
3550
+ );
3551
+ };
3552
+ assert.hasAnyDeepKeys = function(obj, keys, msg) {
3553
+ new Assertion(obj, msg, assert.hasAnyDeepKeys, true).to.have.any.deep.keys(
3554
+ keys
3555
+ );
3556
+ };
3557
+ assert.hasAllDeepKeys = function(obj, keys, msg) {
3558
+ new Assertion(obj, msg, assert.hasAllDeepKeys, true).to.have.all.deep.keys(
3559
+ keys
3560
+ );
3561
+ };
3562
+ assert.containsAllDeepKeys = function(obj, keys, msg) {
3563
+ new Assertion(
3564
+ obj,
3565
+ msg,
3566
+ assert.containsAllDeepKeys,
3567
+ true
3568
+ ).to.contain.all.deep.keys(keys);
3569
+ };
3570
+ assert.doesNotHaveAnyDeepKeys = function(obj, keys, msg) {
3571
+ new Assertion(
3572
+ obj,
3573
+ msg,
3574
+ assert.doesNotHaveAnyDeepKeys,
3575
+ true
3576
+ ).to.not.have.any.deep.keys(keys);
3577
+ };
3578
+ assert.doesNotHaveAllDeepKeys = function(obj, keys, msg) {
3579
+ new Assertion(
3580
+ obj,
3581
+ msg,
3582
+ assert.doesNotHaveAllDeepKeys,
3583
+ true
3584
+ ).to.not.have.all.deep.keys(keys);
3585
+ };
3586
+ assert.throws = function(fn, errorLike, errMsgMatcher, msg) {
3587
+ if ("string" === typeof errorLike || errorLike instanceof RegExp) {
3588
+ errMsgMatcher = errorLike;
3589
+ errorLike = null;
3590
+ }
3591
+ var assertErr = new Assertion(fn, msg, assert.throws, true).to.throw(
3592
+ errorLike,
3593
+ errMsgMatcher
3594
+ );
3595
+ return flag(assertErr, "object");
3596
+ };
3597
+ assert.doesNotThrow = function(fn, errorLike, errMsgMatcher, message) {
3598
+ if ("string" === typeof errorLike || errorLike instanceof RegExp) {
3599
+ errMsgMatcher = errorLike;
3600
+ errorLike = null;
3601
+ }
3602
+ new Assertion(fn, message, assert.doesNotThrow, true).to.not.throw(
3603
+ errorLike,
3604
+ errMsgMatcher
3605
+ );
3606
+ };
3607
+ assert.operator = function(val, operator, val2, msg) {
3608
+ var ok;
3609
+ switch (operator) {
3610
+ case "==":
3611
+ ok = val == val2;
3612
+ break;
3613
+ case "===":
3614
+ ok = val === val2;
3615
+ break;
3616
+ case ">":
3617
+ ok = val > val2;
3618
+ break;
3619
+ case ">=":
3620
+ ok = val >= val2;
3621
+ break;
3622
+ case "<":
3623
+ ok = val < val2;
3624
+ break;
3625
+ case "<=":
3626
+ ok = val <= val2;
3627
+ break;
3628
+ case "!=":
3629
+ ok = val != val2;
3630
+ break;
3631
+ case "!==":
3632
+ ok = val !== val2;
3633
+ break;
3634
+ default:
3635
+ msg = msg ? msg + ": " : msg;
3636
+ throw new AssertionError(
3637
+ msg + 'Invalid operator "' + operator + '"',
3638
+ void 0,
3639
+ assert.operator
3640
+ );
3641
+ }
3642
+ var test2 = new Assertion(ok, msg, assert.operator, true);
3643
+ test2.assert(
3644
+ true === flag(test2, "object"),
3645
+ "expected " + inspect2(val) + " to be " + operator + " " + inspect2(val2),
3646
+ "expected " + inspect2(val) + " to not be " + operator + " " + inspect2(val2)
3647
+ );
3648
+ };
3649
+ assert.closeTo = function(act, exp, delta, msg) {
3650
+ new Assertion(act, msg, assert.closeTo, true).to.be.closeTo(exp, delta);
3651
+ };
3652
+ assert.approximately = function(act, exp, delta, msg) {
3653
+ new Assertion(act, msg, assert.approximately, true).to.be.approximately(
3654
+ exp,
3655
+ delta
3656
+ );
3657
+ };
3658
+ assert.sameMembers = function(set1, set2, msg) {
3659
+ new Assertion(set1, msg, assert.sameMembers, true).to.have.same.members(set2);
3660
+ };
3661
+ assert.notSameMembers = function(set1, set2, msg) {
3662
+ new Assertion(
3663
+ set1,
3664
+ msg,
3665
+ assert.notSameMembers,
3666
+ true
3667
+ ).to.not.have.same.members(set2);
3668
+ };
3669
+ assert.sameDeepMembers = function(set1, set2, msg) {
3670
+ new Assertion(
3671
+ set1,
3672
+ msg,
3673
+ assert.sameDeepMembers,
3674
+ true
3675
+ ).to.have.same.deep.members(set2);
3676
+ };
3677
+ assert.notSameDeepMembers = function(set1, set2, msg) {
3678
+ new Assertion(
3679
+ set1,
3680
+ msg,
3681
+ assert.notSameDeepMembers,
3682
+ true
3683
+ ).to.not.have.same.deep.members(set2);
3684
+ };
3685
+ assert.sameOrderedMembers = function(set1, set2, msg) {
3686
+ new Assertion(
3687
+ set1,
3688
+ msg,
3689
+ assert.sameOrderedMembers,
3690
+ true
3691
+ ).to.have.same.ordered.members(set2);
3692
+ };
3693
+ assert.notSameOrderedMembers = function(set1, set2, msg) {
3694
+ new Assertion(
3695
+ set1,
3696
+ msg,
3697
+ assert.notSameOrderedMembers,
3698
+ true
3699
+ ).to.not.have.same.ordered.members(set2);
3700
+ };
3701
+ assert.sameDeepOrderedMembers = function(set1, set2, msg) {
3702
+ new Assertion(
3703
+ set1,
3704
+ msg,
3705
+ assert.sameDeepOrderedMembers,
3706
+ true
3707
+ ).to.have.same.deep.ordered.members(set2);
3708
+ };
3709
+ assert.notSameDeepOrderedMembers = function(set1, set2, msg) {
3710
+ new Assertion(
3711
+ set1,
3712
+ msg,
3713
+ assert.notSameDeepOrderedMembers,
3714
+ true
3715
+ ).to.not.have.same.deep.ordered.members(set2);
3716
+ };
3717
+ assert.includeMembers = function(superset, subset, msg) {
3718
+ new Assertion(superset, msg, assert.includeMembers, true).to.include.members(
3719
+ subset
3720
+ );
3721
+ };
3722
+ assert.notIncludeMembers = function(superset, subset, msg) {
3723
+ new Assertion(
3724
+ superset,
3725
+ msg,
3726
+ assert.notIncludeMembers,
3727
+ true
3728
+ ).to.not.include.members(subset);
3729
+ };
3730
+ assert.includeDeepMembers = function(superset, subset, msg) {
3731
+ new Assertion(
3732
+ superset,
3733
+ msg,
3734
+ assert.includeDeepMembers,
3735
+ true
3736
+ ).to.include.deep.members(subset);
3737
+ };
3738
+ assert.notIncludeDeepMembers = function(superset, subset, msg) {
3739
+ new Assertion(
3740
+ superset,
3741
+ msg,
3742
+ assert.notIncludeDeepMembers,
3743
+ true
3744
+ ).to.not.include.deep.members(subset);
3745
+ };
3746
+ assert.includeOrderedMembers = function(superset, subset, msg) {
3747
+ new Assertion(
3748
+ superset,
3749
+ msg,
3750
+ assert.includeOrderedMembers,
3751
+ true
3752
+ ).to.include.ordered.members(subset);
3753
+ };
3754
+ assert.notIncludeOrderedMembers = function(superset, subset, msg) {
3755
+ new Assertion(
3756
+ superset,
3757
+ msg,
3758
+ assert.notIncludeOrderedMembers,
3759
+ true
3760
+ ).to.not.include.ordered.members(subset);
3761
+ };
3762
+ assert.includeDeepOrderedMembers = function(superset, subset, msg) {
3763
+ new Assertion(
3764
+ superset,
3765
+ msg,
3766
+ assert.includeDeepOrderedMembers,
3767
+ true
3768
+ ).to.include.deep.ordered.members(subset);
3769
+ };
3770
+ assert.notIncludeDeepOrderedMembers = function(superset, subset, msg) {
3771
+ new Assertion(
3772
+ superset,
3773
+ msg,
3774
+ assert.notIncludeDeepOrderedMembers,
3775
+ true
3776
+ ).to.not.include.deep.ordered.members(subset);
3777
+ };
3778
+ assert.oneOf = function(inList, list, msg) {
3779
+ new Assertion(inList, msg, assert.oneOf, true).to.be.oneOf(list);
3780
+ };
3781
+ assert.isIterable = function(obj, msg) {
3782
+ if (obj == void 0 || !obj[Symbol.iterator]) {
3783
+ msg = msg ? `${msg} expected ${inspect2(obj)} to be an iterable` : `expected ${inspect2(obj)} to be an iterable`;
3784
+ throw new AssertionError(msg, void 0, assert.isIterable);
3785
+ }
3786
+ };
3787
+ assert.changes = function(fn, obj, prop, msg) {
3788
+ if (arguments.length === 3 && typeof obj === "function") {
3789
+ msg = prop;
3790
+ prop = null;
3791
+ }
3792
+ new Assertion(fn, msg, assert.changes, true).to.change(obj, prop);
3793
+ };
3794
+ assert.changesBy = function(fn, obj, prop, delta, msg) {
3795
+ if (arguments.length === 4 && typeof obj === "function") {
3796
+ var tmpMsg = delta;
3797
+ delta = prop;
3798
+ msg = tmpMsg;
3799
+ } else if (arguments.length === 3) {
3800
+ delta = prop;
3801
+ prop = null;
3802
+ }
3803
+ new Assertion(fn, msg, assert.changesBy, true).to.change(obj, prop).by(delta);
3804
+ };
3805
+ assert.doesNotChange = function(fn, obj, prop, msg) {
3806
+ if (arguments.length === 3 && typeof obj === "function") {
3807
+ msg = prop;
3808
+ prop = null;
3809
+ }
3810
+ return new Assertion(fn, msg, assert.doesNotChange, true).to.not.change(
3811
+ obj,
3812
+ prop
3813
+ );
3814
+ };
3815
+ assert.changesButNotBy = function(fn, obj, prop, delta, msg) {
3816
+ if (arguments.length === 4 && typeof obj === "function") {
3817
+ var tmpMsg = delta;
3818
+ delta = prop;
3819
+ msg = tmpMsg;
3820
+ } else if (arguments.length === 3) {
3821
+ delta = prop;
3822
+ prop = null;
3823
+ }
3824
+ new Assertion(fn, msg, assert.changesButNotBy, true).to.change(obj, prop).but.not.by(delta);
3825
+ };
3826
+ assert.increases = function(fn, obj, prop, msg) {
3827
+ if (arguments.length === 3 && typeof obj === "function") {
3828
+ msg = prop;
3829
+ prop = null;
3830
+ }
3831
+ return new Assertion(fn, msg, assert.increases, true).to.increase(obj, prop);
3832
+ };
3833
+ assert.increasesBy = function(fn, obj, prop, delta, msg) {
3834
+ if (arguments.length === 4 && typeof obj === "function") {
3835
+ var tmpMsg = delta;
3836
+ delta = prop;
3837
+ msg = tmpMsg;
3838
+ } else if (arguments.length === 3) {
3839
+ delta = prop;
3840
+ prop = null;
3841
+ }
3842
+ new Assertion(fn, msg, assert.increasesBy, true).to.increase(obj, prop).by(delta);
3843
+ };
3844
+ assert.doesNotIncrease = function(fn, obj, prop, msg) {
3845
+ if (arguments.length === 3 && typeof obj === "function") {
3846
+ msg = prop;
3847
+ prop = null;
3848
+ }
3849
+ return new Assertion(fn, msg, assert.doesNotIncrease, true).to.not.increase(
3850
+ obj,
3851
+ prop
3852
+ );
3853
+ };
3854
+ assert.increasesButNotBy = function(fn, obj, prop, delta, msg) {
3855
+ if (arguments.length === 4 && typeof obj === "function") {
3856
+ var tmpMsg = delta;
3857
+ delta = prop;
3858
+ msg = tmpMsg;
3859
+ } else if (arguments.length === 3) {
3860
+ delta = prop;
3861
+ prop = null;
3862
+ }
3863
+ new Assertion(fn, msg, assert.increasesButNotBy, true).to.increase(obj, prop).but.not.by(delta);
3864
+ };
3865
+ assert.decreases = function(fn, obj, prop, msg) {
3866
+ if (arguments.length === 3 && typeof obj === "function") {
3867
+ msg = prop;
3868
+ prop = null;
3869
+ }
3870
+ return new Assertion(fn, msg, assert.decreases, true).to.decrease(obj, prop);
3871
+ };
3872
+ assert.decreasesBy = function(fn, obj, prop, delta, msg) {
3873
+ if (arguments.length === 4 && typeof obj === "function") {
3874
+ var tmpMsg = delta;
3875
+ delta = prop;
3876
+ msg = tmpMsg;
3877
+ } else if (arguments.length === 3) {
3878
+ delta = prop;
3879
+ prop = null;
3880
+ }
3881
+ new Assertion(fn, msg, assert.decreasesBy, true).to.decrease(obj, prop).by(delta);
3882
+ };
3883
+ assert.doesNotDecrease = function(fn, obj, prop, msg) {
3884
+ if (arguments.length === 3 && typeof obj === "function") {
3885
+ msg = prop;
3886
+ prop = null;
3887
+ }
3888
+ return new Assertion(fn, msg, assert.doesNotDecrease, true).to.not.decrease(
3889
+ obj,
3890
+ prop
3891
+ );
3892
+ };
3893
+ assert.doesNotDecreaseBy = function(fn, obj, prop, delta, msg) {
3894
+ if (arguments.length === 4 && typeof obj === "function") {
3895
+ var tmpMsg = delta;
3896
+ delta = prop;
3897
+ msg = tmpMsg;
3898
+ } else if (arguments.length === 3) {
3899
+ delta = prop;
3900
+ prop = null;
3901
+ }
3902
+ return new Assertion(fn, msg, assert.doesNotDecreaseBy, true).to.not.decrease(obj, prop).by(delta);
3903
+ };
3904
+ assert.decreasesButNotBy = function(fn, obj, prop, delta, msg) {
3905
+ if (arguments.length === 4 && typeof obj === "function") {
3906
+ var tmpMsg = delta;
3907
+ delta = prop;
3908
+ msg = tmpMsg;
3909
+ } else if (arguments.length === 3) {
3910
+ delta = prop;
3911
+ prop = null;
3912
+ }
3913
+ new Assertion(fn, msg, assert.decreasesButNotBy, true).to.decrease(obj, prop).but.not.by(delta);
3914
+ };
3915
+ assert.ifError = function(val) {
3916
+ if (val) {
3917
+ throw val;
3918
+ }
3919
+ };
3920
+ assert.isExtensible = function(obj, msg) {
3921
+ new Assertion(obj, msg, assert.isExtensible, true).to.be.extensible;
3922
+ };
3923
+ assert.isNotExtensible = function(obj, msg) {
3924
+ new Assertion(obj, msg, assert.isNotExtensible, true).to.not.be.extensible;
3925
+ };
3926
+ assert.isSealed = function(obj, msg) {
3927
+ new Assertion(obj, msg, assert.isSealed, true).to.be.sealed;
3928
+ };
3929
+ assert.isNotSealed = function(obj, msg) {
3930
+ new Assertion(obj, msg, assert.isNotSealed, true).to.not.be.sealed;
3931
+ };
3932
+ assert.isFrozen = function(obj, msg) {
3933
+ new Assertion(obj, msg, assert.isFrozen, true).to.be.frozen;
3934
+ };
3935
+ assert.isNotFrozen = function(obj, msg) {
3936
+ new Assertion(obj, msg, assert.isNotFrozen, true).to.not.be.frozen;
3937
+ };
3938
+ assert.isEmpty = function(val, msg) {
3939
+ new Assertion(val, msg, assert.isEmpty, true).to.be.empty;
3940
+ };
3941
+ assert.isNotEmpty = function(val, msg) {
3942
+ new Assertion(val, msg, assert.isNotEmpty, true).to.not.be.empty;
3943
+ };
3944
+ assert.containsSubset = function(val, exp, msg) {
3945
+ new Assertion(val, msg).to.containSubset(exp);
3946
+ };
3947
+ assert.doesNotContainSubset = function(val, exp, msg) {
3948
+ new Assertion(val, msg).to.not.containSubset(exp);
3949
+ };
3950
+ var aliases = [
3951
+ ["isOk", "ok"],
3952
+ ["isNotOk", "notOk"],
3953
+ ["throws", "throw"],
3954
+ ["throws", "Throw"],
3955
+ ["isExtensible", "extensible"],
3956
+ ["isNotExtensible", "notExtensible"],
3957
+ ["isSealed", "sealed"],
3958
+ ["isNotSealed", "notSealed"],
3959
+ ["isFrozen", "frozen"],
3960
+ ["isNotFrozen", "notFrozen"],
3961
+ ["isEmpty", "empty"],
3962
+ ["isNotEmpty", "notEmpty"],
3963
+ ["isCallable", "isFunction"],
3964
+ ["isNotCallable", "isNotFunction"],
3965
+ ["containsSubset", "containSubset"]
3966
+ ];
3967
+ for (const [name, as] of aliases) {
3968
+ assert[as] = assert[name];
3969
+ }
3970
+ var used = [];
3971
+ function use(fn) {
3972
+ const exports2 = {
3973
+ use,
3974
+ AssertionError,
3975
+ util: utils_exports,
3976
+ config,
3977
+ expect,
3978
+ assert,
3979
+ Assertion,
3980
+ ...should_exports
3981
+ };
3982
+ if (!~used.indexOf(fn)) {
3983
+ fn(exports2, utils_exports);
3984
+ used.push(fn);
3985
+ }
3986
+ return exports2;
3987
+ }
3988
+ __name(use, "use");
3989
+ /*!
3990
+ * Chai - flag utility
3991
+ * Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
3992
+ * MIT Licensed
3993
+ */
3994
+ /*!
3995
+ * Chai - test utility
3996
+ * Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
3997
+ * MIT Licensed
3998
+ */
3999
+ /*!
4000
+ * Chai - expectTypes utility
4001
+ * Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
4002
+ * MIT Licensed
4003
+ */
4004
+ /*!
4005
+ * Chai - getActual utility
4006
+ * Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
4007
+ * MIT Licensed
4008
+ */
4009
+ /*!
4010
+ * Chai - message composition utility
4011
+ * Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
4012
+ * MIT Licensed
4013
+ */
4014
+ /*!
4015
+ * Chai - transferFlags utility
4016
+ * Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
4017
+ * MIT Licensed
4018
+ */
4019
+ /*!
4020
+ * chai
4021
+ * http://chaijs.com
4022
+ * Copyright(c) 2011-2014 Jake Luer <jake@alogicalparadox.com>
4023
+ * MIT Licensed
4024
+ */
4025
+ /*!
4026
+ * Chai - isProxyEnabled helper
4027
+ * Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
4028
+ * MIT Licensed
4029
+ */
4030
+ /*!
4031
+ * Chai - addProperty utility
4032
+ * Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
4033
+ * MIT Licensed
4034
+ */
4035
+ /*!
4036
+ * Chai - addLengthGuard utility
4037
+ * Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
4038
+ * MIT Licensed
4039
+ */
4040
+ /*!
4041
+ * Chai - getProperties utility
4042
+ * Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
4043
+ * MIT Licensed
4044
+ */
4045
+ /*!
4046
+ * Chai - proxify utility
4047
+ * Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
4048
+ * MIT Licensed
4049
+ */
4050
+ /*!
4051
+ * Chai - addMethod utility
4052
+ * Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
4053
+ * MIT Licensed
4054
+ */
4055
+ /*!
4056
+ * Chai - overwriteProperty utility
4057
+ * Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
4058
+ * MIT Licensed
4059
+ */
4060
+ /*!
4061
+ * Chai - overwriteMethod utility
4062
+ * Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
4063
+ * MIT Licensed
4064
+ */
4065
+ /*!
4066
+ * Chai - addChainingMethod utility
4067
+ * Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
4068
+ * MIT Licensed
4069
+ */
4070
+ /*!
4071
+ * Chai - overwriteChainableMethod utility
4072
+ * Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
4073
+ * MIT Licensed
4074
+ */
4075
+ /*!
4076
+ * Chai - compareByInspect utility
4077
+ * Copyright(c) 2011-2016 Jake Luer <jake@alogicalparadox.com>
4078
+ * MIT Licensed
4079
+ */
4080
+ /*!
4081
+ * Chai - getOwnEnumerablePropertySymbols utility
4082
+ * Copyright(c) 2011-2016 Jake Luer <jake@alogicalparadox.com>
4083
+ * MIT Licensed
4084
+ */
4085
+ /*!
4086
+ * Chai - getOwnEnumerableProperties utility
4087
+ * Copyright(c) 2011-2016 Jake Luer <jake@alogicalparadox.com>
4088
+ * MIT Licensed
4089
+ */
4090
+ /*!
4091
+ * Chai - isNaN utility
4092
+ * Copyright(c) 2012-2015 Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
4093
+ * MIT Licensed
4094
+ */
4095
+ /*!
4096
+ * chai
4097
+ * Copyright(c) 2011 Jake Luer <jake@alogicalparadox.com>
4098
+ * MIT Licensed
4099
+ */
4100
+ /*!
4101
+ * chai
4102
+ * Copyright(c) 2011-2014 Jake Luer <jake@alogicalparadox.com>
4103
+ * MIT Licensed
4104
+ */
4105
+ /*! Bundled license information:
4106
+
4107
+ deep-eql/index.js:
4108
+ (*!
4109
+ * deep-eql
4110
+ * Copyright(c) 2013 Jake Luer <jake@alogicalparadox.com>
4111
+ * MIT Licensed
4112
+ *)
4113
+ (*!
4114
+ * Check to see if the MemoizeMap has recorded a result of the two operands
4115
+ *
4116
+ * @param {Mixed} leftHandOperand
4117
+ * @param {Mixed} rightHandOperand
4118
+ * @param {MemoizeMap} memoizeMap
4119
+ * @returns {Boolean|null} result
4120
+ *)
4121
+ (*!
4122
+ * Set the result of the equality into the MemoizeMap
4123
+ *
4124
+ * @param {Mixed} leftHandOperand
4125
+ * @param {Mixed} rightHandOperand
4126
+ * @param {MemoizeMap} memoizeMap
4127
+ * @param {Boolean} result
4128
+ *)
4129
+ (*!
4130
+ * Primary Export
4131
+ *)
4132
+ (*!
4133
+ * The main logic of the `deepEqual` function.
4134
+ *
4135
+ * @param {Mixed} leftHandOperand
4136
+ * @param {Mixed} rightHandOperand
4137
+ * @param {Object} [options] (optional) Additional options
4138
+ * @param {Array} [options.comparator] (optional) Override default algorithm, determining custom equality.
4139
+ * @param {Array} [options.memoize] (optional) Provide a custom memoization object which will cache the results of
4140
+ complex objects for a speed boost. By passing `false` you can disable memoization, but this will cause circular
4141
+ references to blow the stack.
4142
+ * @return {Boolean} equal match
4143
+ *)
4144
+ (*!
4145
+ * Compare two Regular Expressions for equality.
4146
+ *
4147
+ * @param {RegExp} leftHandOperand
4148
+ * @param {RegExp} rightHandOperand
4149
+ * @return {Boolean} result
4150
+ *)
4151
+ (*!
4152
+ * Compare two Sets/Maps for equality. Faster than other equality functions.
4153
+ *
4154
+ * @param {Set} leftHandOperand
4155
+ * @param {Set} rightHandOperand
4156
+ * @param {Object} [options] (Optional)
4157
+ * @return {Boolean} result
4158
+ *)
4159
+ (*!
4160
+ * Simple equality for flat iterable objects such as Arrays, TypedArrays or Node.js buffers.
4161
+ *
4162
+ * @param {Iterable} leftHandOperand
4163
+ * @param {Iterable} rightHandOperand
4164
+ * @param {Object} [options] (Optional)
4165
+ * @return {Boolean} result
4166
+ *)
4167
+ (*!
4168
+ * Simple equality for generator objects such as those returned by generator functions.
4169
+ *
4170
+ * @param {Iterable} leftHandOperand
4171
+ * @param {Iterable} rightHandOperand
4172
+ * @param {Object} [options] (Optional)
4173
+ * @return {Boolean} result
4174
+ *)
4175
+ (*!
4176
+ * Determine if the given object has an @@iterator function.
4177
+ *
4178
+ * @param {Object} target
4179
+ * @return {Boolean} `true` if the object has an @@iterator function.
4180
+ *)
4181
+ (*!
4182
+ * Gets all iterator entries from the given Object. If the Object has no @@iterator function, returns an empty array.
4183
+ * This will consume the iterator - which could have side effects depending on the @@iterator implementation.
4184
+ *
4185
+ * @param {Object} target
4186
+ * @returns {Array} an array of entries from the @@iterator function
4187
+ *)
4188
+ (*!
4189
+ * Gets all entries from a Generator. This will consume the generator - which could have side effects.
4190
+ *
4191
+ * @param {Generator} target
4192
+ * @returns {Array} an array of entries from the Generator.
4193
+ *)
4194
+ (*!
4195
+ * Gets all own and inherited enumerable keys from a target.
4196
+ *
4197
+ * @param {Object} target
4198
+ * @returns {Array} an array of own and inherited enumerable keys from the target.
4199
+ *)
4200
+ (*!
4201
+ * Determines if two objects have matching values, given a set of keys. Defers to deepEqual for the equality check of
4202
+ * each key. If any value of the given key is not equal, the function will return false (early).
4203
+ *
4204
+ * @param {Mixed} leftHandOperand
4205
+ * @param {Mixed} rightHandOperand
4206
+ * @param {Array} keys An array of keys to compare the values of leftHandOperand and rightHandOperand against
4207
+ * @param {Object} [options] (Optional)
4208
+ * @return {Boolean} result
4209
+ *)
4210
+ (*!
4211
+ * Recursively check the equality of two Objects. Once basic sameness has been established it will defer to `deepEqual`
4212
+ * for each enumerable key in the object.
4213
+ *
4214
+ * @param {Mixed} leftHandOperand
4215
+ * @param {Mixed} rightHandOperand
4216
+ * @param {Object} [options] (Optional)
4217
+ * @return {Boolean} result
4218
+ *)
4219
+ (*!
4220
+ * Returns true if the argument is a primitive.
4221
+ *
4222
+ * This intentionally returns true for all objects that can be compared by reference,
4223
+ * including functions and symbols.
4224
+ *
4225
+ * @param {Mixed} value
4226
+ * @return {Boolean} result
4227
+ *)
4228
+ */
4229
+ exports.Assertion = Assertion;
4230
+ exports.AssertionError = AssertionError;
4231
+ exports.Should = Should;
4232
+ exports.assert = assert;
4233
+ exports.config = config;
4234
+ exports.expect = expect;
4235
+ exports.should = should;
4236
+ exports.use = use;
4237
+ exports.util = utils_exports;