chai 5.1.0 → 5.1.1

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 (38) hide show
  1. package/README.md +3 -3
  2. package/chai.js +68 -42
  3. package/eslint.config.js +12 -0
  4. package/lib/chai/assertion.js +28 -28
  5. package/lib/chai/config.js +18 -24
  6. package/lib/chai/core/assertions.js +216 -220
  7. package/lib/chai/interface/assert.js +406 -397
  8. package/lib/chai/interface/expect.js +7 -2
  9. package/lib/chai/interface/should.js +30 -20
  10. package/lib/chai/utils/addChainableMethod.js +5 -6
  11. package/lib/chai/utils/addLengthGuard.js +3 -3
  12. package/lib/chai/utils/addMethod.js +5 -6
  13. package/lib/chai/utils/addProperty.js +5 -6
  14. package/lib/chai/utils/compareByInspect.js +4 -5
  15. package/lib/chai/utils/expectTypes.js +7 -8
  16. package/lib/chai/utils/flag.js +5 -5
  17. package/lib/chai/utils/getActual.js +3 -3
  18. package/lib/chai/utils/getEnumerableProperties.js +2 -3
  19. package/lib/chai/utils/getMessage.js +4 -4
  20. package/lib/chai/utils/getOperator.js +8 -4
  21. package/lib/chai/utils/getOwnEnumerableProperties.js +2 -3
  22. package/lib/chai/utils/getOwnEnumerablePropertySymbols.js +2 -3
  23. package/lib/chai/utils/getProperties.js +5 -3
  24. package/lib/chai/utils/index.js +17 -1
  25. package/lib/chai/utils/inspect.js +5 -4
  26. package/lib/chai/utils/isNaN.js +3 -3
  27. package/lib/chai/utils/isProxyEnabled.js +1 -1
  28. package/lib/chai/utils/objDisplay.js +2 -3
  29. package/lib/chai/utils/overwriteChainableMethod.js +7 -8
  30. package/lib/chai/utils/overwriteMethod.js +10 -11
  31. package/lib/chai/utils/overwriteProperty.js +10 -12
  32. package/lib/chai/utils/proxify.js +9 -9
  33. package/lib/chai/utils/test.js +3 -3
  34. package/lib/chai/utils/transferFlags.js +4 -6
  35. package/lib/chai/utils/type-detect.js +4 -0
  36. package/lib/chai.js +2 -2
  37. package/package.json +6 -3
  38. package/web-test-runner.config.js +4 -1
package/README.md CHANGED
@@ -98,9 +98,9 @@ import { expect, use } from 'chai'; // Creates local variables `expect` and `us
98
98
  ### Usage with Mocha
99
99
 
100
100
  ```bash
101
- mocha spec.js -r chai/register-assert # Using Assert style
102
- mocha spec.js -r chai/register-expect # Using Expect style
103
- mocha spec.js -r chai/register-should # Using Should style
101
+ mocha spec.js --require chai/register-assert.js # Using Assert style
102
+ mocha spec.js --require chai/register-expect.js # Using Expect style
103
+ mocha spec.js --require chai/register-should.js # Using Should style
104
104
  ```
105
105
 
106
106
  [Read more about these styles in our docs](http://chaijs.com/guide/styles/).
package/chai.js CHANGED
@@ -38,6 +38,7 @@ __export(utils_exports, {
38
38
  inspect: () => inspect2,
39
39
  isNaN: () => isNaN2,
40
40
  isProxyEnabled: () => isProxyEnabled,
41
+ isRegExp: () => isRegExp2,
41
42
  objDisplay: () => objDisplay,
42
43
  overwriteChainableMethod: () => overwriteChainableMethod,
43
44
  overwriteMethod: () => overwriteMethod,
@@ -57,14 +58,22 @@ __export(check_error_exports, {
57
58
  getConstructorName: () => getConstructorName,
58
59
  getMessage: () => getMessage
59
60
  });
61
+ function isErrorInstance(obj) {
62
+ return obj instanceof Error || Object.prototype.toString.call(obj) === "[object Error]";
63
+ }
64
+ __name(isErrorInstance, "isErrorInstance");
65
+ function isRegExp(obj) {
66
+ return Object.prototype.toString.call(obj) === "[object RegExp]";
67
+ }
68
+ __name(isRegExp, "isRegExp");
60
69
  function compatibleInstance(thrown, errorLike) {
61
- return errorLike instanceof Error && thrown === errorLike;
70
+ return isErrorInstance(errorLike) && thrown === errorLike;
62
71
  }
63
72
  __name(compatibleInstance, "compatibleInstance");
64
73
  function compatibleConstructor(thrown, errorLike) {
65
- if (errorLike instanceof Error) {
74
+ if (isErrorInstance(errorLike)) {
66
75
  return thrown.constructor === errorLike.constructor || thrown instanceof errorLike.constructor;
67
- } else if (errorLike.prototype instanceof Error || errorLike === Error) {
76
+ } else if ((typeof errorLike === "object" || typeof errorLike === "function") && errorLike.prototype) {
68
77
  return thrown.constructor === errorLike || thrown instanceof errorLike;
69
78
  }
70
79
  return false;
@@ -72,7 +81,7 @@ function compatibleConstructor(thrown, errorLike) {
72
81
  __name(compatibleConstructor, "compatibleConstructor");
73
82
  function compatibleMessage(thrown, errMatcher) {
74
83
  const comparisonString = typeof thrown === "string" ? thrown : thrown.message;
75
- if (errMatcher instanceof RegExp) {
84
+ if (isRegExp(errMatcher)) {
76
85
  return errMatcher.test(comparisonString);
77
86
  } else if (typeof errMatcher === "string") {
78
87
  return comparisonString.indexOf(errMatcher) !== -1;
@@ -82,7 +91,7 @@ function compatibleMessage(thrown, errMatcher) {
82
91
  __name(compatibleMessage, "compatibleMessage");
83
92
  function getConstructorName(errorLike) {
84
93
  let constructorName = errorLike;
85
- if (errorLike instanceof Error) {
94
+ if (isErrorInstance(errorLike)) {
86
95
  constructorName = errorLike.constructor.name;
87
96
  } else if (typeof errorLike === "function") {
88
97
  constructorName = errorLike.name;
@@ -805,8 +814,8 @@ var config = {
805
814
  *
806
815
  * chai.config.includeStack = true; // enable stack on error
807
816
  *
808
- * @param {Boolean}
809
- * @api public
817
+ * @param {boolean}
818
+ * @public
810
819
  */
811
820
  includeStack: false,
812
821
  /**
@@ -818,8 +827,8 @@ var config = {
818
827
  * will be true when the assertion has requested a diff
819
828
  * be shown.
820
829
  *
821
- * @param {Boolean}
822
- * @api public
830
+ * @param {boolean}
831
+ * @public
823
832
  */
824
833
  showDiff: true,
825
834
  /**
@@ -838,8 +847,8 @@ var config = {
838
847
  *
839
848
  * chai.config.truncateThreshold = 0; // disable truncating
840
849
  *
841
- * @param {Number}
842
- * @api public
850
+ * @param {number}
851
+ * @public
843
852
  */
844
853
  truncateThreshold: 40,
845
854
  /**
@@ -856,8 +865,8 @@ var config = {
856
865
  * This feature is automatically disabled regardless of this config value
857
866
  * in environments that don't support proxies.
858
867
  *
859
- * @param {Boolean}
860
- * @api public
868
+ * @param {boolean}
869
+ * @public
861
870
  */
862
871
  useProxy: true,
863
872
  /**
@@ -875,7 +884,7 @@ var config = {
875
884
  * chai.config.proxyExcludedKeys = ['then', 'inspect'];
876
885
  *
877
886
  * @param {Array}
878
- * @api public
887
+ * @public
879
888
  */
880
889
  proxyExcludedKeys: ["then", "catch", "inspect", "toJSON"],
881
890
  /**
@@ -887,18 +896,18 @@ var config = {
887
896
  *
888
897
  * // use a custom comparator
889
898
  * chai.config.deepEqual = (expected, actual) => {
890
- * return chai.util.eql(expected, actual, {
891
- * comparator: (expected, actual) => {
892
- * // for non number comparison, use the default behavior
893
- * if(typeof expected !== 'number') return null;
894
- * // allow a difference of 10 between compared numbers
895
- * return typeof actual === 'number' && Math.abs(actual - expected) < 10
896
- * }
897
- * })
899
+ * return chai.util.eql(expected, actual, {
900
+ * comparator: (expected, actual) => {
901
+ * // for non number comparison, use the default behavior
902
+ * if(typeof expected !== 'number') return null;
903
+ * // allow a difference of 10 between compared numbers
904
+ * return typeof actual === 'number' && Math.abs(actual - expected) < 10
905
+ * }
906
+ * })
898
907
  * };
899
908
  *
900
909
  * @param {Function}
901
- * @api public
910
+ * @public
902
911
  */
903
912
  deepEqual: null
904
913
  };
@@ -1809,6 +1818,10 @@ function getName(fn) {
1809
1818
  return fn.name;
1810
1819
  }
1811
1820
  __name(getName, "getName");
1821
+ function isRegExp2(obj) {
1822
+ return Object.prototype.toString.call(obj) === "[object RegExp]";
1823
+ }
1824
+ __name(isRegExp2, "isRegExp");
1812
1825
 
1813
1826
  // lib/chai/core/assertions.js
1814
1827
  var { flag: flag2 } = utils_exports;
@@ -2659,14 +2672,16 @@ function assertThrows(errorLike, errMsgMatcher, msg) {
2659
2672
  flag2(this, "message", msg);
2660
2673
  var obj = flag2(this, "object"), ssfi = flag2(this, "ssfi"), flagMsg = flag2(this, "message"), negate = flag2(this, "negate") || false;
2661
2674
  new Assertion(obj, flagMsg, ssfi, true).is.a("function");
2662
- if (errorLike instanceof RegExp || typeof errorLike === "string") {
2675
+ if (isRegExp2(errorLike) || typeof errorLike === "string") {
2663
2676
  errMsgMatcher = errorLike;
2664
2677
  errorLike = null;
2665
2678
  }
2666
- var caughtErr;
2679
+ let caughtErr;
2680
+ let errorWasThrown = false;
2667
2681
  try {
2668
2682
  obj();
2669
2683
  } catch (err) {
2684
+ errorWasThrown = true;
2670
2685
  caughtErr = err;
2671
2686
  }
2672
2687
  var everyArgIsUndefined = errorLike === void 0 && errMsgMatcher === void 0;
@@ -2680,12 +2695,23 @@ function assertThrows(errorLike, errMsgMatcher, msg) {
2680
2695
  } else if (errorLike) {
2681
2696
  errorLikeString = check_error_exports.getConstructorName(errorLike);
2682
2697
  }
2698
+ let actual = caughtErr;
2699
+ if (caughtErr instanceof Error) {
2700
+ actual = caughtErr.toString();
2701
+ } else if (typeof caughtErr === "string") {
2702
+ actual = caughtErr;
2703
+ } else if (caughtErr && (typeof caughtErr === "object" || typeof caughtErr === "function")) {
2704
+ try {
2705
+ actual = check_error_exports.getConstructorName(caughtErr);
2706
+ } catch (_err) {
2707
+ }
2708
+ }
2683
2709
  this.assert(
2684
- caughtErr,
2710
+ errorWasThrown,
2685
2711
  "expected #{this} to throw " + errorLikeString,
2686
2712
  "expected #{this} to not throw an error but #{act} was thrown",
2687
2713
  errorLike && errorLike.toString(),
2688
- caughtErr instanceof Error ? caughtErr.toString() : typeof caughtErr === "string" ? caughtErr : caughtErr && check_error_exports.getConstructorName(caughtErr)
2714
+ actual
2689
2715
  );
2690
2716
  }
2691
2717
  if (errorLike && caughtErr) {
@@ -2722,7 +2748,7 @@ function assertThrows(errorLike, errMsgMatcher, msg) {
2722
2748
  }
2723
2749
  if (caughtErr && errMsgMatcher !== void 0 && errMsgMatcher !== null) {
2724
2750
  var placeholder = "including";
2725
- if (errMsgMatcher instanceof RegExp) {
2751
+ if (isRegExp2(errMsgMatcher)) {
2726
2752
  placeholder = "matching";
2727
2753
  }
2728
2754
  var isCompatibleMessage = check_error_exports.compatibleMessage(caughtErr, errMsgMatcher);
@@ -3126,8 +3152,8 @@ function loadShould() {
3126
3152
  operator
3127
3153
  }, should2.fail);
3128
3154
  };
3129
- should2.equal = function(val1, val2, msg) {
3130
- new Assertion(val1, msg).to.equal(val2);
3155
+ should2.equal = function(actual, expected, message) {
3156
+ new Assertion(actual, message).to.equal(expected);
3131
3157
  };
3132
3158
  should2.Throw = function(fn, errt, errs, msg) {
3133
3159
  new Assertion(fn, msg).to.Throw(errt, errs);
@@ -3136,8 +3162,8 @@ function loadShould() {
3136
3162
  new Assertion(val, msg).to.exist;
3137
3163
  };
3138
3164
  should2.not = {};
3139
- should2.not.equal = function(val1, val2, msg) {
3140
- new Assertion(val1, msg).to.not.equal(val2);
3165
+ should2.not.equal = function(actual, expected, msg) {
3166
+ new Assertion(actual, msg).to.not.equal(expected);
3141
3167
  };
3142
3168
  should2.not.Throw = function(fn, errt, errs, msg) {
3143
3169
  new Assertion(fn, msg).to.not.Throw(errt, errs);
@@ -3248,8 +3274,8 @@ assert.isNotNull = function(val, msg) {
3248
3274
  assert.isNaN = function(val, msg) {
3249
3275
  new Assertion(val, msg, assert.isNaN, true).to.be.NaN;
3250
3276
  };
3251
- assert.isNotNaN = function(val, msg) {
3252
- new Assertion(val, msg, assert.isNotNaN, true).not.to.be.NaN;
3277
+ assert.isNotNaN = function(value, message) {
3278
+ new Assertion(value, message, assert.isNotNaN, true).not.to.be.NaN;
3253
3279
  };
3254
3280
  assert.exists = function(val, msg) {
3255
3281
  new Assertion(val, msg, assert.exists, true).to.exist;
@@ -3263,11 +3289,11 @@ assert.isUndefined = function(val, msg) {
3263
3289
  assert.isDefined = function(val, msg) {
3264
3290
  new Assertion(val, msg, assert.isDefined, true).to.not.equal(void 0);
3265
3291
  };
3266
- assert.isCallable = function(val, msg) {
3267
- new Assertion(val, msg, assert.isCallable, true).is.callable;
3292
+ assert.isCallable = function(value, message) {
3293
+ new Assertion(value, message, assert.isCallable, true).is.callable;
3268
3294
  };
3269
- assert.isNotCallable = function(val, msg) {
3270
- new Assertion(val, msg, assert.isNotCallable, true).is.not.callable;
3295
+ assert.isNotCallable = function(value, message) {
3296
+ new Assertion(value, message, assert.isNotCallable, true).is.not.callable;
3271
3297
  };
3272
3298
  assert.isObject = function(val, msg) {
3273
3299
  new Assertion(val, msg, assert.isObject, true).to.be.a("object");
@@ -3305,8 +3331,8 @@ assert.isNotBoolean = function(val, msg) {
3305
3331
  assert.typeOf = function(val, type3, msg) {
3306
3332
  new Assertion(val, msg, assert.typeOf, true).to.be.a(type3);
3307
3333
  };
3308
- assert.notTypeOf = function(val, type3, msg) {
3309
- new Assertion(val, msg, assert.notTypeOf, true).to.not.be.a(type3);
3334
+ assert.notTypeOf = function(value, type3, message) {
3335
+ new Assertion(value, message, assert.notTypeOf, true).to.not.be.a(type3);
3310
3336
  };
3311
3337
  assert.instanceOf = function(val, type3, msg) {
3312
3338
  new Assertion(val, msg, assert.instanceOf, true).to.be.instanceOf(type3);
@@ -3451,12 +3477,12 @@ assert.throws = function(fn, errorLike, errMsgMatcher, msg) {
3451
3477
  var assertErr = new Assertion(fn, msg, assert.throws, true).to.throw(errorLike, errMsgMatcher);
3452
3478
  return flag(assertErr, "object");
3453
3479
  };
3454
- assert.doesNotThrow = function(fn, errorLike, errMsgMatcher, msg) {
3480
+ assert.doesNotThrow = function(fn, errorLike, errMsgMatcher, message) {
3455
3481
  if ("string" === typeof errorLike || errorLike instanceof RegExp) {
3456
3482
  errMsgMatcher = errorLike;
3457
3483
  errorLike = null;
3458
3484
  }
3459
- new Assertion(fn, msg, assert.doesNotThrow, true).to.not.throw(errorLike, errMsgMatcher);
3485
+ new Assertion(fn, message, assert.doesNotThrow, true).to.not.throw(errorLike, errMsgMatcher);
3460
3486
  };
3461
3487
  assert.operator = function(val, operator, val2, msg) {
3462
3488
  var ok;
@@ -0,0 +1,12 @@
1
+ import jsdoc from "eslint-plugin-jsdoc";
2
+
3
+ export default [
4
+ jsdoc.configs["flat/recommended"],
5
+ {
6
+ rules: {
7
+ "jsdoc/require-param-description": "off",
8
+ "jsdoc/require-returns-description": "off",
9
+ "jsdoc/tag-lines": ["error", "any", { startLines: 1 }],
10
+ },
11
+ },
12
+ ];
@@ -18,37 +18,37 @@ import * as util from './utils/index.js';
18
18
  * be assigned during instantiation by passing arguments to this constructor:
19
19
  *
20
20
  * - `object`: This flag contains the target of the assertion. For example, in
21
- * the assertion `expect(numKittens).to.equal(7);`, the `object` flag will
22
- * contain `numKittens` so that the `equal` assertion can reference it when
23
- * needed.
21
+ * the assertion `expect(numKittens).to.equal(7);`, the `object` flag will
22
+ * contain `numKittens` so that the `equal` assertion can reference it when
23
+ * needed.
24
24
  *
25
25
  * - `message`: This flag contains an optional custom error message to be
26
- * prepended to the error message that's generated by the assertion when it
27
- * fails.
26
+ * prepended to the error message that's generated by the assertion when it
27
+ * fails.
28
28
  *
29
29
  * - `ssfi`: This flag stands for "start stack function indicator". It
30
- * contains a function reference that serves as the starting point for
31
- * removing frames from the stack trace of the error that's created by the
32
- * assertion when it fails. The goal is to provide a cleaner stack trace to
33
- * end users by removing Chai's internal functions. Note that it only works
34
- * in environments that support `Error.captureStackTrace`, and only when
35
- * `Chai.config.includeStack` hasn't been set to `false`.
30
+ * contains a function reference that serves as the starting point for
31
+ * removing frames from the stack trace of the error that's created by the
32
+ * assertion when it fails. The goal is to provide a cleaner stack trace to
33
+ * end users by removing Chai's internal functions. Note that it only works
34
+ * in environments that support `Error.captureStackTrace`, and only when
35
+ * `Chai.config.includeStack` hasn't been set to `false`.
36
36
  *
37
37
  * - `lockSsfi`: This flag controls whether or not the given `ssfi` flag
38
- * should retain its current value, even as assertions are chained off of
39
- * this object. This is usually set to `true` when creating a new assertion
40
- * from within another assertion. It's also temporarily set to `true` before
41
- * an overwritten assertion gets called by the overwriting assertion.
38
+ * should retain its current value, even as assertions are chained off of
39
+ * this object. This is usually set to `true` when creating a new assertion
40
+ * from within another assertion. It's also temporarily set to `true` before
41
+ * an overwritten assertion gets called by the overwriting assertion.
42
42
  *
43
43
  * - `eql`: This flag contains the deepEqual function to be used by the assertion.
44
44
  *
45
- * @param {Mixed} obj target of the assertion
46
- * @param {String} msg (optional) custom error message
45
+ * @param {unknown} obj target of the assertion
46
+ * @param {string} msg (optional) custom error message
47
47
  * @param {Function} ssfi (optional) starting point for removing stack frames
48
- * @param {Boolean} lockSsfi (optional) whether or not the ssfi flag is locked
49
- * @api private
48
+ * @param {boolean} lockSsfi (optional) whether or not the ssfi flag is locked
49
+ * @returns {unknown}
50
+ * @private
50
51
  */
51
-
52
52
  export function Assertion (obj, msg, ssfi, lockSsfi) {
53
53
  util.flag(this, 'ssfi', ssfi || Assertion);
54
54
  util.flag(this, 'lockSsfi', lockSsfi);
@@ -111,13 +111,13 @@ Assertion.overwriteChainableMethod = function (name, fn, chainingBehavior) {
111
111
  * Executes an expression and check expectations. Throws AssertionError for reporting if test doesn't pass.
112
112
  *
113
113
  * @name assert
114
- * @param {Philosophical} expression to be tested
115
- * @param {String|Function} message or function that returns message to display if expression fails
116
- * @param {String|Function} negatedMessage or function that returns negatedMessage to display if negated expression fails
117
- * @param {Mixed} expected value (remember to check for negation)
118
- * @param {Mixed} actual (optional) will default to `this.obj`
119
- * @param {Boolean} showDiff (optional) when set to `true`, assert will display a diff in addition to the message if expression fails
120
- * @api private
114
+ * @param {unknown} expression to be tested
115
+ * @param {string | Function} message or function that returns message to display if expression fails
116
+ * @param {string | Function} negatedMessage or function that returns negatedMessage to display if negated expression fails
117
+ * @param {unknown} expected value (remember to check for negation)
118
+ * @param {unknown} actual (optional) will default to `this.obj`
119
+ * @param {boolean} showDiff (optional) when set to `true`, assert will display a diff in addition to the message if expression fails
120
+ * @private
121
121
  */
122
122
 
123
123
  Assertion.prototype.assert = function (expr, msg, negateMsg, expected, _actual, showDiff) {
@@ -152,7 +152,7 @@ Assertion.prototype.assert = function (expr, msg, negateMsg, expected, _actual,
152
152
  *
153
153
  * Quick reference to stored `actual` value for plugin developers.
154
154
  *
155
- * @api private
155
+ * @private
156
156
  */
157
157
  Object.defineProperty(Assertion.prototype, '_obj',
158
158
  { get: function () {
@@ -9,10 +9,9 @@ export const config = {
9
9
  *
10
10
  * chai.config.includeStack = true; // enable stack on error
11
11
  *
12
- * @param {Boolean}
13
- * @api public
12
+ * @param {boolean}
13
+ * @public
14
14
  */
15
-
16
15
  includeStack: false,
17
16
 
18
17
  /**
@@ -24,10 +23,9 @@ export const config = {
24
23
  * will be true when the assertion has requested a diff
25
24
  * be shown.
26
25
  *
27
- * @param {Boolean}
28
- * @api public
26
+ * @param {boolean}
27
+ * @public
29
28
  */
30
-
31
29
  showDiff: true,
32
30
 
33
31
  /**
@@ -46,10 +44,9 @@ export const config = {
46
44
  *
47
45
  * chai.config.truncateThreshold = 0; // disable truncating
48
46
  *
49
- * @param {Number}
50
- * @api public
47
+ * @param {number}
48
+ * @public
51
49
  */
52
-
53
50
  truncateThreshold: 40,
54
51
 
55
52
  /**
@@ -66,10 +63,9 @@ export const config = {
66
63
  * This feature is automatically disabled regardless of this config value
67
64
  * in environments that don't support proxies.
68
65
  *
69
- * @param {Boolean}
70
- * @api public
66
+ * @param {boolean}
67
+ * @public
71
68
  */
72
-
73
69
  useProxy: true,
74
70
 
75
71
  /**
@@ -87,9 +83,8 @@ export const config = {
87
83
  * chai.config.proxyExcludedKeys = ['then', 'inspect'];
88
84
  *
89
85
  * @param {Array}
90
- * @api public
86
+ * @public
91
87
  */
92
-
93
88
  proxyExcludedKeys: ['then', 'catch', 'inspect', 'toJSON'],
94
89
 
95
90
  /**
@@ -101,20 +96,19 @@ export const config = {
101
96
  *
102
97
  * // use a custom comparator
103
98
  * chai.config.deepEqual = (expected, actual) => {
104
- * return chai.util.eql(expected, actual, {
105
- * comparator: (expected, actual) => {
106
- * // for non number comparison, use the default behavior
107
- * if(typeof expected !== 'number') return null;
108
- * // allow a difference of 10 between compared numbers
109
- * return typeof actual === 'number' && Math.abs(actual - expected) < 10
110
- * }
111
- * })
99
+ * return chai.util.eql(expected, actual, {
100
+ * comparator: (expected, actual) => {
101
+ * // for non number comparison, use the default behavior
102
+ * if(typeof expected !== 'number') return null;
103
+ * // allow a difference of 10 between compared numbers
104
+ * return typeof actual === 'number' && Math.abs(actual - expected) < 10
105
+ * }
106
+ * })
112
107
  * };
113
108
  *
114
109
  * @param {Function}
115
- * @api public
110
+ * @public
116
111
  */
117
-
118
112
  deepEqual: null
119
113
 
120
114
  };