-
Notifications
You must be signed in to change notification settings - Fork 4
/
index.js
818 lines (690 loc) · 27 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
"use strict"
/**
* Core TDD-style assertions. These are done by a composition of DSLs, since
* there is *so* much repetition.
*/
var match = require("./lib/match")
var comparison = require("./lib/comparison")
var inspect = require("./lib/inspect")
exports.inspect = inspect
exports.matchLoose = match.loose
exports.matchStrict = match.strict
var hasOwn = Object.prototype.hasOwnProperty
var AssertionError
try {
AssertionError = new Function( // eslint-disable-line no-new-func
"class AssertionError extends Error{" +
"constructor(m,a,e){super(m);this.actual=a;this.expected=e}" +
"get name(){return'AssertionError'}" +
"}" +
// check native subclassing support
"if('a'!=new AssertionError('a',1,2).message)throw'';" +
"return AssertionError"
)()
} catch (e) {
// Take advantage of V8's always-exposed stack trace API.
AssertionError = typeof Error.captureStackTrace === "function"
? function AssertionError(message, actual, expected) {
this.message = message || ""
this.expected = expected
this.actual = actual
Error.captureStackTrace(this, AssertionError)
}
: function AssertionError(message, actual, expected) {
var e = new Error(message)
e.name = "AssertionError"
this.message = e.message
this.expected = expected
this.actual = actual
this.stack = e.stack
// PhantomJS, IE, and possibly Edge don't set the stack trace until
// the error is thrown. Note that this prefers an existing stack
// first, since most everyone else already contains this.
if (this.stack == null) {
try {
throw e
} catch (e) {
this.stack = e.stack
}
}
}
AssertionError.prototype = Object.create(Error.prototype)
Object.defineProperty(AssertionError.prototype, "constructor", {
configurable: true,
writable: true,
enumerable: false,
value: AssertionError,
})
Object.defineProperty(AssertionError.prototype, "name", {
configurable: true,
writable: true,
enumerable: false,
value: "AssertionError",
})
}
exports.AssertionError = AssertionError
exports.escape = function (string) {
if (typeof string !== "string") {
throw new TypeError("`string` must be a string")
}
return string.replace(/\{.+?\}/g, function (m) { return "\\" + m })
}
// This formats the assertion error messages.
exports.format = format
function format(message, opts, prettify) {
if (prettify == null) prettify = inspect
if (typeof message !== "string") {
throw new TypeError("`message` must be a string")
}
if (typeof opts !== "object" || opts === null) {
throw new TypeError("`opts` must be an object")
}
checkCallable(prettify, "prettify")
return message.replace(/\\?\{.+?\}/g, function (m) {
if (m[0] === "\\") return m.slice(1)
var prop = m.slice(1, -1)
if (!hasOwn.call(opts, prop)) return m
return prettify(opts[prop], {depth: 5})
})
}
// The basic assert, like `assert.ok`, but gives you an optional message.
exports.assert = assert
function assert(test, message, actual, expected) {
if (!test) {
if (arguments.length > 2) {
message = format(message, {actual: actual, expected: expected})
}
throw new AssertionError(message, actual, expected)
}
}
exports.fail = fail
function fail(message, actual, expected) {
if (arguments.length <= 1) throw new AssertionError(message)
throw new AssertionError(
format(message, {actual: actual, expected: expected}),
actual, expected
)
}
exports.failFormat = failFormat
function failFormat(message, opts, prettify) {
throw new AssertionError(
format(message, opts, prettify),
opts.actual, opts.expected
)
}
function checkNumber(value, name) {
if (typeof value !== "number") {
throw new TypeError("`" + name + "` must be a number")
}
}
function checkCallable(value, name) {
if (typeof value !== "function") {
throw new TypeError("`" + name + "` must be a function")
}
}
function isCollection(value) {
return value != null && (
typeof value[comparison.symbolIterator] === "function" ||
typeof value.length === "number"
)
}
function checkCollection(value, name) {
if (!isCollection(value)) {
throw new TypeError("`" + name + "` must be an iterable or array-like")
}
}
function isReferenceType(object) {
return object != null && (
typeof object === "function" ||
typeof object === "object"
)
}
function checkReferenceType(value, name) {
if (!isReferenceType(value)) {
throw new TypeError("`" + name + "` must be an iterable or array-like")
}
}
/* eslint-disable max-len */
var hasMessages = [
"Expected {object} to have own key {key} equal to {expected}, but found {actual}",
"Expected {object} to have own key {expected}",
"Expected {object} to not have own key {key} equal to {actual}",
"Expected {object} to not have own key {expected}",
"Expected {object} to have key {key} equal to {expected}, but found {actual}",
"Expected {object} to have key {expected}",
"Expected {object} to not have key {key} equal to {actual}",
"Expected {object} to not have key {expected}",
]
/* eslint-enable max-len */
function makeHas(test, get, is, index) {
return function (object, key, value) {
var invert = (index & 2) !== 0
if ((test(object, key) && is(get(object, key), value)) === invert) {
failFormat(hasMessages[index], {
actual: object[key], expected: value,
object: object, key: key,
})
}
}
}
function makeHasOverload(test, get, is, index) {
return function (object, key, value) {
var invert = (index & 2) !== 0
if (arguments.length >= 3) {
if ((test(object, key) && is(get(object, key), value)) === invert) {
failFormat(hasMessages[index], {
actual: object[key], expected: value,
object: object, key: key,
})
}
} else if (test(object, key) === invert) {
failFormat(hasMessages[index + 1], {
actual: object[key], expected: value,
object: object, key: key,
})
}
}
}
function testHasOwn(object, key) { return hasOwn.call(object, key) }
function testHasIn(object, key) { return key in object }
function testHasKey(object, key) { return object.has(key) }
function getProperty(object, key) { return object[key] }
function getMethod(object, key) { return object.get(key) }
var includesTemplates = [
"Expected {coll} to include {expected}",
"Expected {coll} to not include {expected}",
]
function makeIncludes(type, mask) {
return function (coll, expected) {
checkCollection(coll, "coll")
if (comparison.simpleIncludes(
comparison.arrayFrom(coll), expected, type
) === ((mask & 1) !== 0)) {
failFormat(
includesTemplates[mask >>> 1],
{coll: coll, expected: expected}
)
}
}
}
var equalsAnyTemplates = [
"Expected {actual} to equal one of {coll}",
"Expected {actual} to not equal one of {coll}",
]
function makeEqualsAny(type, index) {
return function (actual, coll) {
checkCollection(coll, "coll")
if (comparison.simpleIncludes(
comparison.arrayFrom(coll), actual, type
) === (index !== 0)) {
failFormat(
equalsAnyTemplates[index],
{actual: actual, coll: coll}
)
}
}
}
var includesMultiTemplates = [
"Expected {coll} to include all values in {expected}",
"Expected {coll} to exclude all values in {expected}",
"Expected {coll} to include any value in {expected}",
"Expected {coll} to exclude any value in {expected}",
]
function makeIncludesMulti(type, mask) {
return function (coll, expected) {
checkCollection(coll, "coll")
checkCollection(expected, "expected")
if (comparison.includesDeepCheck(
comparison.arrayFrom(coll),
comparison.arrayFrom(expected),
type, (mask & 1) !== 0
) === ((mask & 2) !== 0)) {
failFormat(
includesMultiTemplates[mask],
{coll: coll, expected: expected}
)
}
}
}
var hasKeysMessages = [
"Expected {object} to have all keys in {expected}, but found {actual}",
"Expected {object} to have any key in {expected}, but found {actual}",
"Expected {object} to lack all keys in {expected}, but found {actual}",
"Expected {object} to lack any key in {expected}, but found {actual}",
]
function makeHasKeys(mask, test, get, is) {
return function (object, expected) {
checkReferenceType(object, "object")
if (!isReferenceType(expected) && typeof expected !== "string") {
throw new TypeError(
"`expected` must be an object, iterable, or array-like"
)
}
var checkKeysOnly = isCollection(expected)
// exclusive or to invert the result if `invert` is true
// boolean equality is equivalent to exclusive or
if ((
checkKeysOnly
? comparison.hasKeysTest(
object, comparison.arrayFrom(expected),
test, (mask & 1) !== 0
)
: object === expected || comparison.hasKeysCheck(
object, expected,
test, get, is, (mask & 1) !== 0
)
) === ((mask & 2) !== 0)) {
var actual
if (checkKeysOnly) {
actual = Object.keys(expected)
var count = 0
for (var i = 0; i < actual.length; i++) {
if (test(object, actual[i])) actual[count++] = actual[i]
}
actual.length = count
} else {
actual = Object.create(null)
for (var key in expected) {
if (hasOwn.call(expected, key) && test(object, key)) {
actual[key] = get(object, key)
}
}
}
failFormat(
hasKeysMessages[mask],
{object: object, actual: actual, expected: expected}
)
}
}
}
/**
* Pretty much all the assertion methods fit within a single multi-dimensional
* matrix documented within `docs/README.md`.
*
* Not all assertion methods have variants in each of these:
*
* - `assert` has no inverse.
* - `fail` and `failFormat` just fail unconditionally.
* - `throws` and `throwsMatching` have no inverse, since it usually makes more
* sense to just let the exception propagate instead. You get to keep the
* stack trace this way, which is all around just generally more helpful for
* debugging.
* - Most methods have inverses named after single-word or two-word antonyms:
* - "includes" becomes "excludes"
* - "has" becomes "lacks"
* - `atLeast` becomes `below`
* - `atMost` becomes `above`
* - Several methods only have one match type/location: `atLeast`/`below`,
* `atMost`/`above`, `ok`/`notOk`, `is`/`not`, `maybeIs`/`maybeNot`,
* `between`/`notBetween`, and `closeTo`/`notCloseTo`.
*
* In total, this is a little over 100 separate, dedicated assertions
*
* [1]: http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero
*/
exports.ok = function (x) {
assert(x != null, "Expected {actual} to not be null or undefined", x)
}
exports.notOk = function (x) {
assert(x == null, "Expected {actual} to be null or undefined", x)
}
exports.is = function (Type, object) {
if (object == null || !comparison.isType(Type, object)) {
if (typeof Type === "string") {
fail(
"Expected {actual} to be " +
(/^[aeiou]/.test(Type) ? "a " : "an ") + Type,
object, undefined
)
} else {
failFormat(
"Expected {object} to be an instance of {expected}",
{actual: object.constructor, expected: Type, object: object}
)
}
}
}
exports.not = function (Type, object) {
if (object != null && comparison.isType(Type, object)) {
if (typeof Type === "string") {
fail(
"Expected {actual} to not be " +
(/^[aeiou]/.test(Type) ? "a " : "an ") + Type,
object, undefined
)
} else {
failFormat(
"Expected {object} to not be an instance of {expected}",
{actual: object.constructor, expected: Type, object: object}
)
}
}
}
exports.possibly = function (Type, object) {
if (object != null && !comparison.isType(Type, object)) {
if (typeof Type === "string") {
fail(
"Expected {actual} to possibly be " +
(/^[aeiou]/.test(Type) ? "a " : "an ") + Type,
object, undefined
)
} else {
failFormat(
"Expected {object} to possibly be an instance of {expected}",
{actual: object.constructor, expected: Type, object: object}
)
}
}
}
exports.notPossibly = function (Type, object) {
if (object == null || comparison.isType(Type, object)) {
if (typeof Type === "string") {
fail(
"Expected {actual} to not possibly be " +
(/^[aeiou]/.test(Type) ? "a " : "an ") + Type,
object, undefined
)
} else {
failFormat(
"Expected {object} to not possibly be " +
"an instance of {expected}",
{actual: object.constructor, expected: Type, object: object}
)
}
}
}
exports.atLeast = function (actual, expected) {
checkNumber(actual, "actual")
checkNumber(expected, "expected")
assert(
actual >= expected,
"Expected {actual} to be at least {expected}",
actual, expected
)
}
exports.atMost = function (actual, expected) {
checkNumber(actual, "actual")
checkNumber(expected, "expected")
assert(
actual <= expected,
"Expected {actual} to be at most {expected}",
actual, expected
)
}
exports.above = function (actual, expected) {
checkNumber(actual, "actual")
checkNumber(expected, "expected")
assert(
actual > expected,
"Expected {actual} to be above {expected}",
actual, expected
)
}
exports.below = function (actual, expected) {
checkNumber(actual, "actual")
checkNumber(expected, "expected")
assert(
actual < expected,
"Expected {actual} to be below {expected}",
actual, expected
)
}
exports.between = function (actual, lower, upper) {
checkNumber(actual, "actual")
checkNumber(lower, "lower")
checkNumber(upper, "upper")
if (
// eslint-disable-next-line no-self-compare
actual !== actual || lower !== lower || upper !== upper ||
actual < lower || actual > upper
) {
failFormat(
"Expected {actual} to be between {lower} and {upper}",
{actual: actual, lower: lower, upper: upper}
)
}
}
// Note: this is high enough to cover roundoff and other highly inaccurate
// computations that frequently end up in application code (where precision
// isn't always important), but not so high it fails to address truly non-equal
// values. It was chosen through a bit of trial and error.
var defaultTolerance = 1e-8
// Note: these two always fail when dealing with NaNs.
exports.closeTo = function (actual, expected, tolerance) {
checkNumber(actual, "actual")
checkNumber(expected, "expected")
if (tolerance == null) tolerance = defaultTolerance
checkNumber(tolerance, "tolerance")
if (tolerance < 0) throw new RangeError("`tolerance` must be non-negative")
assert(
// eslint-disable-next-line no-self-compare
actual === actual && expected === expected && tolerance === tolerance &&
comparison.closeTo(actual, expected, tolerance),
"Expected {actual} to be close to {expected}",
actual, expected
)
}
exports.notCloseTo = function (actual, expected, tolerance) {
checkNumber(actual, "actual")
checkNumber(expected, "expected")
if (tolerance == null) tolerance = defaultTolerance
checkNumber(tolerance, "tolerance")
if (tolerance < 0) throw new RangeError("`tolerance` must be non-negative")
assert(
// eslint-disable-next-line no-self-compare
actual === actual && expected === expected && tolerance === tolerance &&
!comparison.closeTo(actual, expected, tolerance),
"Expected {actual} to not be close to {expected}",
actual, expected
)
}
exports.notBetween = function (actual, lower, upper) {
checkNumber(actual, "actual")
checkNumber(lower, "lower")
checkNumber(upper, "upper")
if (
// eslint-disable-next-line no-self-compare
actual !== actual || lower !== lower || upper !== upper ||
actual >= lower && actual <= upper
) {
failFormat(
"Expected {actual} to not be between {lower} and {upper}",
{actual: actual, lower: lower, upper: upper}
)
}
}
exports.equal = function (actual, expected) {
assert(match.loose(actual, expected),
"Expected {actual} to equal {expected}",
actual, expected
)
}
exports.notEqual = function (actual, expected) {
assert(!match.loose(actual, expected),
"Expected {actual} to not equal {expected}",
actual, expected
)
}
exports.equalsAny = makeEqualsAny(match.loose, 0)
exports.equalsNone = makeEqualsAny(match.loose, 1)
exports.hasOwn = makeHasOverload(testHasOwn, getProperty, match.loose, 0x0)
exports.lacksOwn = makeHasOverload(testHasOwn, getProperty, match.loose, 0x2)
exports.hasIn = makeHasOverload(testHasIn, getProperty, match.loose, 0x4)
exports.lacksIn = makeHasOverload(testHasIn, getProperty, match.loose, 0x6)
exports.hasKey = makeHasOverload(testHasKey, getMethod, match.loose, 0x0)
exports.lacksKey = makeHasOverload(testHasKey, getMethod, match.loose, 0x6)
exports.includes = makeIncludes(match.loose, 0x0)
exports.excludes = makeIncludes(match.loose, 0x1)
exports.includesAll = makeIncludesMulti(match.loose, 0x0)
exports.excludesAll = makeIncludesMulti(match.loose, 0x2)
exports.includesAny = makeIncludesMulti(match.loose, 0x1)
exports.excludesAny = makeIncludesMulti(match.loose, 0x3)
exports.hasAllOwn = makeHasKeys(0x0, testHasOwn, getProperty, match.loose)
exports.lacksAllOwn = makeHasKeys(0x2, testHasOwn, getProperty, match.loose)
exports.hasAnyOwn = makeHasKeys(0x1, testHasOwn, getProperty, match.loose)
exports.lacksAnyOwn = makeHasKeys(0x3, testHasOwn, getProperty, match.loose)
exports.hasAllIn = makeHasKeys(0x0, testHasIn, getProperty, match.loose)
exports.lacksAllIn = makeHasKeys(0x2, testHasIn, getProperty, match.loose)
exports.hasAnyIn = makeHasKeys(0x1, testHasIn, getProperty, match.loose)
exports.lacksAnyIn = makeHasKeys(0x3, testHasIn, getProperty, match.loose)
exports.hasAllKeys = makeHasKeys(0x0, testHasKey, getMethod, match.loose)
exports.lacksAllKeys = makeHasKeys(0x2, testHasKey, getMethod, match.loose)
exports.hasAnyKey = makeHasKeys(0x1, testHasKey, getMethod, match.loose)
exports.lacksAnyKey = makeHasKeys(0x3, testHasKey, getMethod, match.loose)
exports.throws = function (Type, callback) {
if (!isReferenceType(Type) && typeof Type !== "string") {
throw new TypeError(
"`Type` must be a string, function, or object with " +
"`Symbol.hasInstance`"
)
}
checkCallable(callback, "callback")
try {
callback() // eslint-disable-line callback-return
} catch (e) {
assert(comparison.isType(Type, e),
"Expected callback to throw an instance of {expected}, " +
"but found {actual}",
e, Type
)
return
}
throw new AssertionError("Expected callback to throw")
}
exports.throwsMatching = function (matcher, callback) {
var type
if (typeof matcher === "string") {
type = 0
} else if (typeof matcher === "function") {
type = 1
} else if (matcher instanceof RegExp) {
type = 2
} else if (
matcher != null &&
Object.getPrototypeOf(matcher) === Object.prototype
) {
type = 3
} else {
throw new TypeError(
"`matcher` must be a string, function, RegExp, or object"
)
}
checkCallable(callback, "callback")
try {
callback() // eslint-disable-line callback-return
} catch (e) {
if (type === 0) {
assert(e.message === matcher,
"Expected callback to throw an error with message " +
"{expected}, but found {actual}",
e, matcher
)
} else if (type === 1) {
assert(
matcher(e),
"Expected callback to throw an error matching " +
"{expected}, but found {actual}",
e, matcher
)
} else if (type === 2) {
assert(
matcher.test(e.message),
"Expected callback to throw an error with message " +
"matching {expected}, but found {actual}",
e, matcher
)
} else {
assert(
comparison.hasKeysCheck(
e, matcher,
testHasIn, getProperty, match.loose, false
),
"Expected callback to throw an error matching " +
"{expected}, but found {actual}",
e, matcher
)
}
return
}
fail("Expected callback to throw an error", undefined, matcher)
}
exports.exactlyEqual = function (actual, expected) {
assert(comparison.sameValueZero(actual, expected),
"Expected {actual} to exactly equal {expected}",
actual, expected
)
}
exports.exactlyNotEqual = function (actual, expected) {
assert(!comparison.sameValueZero(actual, expected),
"Expected {actual} to not exactly equal {expected}",
actual, expected
)
}
exports.exactlyEqualsAny = makeEqualsAny(comparison.sameValueZero, 0)
exports.exactlyEqualsNone = makeEqualsAny(comparison.sameValueZero, 1)
/* eslint-disable max-len */
exports.exactlyHasOwn = makeHas(testHasOwn, getProperty, comparison.sameValueZero, 0x0)
exports.exactlyLacksOwn = makeHas(testHasOwn, getProperty, comparison.sameValueZero, 0x2)
exports.exactlyHasIn = makeHas(testHasIn, getProperty, comparison.sameValueZero, 0x4)
exports.exactlyLacksIn = makeHas(testHasIn, getProperty, comparison.sameValueZero, 0x6)
exports.exactlyHasKey = makeHas(testHasKey, getMethod, comparison.sameValueZero, 0x4)
exports.exactlyLacksKey = makeHas(testHasKey, getMethod, comparison.sameValueZero, 0x6)
exports.exactlyIncludes = makeIncludes(comparison.sameValueZero, 0x0)
exports.exactlyExcludes = makeIncludes(comparison.sameValueZero, 0x1)
exports.exactlyIncludesAll = makeIncludesMulti(comparison.sameValueZero, 0x0)
exports.exactlyExcludesAll = makeIncludesMulti(comparison.sameValueZero, 0x2)
exports.exactlyIncludesAny = makeIncludesMulti(comparison.sameValueZero, 0x1)
exports.exactlyExcludesAny = makeIncludesMulti(comparison.sameValueZero, 0x3)
exports.exactlyHasAllOwn = makeHasKeys(0x0, testHasOwn, getProperty, comparison.sameValueZero)
exports.exactlyLacksAllOwn = makeHasKeys(0x2, testHasOwn, getProperty, comparison.sameValueZero)
exports.exactlyHasAnyOwn = makeHasKeys(0x1, testHasOwn, getProperty, comparison.sameValueZero)
exports.exactlyLacksAnyOwn = makeHasKeys(0x3, testHasOwn, getProperty, comparison.sameValueZero)
exports.exactlyHasAllIn = makeHasKeys(0x0, testHasIn, getProperty, comparison.sameValueZero)
exports.exactlyLacksAllIn = makeHasKeys(0x2, testHasIn, getProperty, comparison.sameValueZero)
exports.exactlyHasAnyIn = makeHasKeys(0x1, testHasIn, getProperty, comparison.sameValueZero)
exports.exactlyLacksAnyIn = makeHasKeys(0x3, testHasIn, getProperty, comparison.sameValueZero)
exports.exactlyHasAllKeys = makeHasKeys(0x0, testHasKey, getMethod, comparison.sameValueZero)
exports.exactlyLacksAllKeys = makeHasKeys(0x2, testHasKey, getMethod, comparison.sameValueZero)
exports.exactlyHasAnyKey = makeHasKeys(0x1, testHasKey, getMethod, comparison.sameValueZero)
exports.exactlyLacksAnyKey = makeHasKeys(0x3, testHasKey, getMethod, comparison.sameValueZero)
/* eslint-enable max-len */
exports.deeplyEqual = function (actual, expected) {
assert(match.strict(actual, expected),
"Expected {actual} to deeply equal {expected}",
actual, expected
)
}
exports.deeplyNotEqual = function (actual, expected) {
assert(!match.strict(actual, expected),
"Expected {actual} to deeply equal {expected}",
actual, expected
)
}
exports.deeplyEqualsAny = makeEqualsAny(match.strict, 0)
exports.deeplyEqualsNone = makeEqualsAny(match.strict, 1)
exports.deeplyHasOwn = makeHas(testHasOwn, getProperty, match.strict, 0x0)
exports.deeplyLacksOwn = makeHas(testHasOwn, getProperty, match.strict, 0x2)
exports.deeplyHasIn = makeHas(testHasIn, getProperty, match.strict, 0x4)
exports.deeplyLacksIn = makeHas(testHasIn, getProperty, match.strict, 0x6)
exports.deeplyHasKey = makeHas(testHasKey, getMethod, match.strict, 0x4)
exports.deeplyLacksKey = makeHas(testHasKey, getMethod, match.strict, 0x6)
exports.deeplyIncludes = makeIncludes(match.strict, 0x0)
exports.deeplyExcludes = makeIncludes(match.strict, 0x1)
exports.deeplyIncludesAll = makeIncludesMulti(match.strict, 0x0)
exports.deeplyExcludesAll = makeIncludesMulti(match.strict, 0x2)
exports.deeplyIncludesAny = makeIncludesMulti(match.strict, 0x1)
exports.deeplyExcludesAny = makeIncludesMulti(match.strict, 0x3)
/* eslint-disable max-len */
exports.deeplyHasAllOwn = makeHasKeys(0x0, testHasOwn, getProperty, match.strict)
exports.deeplyLacksAllOwn = makeHasKeys(0x2, testHasOwn, getProperty, match.strict)
exports.deeplyHasAnyOwn = makeHasKeys(0x1, testHasOwn, getProperty, match.strict)
exports.deeplyLacksAnyOwn = makeHasKeys(0x3, testHasOwn, getProperty, match.strict)
exports.deeplyHasAllIn = makeHasKeys(0x0, testHasIn, getProperty, match.strict)
exports.deeplyLacksAllIn = makeHasKeys(0x2, testHasIn, getProperty, match.strict)
exports.deeplyHasAnyIn = makeHasKeys(0x1, testHasIn, getProperty, match.strict)
exports.deeplyLacksAnyIn = makeHasKeys(0x3, testHasIn, getProperty, match.strict)
exports.deeplyHasAllKeys = makeHasKeys(0x0, testHasKey, getMethod, match.strict)
exports.deeplyLacksAllKeys = makeHasKeys(0x2, testHasKey, getMethod, match.strict)
exports.deeplyHasAnyKey = makeHasKeys(0x1, testHasKey, getMethod, match.strict)
exports.deeplyLacksAnyKey = makeHasKeys(0x3, testHasKey, getMethod, match.strict)
/* eslint-enable max-len */