chai 5.1.2 → 5.2.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/.prettierrc.json +10 -0
  2. package/README.md +1 -1
  3. package/chai.js +892 -542
  4. package/eslint.config.js +15 -0
  5. package/lib/chai/assertion.js +181 -141
  6. package/lib/chai/config.js +0 -2
  7. package/lib/chai/core/assertions.js +760 -538
  8. package/lib/chai/interface/assert.js +437 -260
  9. package/lib/chai/interface/expect.js +11 -7
  10. package/lib/chai/interface/should.js +27 -21
  11. package/lib/chai/utils/addChainableMethod.js +69 -70
  12. package/lib/chai/utils/addLengthGuard.js +18 -5
  13. package/lib/chai/utils/addMethod.js +4 -5
  14. package/lib/chai/utils/addProperty.js +27 -28
  15. package/lib/chai/utils/expectTypes.js +18 -10
  16. package/lib/chai/utils/flag.js +4 -3
  17. package/lib/chai/utils/getMessage.js +18 -12
  18. package/lib/chai/utils/getOperator.js +7 -7
  19. package/lib/chai/utils/getProperties.js +2 -2
  20. package/lib/chai/utils/index.js +8 -2
  21. package/lib/chai/utils/inspect.js +3 -3
  22. package/lib/chai/utils/isNaN.js +1 -20
  23. package/lib/chai/utils/isProxyEnabled.js +4 -2
  24. package/lib/chai/utils/objDisplay.js +7 -6
  25. package/lib/chai/utils/overwriteChainableMethod.js +15 -14
  26. package/lib/chai/utils/overwriteMethod.js +8 -9
  27. package/lib/chai/utils/overwriteProperty.js +38 -39
  28. package/lib/chai/utils/proxify.js +40 -29
  29. package/lib/chai/utils/test.js +2 -2
  30. package/lib/chai/utils/transferFlags.js +9 -4
  31. package/lib/chai/utils/type-detect.js +1 -1
  32. package/lib/chai.js +2 -1
  33. package/package.json +15 -7
  34. package/tsconfig.json +18 -0
  35. package/lib/chai/utils/getEnumerableProperties.js +0 -25
  36. package/register-assert.cjs +0 -3
  37. package/register-expect.cjs +0 -3
  38. package/register-should.cjs +0 -3
@@ -42,14 +42,18 @@ export {expect};
42
42
  */
43
43
  expect.fail = function (actual, expected, message, operator) {
44
44
  if (arguments.length < 2) {
45
- message = actual;
46
- actual = undefined;
45
+ message = actual;
46
+ actual = undefined;
47
47
  }
48
48
 
49
49
  message = message || 'expect.fail()';
50
- throw new AssertionError(message, {
51
- actual: actual
52
- , expected: expected
53
- , operator: operator
54
- }, chai.expect.fail);
50
+ throw new AssertionError(
51
+ message,
52
+ {
53
+ actual: actual,
54
+ expected: expected,
55
+ operator: operator
56
+ },
57
+ chai.expect.fail
58
+ );
55
59
  };
@@ -10,17 +10,19 @@ import {AssertionError} from 'assertion-error';
10
10
  /**
11
11
  * @returns {void}
12
12
  */
13
- function loadShould () {
13
+ function loadShould() {
14
14
  // explicitly define this method as function as to have it's name to include as `ssfi`
15
15
  /**
16
16
  * @returns {Assertion}
17
17
  */
18
18
  function shouldGetter() {
19
- if (this instanceof String
20
- || this instanceof Number
21
- || this instanceof Boolean
22
- || typeof Symbol === 'function' && this instanceof Symbol
23
- || typeof BigInt === 'function' && this instanceof BigInt) {
19
+ if (
20
+ this instanceof String ||
21
+ this instanceof Number ||
22
+ this instanceof Boolean ||
23
+ (typeof Symbol === 'function' && this instanceof Symbol) ||
24
+ (typeof BigInt === 'function' && this instanceof BigInt)
25
+ ) {
24
26
  return new Assertion(this.valueOf(), null, shouldGetter);
25
27
  }
26
28
  return new Assertion(this, null, shouldGetter);
@@ -44,12 +46,12 @@ function loadShould () {
44
46
  }
45
47
  // modify Object.prototype to have `should`
46
48
  Object.defineProperty(Object.prototype, 'should', {
47
- set: shouldSetter
48
- , get: shouldGetter
49
- , configurable: true
49
+ set: shouldSetter,
50
+ get: shouldGetter,
51
+ configurable: true
50
52
  });
51
53
 
52
- var should = {};
54
+ let should = {};
53
55
 
54
56
  /**
55
57
  * ### .fail([message])
@@ -74,16 +76,20 @@ function loadShould () {
74
76
  */
75
77
  should.fail = function (actual, expected, message, operator) {
76
78
  if (arguments.length < 2) {
77
- message = actual;
78
- actual = undefined;
79
+ message = actual;
80
+ actual = undefined;
79
81
  }
80
82
 
81
83
  message = message || 'should.fail()';
82
- throw new AssertionError(message, {
83
- actual: actual
84
- , expected: expected
85
- , operator: operator
86
- }, should.fail);
84
+ throw new AssertionError(
85
+ message,
86
+ {
87
+ actual: actual,
88
+ expected: expected,
89
+ operator: operator
90
+ },
91
+ should.fail
92
+ );
87
93
  };
88
94
 
89
95
  /**
@@ -147,10 +153,10 @@ function loadShould () {
147
153
  */
148
154
  should.exist = function (val, msg) {
149
155
  new Assertion(val, msg).to.exist;
150
- }
156
+ };
151
157
 
152
158
  // negation
153
- should.not = {}
159
+ should.not = {};
154
160
 
155
161
  /**
156
162
  * ### .not.equal(actual, expected, [message])
@@ -209,13 +215,13 @@ function loadShould () {
209
215
  */
210
216
  should.not.exist = function (val, msg) {
211
217
  new Assertion(val, msg).to.not.exist;
212
- }
218
+ };
213
219
 
214
220
  should['throw'] = should['Throw'];
215
221
  should.not['throw'] = should.not['Throw'];
216
222
 
217
223
  return should;
218
- };
224
+ }
219
225
 
220
226
  export const should = loadShould;
221
227
  export const Should = loadShould;
@@ -15,27 +15,26 @@ import {transferFlags} from './transferFlags.js';
15
15
  */
16
16
 
17
17
  // Check whether `Object.setPrototypeOf` is supported
18
- var canSetPrototype = typeof Object.setPrototypeOf === 'function';
18
+ let canSetPrototype = typeof Object.setPrototypeOf === 'function';
19
19
 
20
20
  // Without `Object.setPrototypeOf` support, this module will need to add properties to a function.
21
21
  // However, some of functions' own props are not configurable and should be skipped.
22
- var testFn = function() {};
23
- var excludeNames = Object.getOwnPropertyNames(testFn).filter(function(name) {
24
- var propDesc = Object.getOwnPropertyDescriptor(testFn, name);
22
+ let testFn = function () {};
23
+ let excludeNames = Object.getOwnPropertyNames(testFn).filter(function (name) {
24
+ let propDesc = Object.getOwnPropertyDescriptor(testFn, name);
25
25
 
26
26
  // Note: PhantomJS 1.x includes `callee` as one of `testFn`'s own properties,
27
27
  // but then returns `undefined` as the property descriptor for `callee`. As a
28
28
  // workaround, we perform an otherwise unnecessary type-check for `propDesc`,
29
29
  // and then filter it out if it's not an object as it should be.
30
- if (typeof propDesc !== 'object')
31
- return true;
30
+ if (typeof propDesc !== 'object') return true;
32
31
 
33
32
  return !propDesc.configurable;
34
33
  });
35
34
 
36
35
  // Cache `Function` properties
37
- var call = Function.prototype.call,
38
- apply = Function.prototype.apply;
36
+ let call = Function.prototype.call,
37
+ apply = Function.prototype.apply;
39
38
 
40
39
  /**
41
40
  * ### .addChainableMethod(ctx, name, method, chainingBehavior)
@@ -67,12 +66,12 @@ var call = Function.prototype.call,
67
66
  */
68
67
  export function addChainableMethod(ctx, name, method, chainingBehavior) {
69
68
  if (typeof chainingBehavior !== 'function') {
70
- chainingBehavior = function () { };
69
+ chainingBehavior = function () {};
71
70
  }
72
71
 
73
- var chainableBehavior = {
74
- method: method
75
- , chainingBehavior: chainingBehavior
72
+ let chainableBehavior = {
73
+ method: method,
74
+ chainingBehavior: chainingBehavior
76
75
  };
77
76
 
78
77
  // save the methods so we can overwrite them later, if we need to.
@@ -81,67 +80,67 @@ export function addChainableMethod(ctx, name, method, chainingBehavior) {
81
80
  }
82
81
  ctx.__methods[name] = chainableBehavior;
83
82
 
84
- Object.defineProperty(ctx, name,
85
- { get: function chainableMethodGetter() {
86
- chainableBehavior.chainingBehavior.call(this);
87
-
88
- var chainableMethodWrapper = function () {
89
- // Setting the `ssfi` flag to `chainableMethodWrapper` causes this
90
- // function to be the starting point for removing implementation
91
- // frames from the stack trace of a failed assertion.
92
- //
93
- // However, we only want to use this function as the starting point if
94
- // the `lockSsfi` flag isn't set.
95
- //
96
- // If the `lockSsfi` flag is set, then this assertion is being
97
- // invoked from inside of another assertion. In this case, the `ssfi`
98
- // flag has already been set by the outer assertion.
99
- //
100
- // Note that overwriting a chainable method merely replaces the saved
101
- // methods in `ctx.__methods` instead of completely replacing the
102
- // overwritten assertion. Therefore, an overwriting assertion won't
103
- // set the `ssfi` or `lockSsfi` flags.
104
- if (!flag(this, 'lockSsfi')) {
105
- flag(this, 'ssfi', chainableMethodWrapper);
106
- }
107
-
108
- var result = chainableBehavior.method.apply(this, arguments);
109
- if (result !== undefined) {
110
- return result;
111
- }
112
-
113
- var newAssertion = new Assertion();
114
- transferFlags(this, newAssertion);
115
- return newAssertion;
116
- };
117
-
118
- addLengthGuard(chainableMethodWrapper, name, true);
119
-
120
- // Use `Object.setPrototypeOf` if available
121
- if (canSetPrototype) {
122
- // Inherit all properties from the object by replacing the `Function` prototype
123
- var prototype = Object.create(this);
124
- // Restore the `call` and `apply` methods from `Function`
125
- prototype.call = call;
126
- prototype.apply = apply;
127
- Object.setPrototypeOf(chainableMethodWrapper, prototype);
83
+ Object.defineProperty(ctx, name, {
84
+ get: function chainableMethodGetter() {
85
+ chainableBehavior.chainingBehavior.call(this);
86
+
87
+ let chainableMethodWrapper = function () {
88
+ // Setting the `ssfi` flag to `chainableMethodWrapper` causes this
89
+ // function to be the starting point for removing implementation
90
+ // frames from the stack trace of a failed assertion.
91
+ //
92
+ // However, we only want to use this function as the starting point if
93
+ // the `lockSsfi` flag isn't set.
94
+ //
95
+ // If the `lockSsfi` flag is set, then this assertion is being
96
+ // invoked from inside of another assertion. In this case, the `ssfi`
97
+ // flag has already been set by the outer assertion.
98
+ //
99
+ // Note that overwriting a chainable method merely replaces the saved
100
+ // methods in `ctx.__methods` instead of completely replacing the
101
+ // overwritten assertion. Therefore, an overwriting assertion won't
102
+ // set the `ssfi` or `lockSsfi` flags.
103
+ if (!flag(this, 'lockSsfi')) {
104
+ flag(this, 'ssfi', chainableMethodWrapper);
128
105
  }
129
- // Otherwise, redefine all properties (slow!)
130
- else {
131
- var asserterNames = Object.getOwnPropertyNames(ctx);
132
- asserterNames.forEach(function (asserterName) {
133
- if (excludeNames.indexOf(asserterName) !== -1) {
134
- return;
135
- }
136
-
137
- var pd = Object.getOwnPropertyDescriptor(ctx, asserterName);
138
- Object.defineProperty(chainableMethodWrapper, asserterName, pd);
139
- });
106
+
107
+ let result = chainableBehavior.method.apply(this, arguments);
108
+ if (result !== undefined) {
109
+ return result;
140
110
  }
141
111
 
142
- transferFlags(this, chainableMethodWrapper);
143
- return proxify(chainableMethodWrapper);
112
+ let newAssertion = new Assertion();
113
+ transferFlags(this, newAssertion);
114
+ return newAssertion;
115
+ };
116
+
117
+ addLengthGuard(chainableMethodWrapper, name, true);
118
+
119
+ // Use `Object.setPrototypeOf` if available
120
+ if (canSetPrototype) {
121
+ // Inherit all properties from the object by replacing the `Function` prototype
122
+ let prototype = Object.create(this);
123
+ // Restore the `call` and `apply` methods from `Function`
124
+ prototype.call = call;
125
+ prototype.apply = apply;
126
+ Object.setPrototypeOf(chainableMethodWrapper, prototype);
144
127
  }
145
- , configurable: true
128
+ // Otherwise, redefine all properties (slow!)
129
+ else {
130
+ let asserterNames = Object.getOwnPropertyNames(ctx);
131
+ asserterNames.forEach(function (asserterName) {
132
+ if (excludeNames.indexOf(asserterName) !== -1) {
133
+ return;
134
+ }
135
+
136
+ let pd = Object.getOwnPropertyDescriptor(ctx, asserterName);
137
+ Object.defineProperty(chainableMethodWrapper, asserterName, pd);
138
+ });
139
+ }
140
+
141
+ transferFlags(this, chainableMethodWrapper);
142
+ return proxify(chainableMethodWrapper);
143
+ },
144
+ configurable: true
146
145
  });
147
146
  }
@@ -46,13 +46,26 @@ export function addLengthGuard(fn, assertionName, isChainable) {
46
46
  Object.defineProperty(fn, 'length', {
47
47
  get: function () {
48
48
  if (isChainable) {
49
- throw Error('Invalid Chai property: ' + assertionName + '.length. Due' +
50
- ' to a compatibility issue, "length" cannot directly follow "' +
51
- assertionName + '". Use "' + assertionName + '.lengthOf" instead.');
49
+ throw Error(
50
+ 'Invalid Chai property: ' +
51
+ assertionName +
52
+ '.length. Due' +
53
+ ' to a compatibility issue, "length" cannot directly follow "' +
54
+ assertionName +
55
+ '". Use "' +
56
+ assertionName +
57
+ '.lengthOf" instead.'
58
+ );
52
59
  }
53
60
 
54
- throw Error('Invalid Chai property: ' + assertionName + '.length. See' +
55
- ' docs for proper usage of "' + assertionName + '".');
61
+ throw Error(
62
+ 'Invalid Chai property: ' +
63
+ assertionName +
64
+ '.length. See' +
65
+ ' docs for proper usage of "' +
66
+ assertionName +
67
+ '".'
68
+ );
56
69
  }
57
70
  });
58
71
 
@@ -36,7 +36,7 @@ import {Assertion} from '../assertion.js';
36
36
  * @public
37
37
  */
38
38
  export function addMethod(ctx, name, method) {
39
- var methodWrapper = function () {
39
+ let methodWrapper = function () {
40
40
  // Setting the `ssfi` flag to `methodWrapper` causes this function to be the
41
41
  // starting point for removing implementation frames from the stack trace of
42
42
  // a failed assertion.
@@ -53,11 +53,10 @@ export function addMethod(ctx, name, method) {
53
53
  flag(this, 'ssfi', methodWrapper);
54
54
  }
55
55
 
56
- var result = method.apply(this, arguments);
57
- if (result !== undefined)
58
- return result;
56
+ let result = method.apply(this, arguments);
57
+ if (result !== undefined) return result;
59
58
 
60
- var newAssertion = new Assertion();
59
+ let newAssertion = new Assertion();
61
60
  transferFlags(this, newAssertion);
62
61
  return newAssertion;
63
62
  };
@@ -37,35 +37,34 @@ import {transferFlags} from './transferFlags.js';
37
37
  export function addProperty(ctx, name, getter) {
38
38
  getter = getter === undefined ? function () {} : getter;
39
39
 
40
- Object.defineProperty(ctx, name,
41
- { get: function propertyGetter() {
42
- // Setting the `ssfi` flag to `propertyGetter` causes this function to
43
- // be the starting point for removing implementation frames from the
44
- // stack trace of a failed assertion.
45
- //
46
- // However, we only want to use this function as the starting point if
47
- // the `lockSsfi` flag isn't set and proxy protection is disabled.
48
- //
49
- // If the `lockSsfi` flag is set, then either this assertion has been
50
- // overwritten by another assertion, or this assertion is being invoked
51
- // from inside of another assertion. In the first case, the `ssfi` flag
52
- // has already been set by the overwriting assertion. In the second
53
- // case, the `ssfi` flag has already been set by the outer assertion.
54
- //
55
- // If proxy protection is enabled, then the `ssfi` flag has already been
56
- // set by the proxy getter.
57
- if (!isProxyEnabled() && !flag(this, 'lockSsfi')) {
58
- flag(this, 'ssfi', propertyGetter);
59
- }
40
+ Object.defineProperty(ctx, name, {
41
+ get: function propertyGetter() {
42
+ // Setting the `ssfi` flag to `propertyGetter` causes this function to
43
+ // be the starting point for removing implementation frames from the
44
+ // stack trace of a failed assertion.
45
+ //
46
+ // However, we only want to use this function as the starting point if
47
+ // the `lockSsfi` flag isn't set and proxy protection is disabled.
48
+ //
49
+ // If the `lockSsfi` flag is set, then either this assertion has been
50
+ // overwritten by another assertion, or this assertion is being invoked
51
+ // from inside of another assertion. In the first case, the `ssfi` flag
52
+ // has already been set by the overwriting assertion. In the second
53
+ // case, the `ssfi` flag has already been set by the outer assertion.
54
+ //
55
+ // If proxy protection is enabled, then the `ssfi` flag has already been
56
+ // set by the proxy getter.
57
+ if (!isProxyEnabled() && !flag(this, 'lockSsfi')) {
58
+ flag(this, 'ssfi', propertyGetter);
59
+ }
60
60
 
61
- var result = getter.call(this);
62
- if (result !== undefined)
63
- return result;
61
+ let result = getter.call(this);
62
+ if (result !== undefined) return result;
64
63
 
65
- var newAssertion = new Assertion();
66
- transferFlags(this, newAssertion);
67
- return newAssertion;
68
- }
69
- , configurable: true
64
+ let newAssertion = new Assertion();
65
+ transferFlags(this, newAssertion);
66
+ return newAssertion;
67
+ },
68
+ configurable: true
70
69
  });
71
70
  }
@@ -22,25 +22,33 @@ import {type} from './type-detect.js';
22
22
  * @public
23
23
  */
24
24
  export function expectTypes(obj, types) {
25
- var flagMsg = flag(obj, 'message');
26
- var ssfi = flag(obj, 'ssfi');
25
+ let flagMsg = flag(obj, 'message');
26
+ let ssfi = flag(obj, 'ssfi');
27
27
 
28
28
  flagMsg = flagMsg ? flagMsg + ': ' : '';
29
29
 
30
30
  obj = flag(obj, 'object');
31
- types = types.map(function (t) { return t.toLowerCase(); });
31
+ types = types.map(function (t) {
32
+ return t.toLowerCase();
33
+ });
32
34
  types.sort();
33
35
 
34
36
  // Transforms ['lorem', 'ipsum'] into 'a lorem, or an ipsum'
35
- var str = types.map(function (t, index) {
36
- var art = ~[ 'a', 'e', 'i', 'o', 'u' ].indexOf(t.charAt(0)) ? 'an' : 'a';
37
- var or = types.length > 1 && index === types.length - 1 ? 'or ' : '';
38
- return or + art + ' ' + t;
39
- }).join(', ');
37
+ let str = types
38
+ .map(function (t, index) {
39
+ let art = ~['a', 'e', 'i', 'o', 'u'].indexOf(t.charAt(0)) ? 'an' : 'a';
40
+ let or = types.length > 1 && index === types.length - 1 ? 'or ' : '';
41
+ return or + art + ' ' + t;
42
+ })
43
+ .join(', ');
40
44
 
41
- var objType = type(obj).toLowerCase();
45
+ let objType = type(obj).toLowerCase();
42
46
 
43
- if (!types.some(function (expected) { return objType === expected; })) {
47
+ if (
48
+ !types.some(function (expected) {
49
+ return objType === expected;
50
+ })
51
+ ) {
44
52
  throw new AssertionError(
45
53
  flagMsg + 'object tested must be ' + str + ', but ' + objType + ' given',
46
54
  undefined,
@@ -15,16 +15,17 @@
15
15
  * utils.flag(this, 'foo', 'bar'); // setter
16
16
  * utils.flag(this, 'foo'); // getter, returns `bar`
17
17
  *
18
- * @param {object} obj object constructed Assertion
18
+ * @template {{__flags?: {[key: PropertyKey]: unknown}}} T
19
+ * @param {T} obj object constructed Assertion
19
20
  * @param {string} key
20
- * @param {unknown} value (optional)
21
+ * @param {unknown} [value]
21
22
  * @namespace Utils
22
23
  * @name flag
23
24
  * @returns {unknown | undefined}
24
25
  * @private
25
26
  */
26
27
  export function flag(obj, key, value) {
27
- var flags = obj.__flags || (obj.__flags = Object.create(null));
28
+ let flags = obj.__flags || (obj.__flags = Object.create(null));
28
29
  if (arguments.length === 3) {
29
30
  flags[key] = value;
30
31
  } else {
@@ -21,26 +21,32 @@ import {objDisplay} from './objDisplay.js';
21
21
  * - `#{exp}` expected value
22
22
  *
23
23
  * @param {object} obj object (constructed Assertion)
24
- * @param {unknown} args chai.Assertion.prototype.assert arguments
25
- * @returns {unknown}
24
+ * @param {IArguments} args chai.Assertion.prototype.assert arguments
25
+ * @returns {string}
26
26
  * @namespace Utils
27
27
  * @name getMessage
28
28
  * @public
29
29
  */
30
30
  export function getMessage(obj, args) {
31
- var negate = flag(obj, 'negate')
32
- , val = flag(obj, 'object')
33
- , expected = args[3]
34
- , actual = getActual(obj, args)
35
- , msg = negate ? args[2] : args[1]
36
- , flagMsg = flag(obj, 'message');
31
+ let negate = flag(obj, 'negate');
32
+ let val = flag(obj, 'object');
33
+ let expected = args[3];
34
+ let actual = getActual(obj, args);
35
+ let msg = negate ? args[2] : args[1];
36
+ let flagMsg = flag(obj, 'message');
37
37
 
38
- if(typeof msg === "function") msg = msg();
38
+ if (typeof msg === 'function') msg = msg();
39
39
  msg = msg || '';
40
40
  msg = msg
41
- .replace(/#\{this\}/g, function () { return objDisplay(val); })
42
- .replace(/#\{act\}/g, function () { return objDisplay(actual); })
43
- .replace(/#\{exp\}/g, function () { return objDisplay(expected); });
41
+ .replace(/#\{this\}/g, function () {
42
+ return objDisplay(val);
43
+ })
44
+ .replace(/#\{act\}/g, function () {
45
+ return objDisplay(actual);
46
+ })
47
+ .replace(/#\{exp\}/g, function () {
48
+ return objDisplay(expected);
49
+ });
44
50
 
45
51
  return flagMsg ? flagMsg + ': ' + msg : msg;
46
52
  }
@@ -6,8 +6,8 @@ import {type} from './type-detect.js';
6
6
  * @returns {boolean}
7
7
  */
8
8
  function isObjectType(obj) {
9
- var objectType = type(obj);
10
- var objectTypes = ['Array', 'Object', 'Function'];
9
+ let objectType = type(obj);
10
+ let objectTypes = ['Array', 'Object', 'Function'];
11
11
 
12
12
  return objectTypes.indexOf(objectType) !== -1;
13
13
  }
@@ -29,10 +29,10 @@ function isObjectType(obj) {
29
29
  * @public
30
30
  */
31
31
  export function getOperator(obj, args) {
32
- var operator = flag(obj, 'operator');
33
- var negate = flag(obj, 'negate');
34
- var expected = args[3];
35
- var msg = negate ? args[2] : args[1];
32
+ let operator = flag(obj, 'operator');
33
+ let negate = flag(obj, 'negate');
34
+ let expected = args[3];
35
+ let msg = negate ? args[2] : args[1];
36
36
 
37
37
  if (operator) {
38
38
  return operator;
@@ -49,7 +49,7 @@ export function getOperator(obj, args) {
49
49
  return undefined;
50
50
  }
51
51
 
52
- var isObject = isObjectType(expected);
52
+ let isObject = isObjectType(expected);
53
53
  if (/\snot\s/.test(msg)) {
54
54
  return isObject ? 'notDeepStrictEqual' : 'notStrictEqual';
55
55
  }
@@ -17,7 +17,7 @@
17
17
  * @public
18
18
  */
19
19
  export function getProperties(object) {
20
- var result = Object.getOwnPropertyNames(object);
20
+ let result = Object.getOwnPropertyNames(object);
21
21
 
22
22
  /**
23
23
  * @param {unknown} property
@@ -28,7 +28,7 @@ export function getProperties(object) {
28
28
  }
29
29
  }
30
30
 
31
- var proto = Object.getPrototypeOf(object);
31
+ let proto = Object.getPrototypeOf(object);
32
32
  while (proto !== null) {
33
33
  Object.getOwnPropertyNames(proto).forEach(addProperty);
34
34
  proto = Object.getPrototypeOf(proto);
@@ -48,7 +48,7 @@ export {getPathInfo, hasProperty} from 'pathval';
48
48
  * @returns {string}
49
49
  */
50
50
  export function getName(fn) {
51
- return fn.name
51
+ return fn.name;
52
52
  }
53
53
 
54
54
  // add Property
@@ -107,6 +107,12 @@ export function isRegExp(obj) {
107
107
  return Object.prototype.toString.call(obj) === '[object RegExp]';
108
108
  }
109
109
 
110
+ /**
111
+ * Determines if an object is numeric or not
112
+ *
113
+ * @param {unknown} obj Object to test
114
+ * @returns {boolean}
115
+ */
110
116
  export function isNumeric(obj) {
111
- return ['Number', 'BigInt'].includes(type(obj))
117
+ return ['Number', 'BigInt'].includes(type(obj));
112
118
  }
@@ -21,11 +21,11 @@ import {config} from '../config.js';
21
21
  * @name inspect
22
22
  */
23
23
  export function inspect(obj, showHidden, depth, colors) {
24
- var options = {
24
+ let options = {
25
25
  colors: colors,
26
- depth: (typeof depth === 'undefined' ? 2 : depth),
26
+ depth: typeof depth === 'undefined' ? 2 : depth,
27
27
  showHidden: showHidden,
28
- truncate: config.truncateThreshold ? config.truncateThreshold : Infinity,
28
+ truncate: config.truncateThreshold ? config.truncateThreshold : Infinity
29
29
  };
30
30
  return _inspect(obj, options);
31
31
  }
@@ -4,23 +4,4 @@
4
4
  * MIT Licensed
5
5
  */
6
6
 
7
- /**
8
- * ### .isNaN(value)
9
- *
10
- * Checks if the given value is NaN or not.
11
- *
12
- * utils.isNaN(NaN); // true
13
- *
14
- * @param {unknown} value The value which has to be checked if it is NaN
15
- * @returns {boolean}
16
- * @name isNaN
17
- * @private
18
- */
19
- function _isNaN(value) {
20
- // Refer http://www.ecma-international.org/ecma-262/6.0/#sec-isnan-number
21
- // section's NOTE.
22
- return value !== value;
23
- }
24
-
25
- // If ECMAScript 6's Number.isNaN is present, prefer that.
26
- export const isNaN = Number.isNaN || _isNaN;
7
+ export const isNaN = Number.isNaN;