chai 5.1.0 → 5.1.2

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 +138 -79
  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 +252 -255
  7. package/lib/chai/interface/assert.js +438 -390
  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 +23 -2
  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
@@ -8,6 +8,11 @@ import * as chai from '../../../index.js';
8
8
  import {Assertion} from '../assertion.js';
9
9
  import {AssertionError} from 'assertion-error';
10
10
 
11
+ /**
12
+ * @param {unknown} val
13
+ * @param {string} message
14
+ * @returns {Assertion}
15
+ */
11
16
  function expect(val, message) {
12
17
  return new Assertion(val, message);
13
18
  }
@@ -30,8 +35,8 @@ export {expect};
30
35
  * @name fail
31
36
  * @param {unknown} actual
32
37
  * @param {unknown} expected
33
- * @param {String} message
34
- * @param {String} operator
38
+ * @param {string} message
39
+ * @param {string} operator
35
40
  * @namespace expect
36
41
  * @public
37
42
  */
@@ -7,8 +7,14 @@
7
7
  import {Assertion} from '../assertion.js';
8
8
  import {AssertionError} from 'assertion-error';
9
9
 
10
+ /**
11
+ * @returns {void}
12
+ */
10
13
  function loadShould () {
11
14
  // explicitly define this method as function as to have it's name to include as `ssfi`
15
+ /**
16
+ * @returns {Assertion}
17
+ */
12
18
  function shouldGetter() {
13
19
  if (this instanceof String
14
20
  || this instanceof Number
@@ -19,6 +25,9 @@ function loadShould () {
19
25
  }
20
26
  return new Assertion(this, null, shouldGetter);
21
27
  }
28
+ /**
29
+ * @param {unknown} value
30
+ */
22
31
  function shouldSetter(value) {
23
32
  // See https://github.com/chaijs/chai/issues/86: this makes
24
33
  // `whatever.should = someValue` actually set `someValue`, which is
@@ -55,12 +64,11 @@ function loadShould () {
55
64
  * should.fail(1, 2, "custom error message", ">");
56
65
  * should.fail(1, 2, undefined, ">");
57
66
  *
58
- *
59
67
  * @name fail
60
68
  * @param {unknown} actual
61
69
  * @param {unknown} expected
62
- * @param {String} message
63
- * @param {String} operator
70
+ * @param {string} message
71
+ * @param {string} operator
64
72
  * @namespace BDD
65
73
  * @public
66
74
  */
@@ -88,12 +96,12 @@ function loadShould () {
88
96
  * @name equal
89
97
  * @param {unknown} actual
90
98
  * @param {unknown} expected
91
- * @param {String} message
99
+ * @param {string} message
92
100
  * @namespace Should
93
101
  * @public
94
102
  */
95
- should.equal = function (val1, val2, msg) {
96
- new Assertion(val1, msg).to.equal(val2);
103
+ should.equal = function (actual, expected, message) {
104
+ new Assertion(actual, message).to.equal(expected);
97
105
  };
98
106
 
99
107
  /**
@@ -111,10 +119,10 @@ function loadShould () {
111
119
  *
112
120
  * @name throw
113
121
  * @alias Throw
114
- * @param {Function} function
115
- * @param {ErrorConstructor} constructor
116
- * @param {RegExp} regexp
117
- * @param {String} message
122
+ * @param {Function} fn
123
+ * @param {Error} errt
124
+ * @param {RegExp} errs
125
+ * @param {string} msg
118
126
  * @see https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Error#Error_types
119
127
  * @namespace Should
120
128
  * @public
@@ -129,9 +137,10 @@ function loadShould () {
129
137
  * Asserts that the target is neither `null` nor `undefined`.
130
138
  *
131
139
  * var foo = 'hi';
132
- *
133
140
  * should.exist(foo, 'foo exists');
134
141
  *
142
+ * @param {unknown} val
143
+ * @param {string} msg
135
144
  * @name exist
136
145
  * @namespace Should
137
146
  * @public
@@ -153,12 +162,12 @@ function loadShould () {
153
162
  * @name not.equal
154
163
  * @param {unknown} actual
155
164
  * @param {unknown} expected
156
- * @param {String} message
165
+ * @param {string} msg
157
166
  * @namespace Should
158
167
  * @public
159
168
  */
160
- should.not.equal = function (val1, val2, msg) {
161
- new Assertion(val1, msg).to.not.equal(val2);
169
+ should.not.equal = function (actual, expected, msg) {
170
+ new Assertion(actual, msg).to.not.equal(expected);
162
171
  };
163
172
 
164
173
  /**
@@ -172,10 +181,10 @@ function loadShould () {
172
181
  *
173
182
  * @name not.throw
174
183
  * @alias not.Throw
175
- * @param {Function} function
176
- * @param {ErrorConstructor} constructor
177
- * @param {RegExp} regexp
178
- * @param {String} message
184
+ * @param {Function} fn
185
+ * @param {Error} errt
186
+ * @param {RegExp} errs
187
+ * @param {string} msg
179
188
  * @see https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Error#Error_types
180
189
  * @namespace Should
181
190
  * @public
@@ -190,11 +199,12 @@ function loadShould () {
190
199
  * Asserts that the target is neither `null` nor `undefined`.
191
200
  *
192
201
  * var bar = null;
193
- *
194
202
  * should.not.exist(bar, 'bar does not exist');
195
203
  *
196
- * @name not.exist
197
204
  * @namespace Should
205
+ * @name not.exist
206
+ * @param {unknown} val
207
+ * @param {string} msg
198
208
  * @public
199
209
  */
200
210
  should.not.exist = function (val, msg) {
@@ -43,8 +43,8 @@ var call = Function.prototype.call,
43
43
  * Adds a method to an object, such that the method can also be chained.
44
44
  *
45
45
  * utils.addChainableMethod(chai.Assertion.prototype, 'foo', function (str) {
46
- * var obj = utils.flag(this, 'object');
47
- * new chai.Assertion(obj).to.be.equal(str);
46
+ * var obj = utils.flag(this, 'object');
47
+ * new chai.Assertion(obj).to.be.equal(str);
48
48
  * });
49
49
  *
50
50
  * Can also be accessed directly from `chai.Assertion`.
@@ -57,15 +57,14 @@ var call = Function.prototype.call,
57
57
  * expect(fooStr).to.be.foo('bar');
58
58
  * expect(fooStr).to.be.foo.equal('foo');
59
59
  *
60
- * @param {Object} ctx object to which the method is added
61
- * @param {String} name of method to add
60
+ * @param {object} ctx object to which the method is added
61
+ * @param {string} name of method to add
62
62
  * @param {Function} method function to be used for `name`, when called
63
63
  * @param {Function} chainingBehavior function to be called every time the property is accessed
64
64
  * @namespace Utils
65
65
  * @name addChainableMethod
66
- * @api public
66
+ * @public
67
67
  */
68
-
69
68
  export function addChainableMethod(ctx, name, method, chainingBehavior) {
70
69
  if (typeof chainingBehavior !== 'function') {
71
70
  chainingBehavior = function () { };
@@ -34,12 +34,12 @@ const fnLengthDesc = Object.getOwnPropertyDescriptor(function () {}, 'length');
34
34
  * environments is the priority.
35
35
  *
36
36
  * @param {Function} fn
37
- * @param {String} assertionName
38
- * @param {Boolean} isChainable
37
+ * @param {string} assertionName
38
+ * @param {boolean} isChainable
39
+ * @returns {unknown}
39
40
  * @namespace Utils
40
41
  * @name addLengthGuard
41
42
  */
42
-
43
43
  export function addLengthGuard(fn, assertionName, isChainable) {
44
44
  if (!fnLengthDesc.configurable) return fn;
45
45
 
@@ -16,8 +16,8 @@ import {Assertion} from '../assertion.js';
16
16
  * Adds a method to the prototype of an object.
17
17
  *
18
18
  * utils.addMethod(chai.Assertion.prototype, 'foo', function (str) {
19
- * var obj = utils.flag(this, 'object');
20
- * new chai.Assertion(obj).to.be.equal(str);
19
+ * var obj = utils.flag(this, 'object');
20
+ * new chai.Assertion(obj).to.be.equal(str);
21
21
  * });
22
22
  *
23
23
  * Can also be accessed directly from `chai.Assertion`.
@@ -28,14 +28,13 @@ import {Assertion} from '../assertion.js';
28
28
  *
29
29
  * expect(fooStr).to.be.foo('bar');
30
30
  *
31
- * @param {Object} ctx object to which the method is added
32
- * @param {String} name of method to add
31
+ * @param {object} ctx object to which the method is added
32
+ * @param {string} name of method to add
33
33
  * @param {Function} method function to be used for name
34
34
  * @namespace Utils
35
35
  * @name addMethod
36
- * @api public
36
+ * @public
37
37
  */
38
-
39
38
  export function addMethod(ctx, name, method) {
40
39
  var methodWrapper = function () {
41
40
  // Setting the `ssfi` flag to `methodWrapper` causes this function to be the
@@ -15,8 +15,8 @@ import {transferFlags} from './transferFlags.js';
15
15
  * Adds a property to the prototype of an object.
16
16
  *
17
17
  * utils.addProperty(chai.Assertion.prototype, 'foo', function () {
18
- * var obj = utils.flag(this, 'object');
19
- * new chai.Assertion(obj).to.be.instanceof(Foo);
18
+ * var obj = utils.flag(this, 'object');
19
+ * new chai.Assertion(obj).to.be.instanceof(Foo);
20
20
  * });
21
21
  *
22
22
  * Can also be accessed directly from `chai.Assertion`.
@@ -27,14 +27,13 @@ import {transferFlags} from './transferFlags.js';
27
27
  *
28
28
  * expect(myFoo).to.be.foo;
29
29
  *
30
- * @param {Object} ctx object to which the property is added
31
- * @param {String} name of property to add
30
+ * @param {object} ctx object to which the property is added
31
+ * @param {string} name of property to add
32
32
  * @param {Function} getter function to be used for name
33
33
  * @namespace Utils
34
34
  * @name addProperty
35
- * @api public
35
+ * @public
36
36
  */
37
-
38
37
  export function addProperty(ctx, name, getter) {
39
38
  getter = getter === undefined ? function () {} : getter;
40
39
 
@@ -14,14 +14,13 @@ import {inspect} from './inspect.js';
14
14
  * and objects with irregular/missing toString can still be sorted without a
15
15
  * TypeError.
16
16
  *
17
- * @param {Mixed} first element to compare
18
- * @param {Mixed} second element to compare
19
- * @returns {Number} -1 if 'a' should come before 'b'; otherwise 1
17
+ * @param {unknown} a first element to compare
18
+ * @param {unknown} b second element to compare
19
+ * @returns {number} -1 if 'a' should come before 'b'; otherwise 1
20
20
  * @name compareByInspect
21
21
  * @namespace Utils
22
- * @api public
22
+ * @public
23
23
  */
24
-
25
24
  export function compareByInspect(a, b) {
26
25
  return inspect(a) < inspect(b) ? -1 : 1;
27
26
  }
@@ -4,6 +4,10 @@
4
4
  * MIT Licensed
5
5
  */
6
6
 
7
+ import {AssertionError} from 'assertion-error';
8
+ import {flag} from './flag.js';
9
+ import {type} from './type-detect.js';
10
+
7
11
  /**
8
12
  * ### .expectTypes(obj, types)
9
13
  *
@@ -11,17 +15,12 @@
11
15
  *
12
16
  * utils.expectTypes(this, ['array', 'object', 'string']);
13
17
  *
14
- * @param {Mixed} obj constructed Assertion
15
- * @param {Array} type A list of allowed types for this assertion
18
+ * @param {unknown} obj constructed Assertion
19
+ * @param {Array} types A list of allowed types for this assertion
16
20
  * @namespace Utils
17
21
  * @name expectTypes
18
- * @api public
22
+ * @public
19
23
  */
20
-
21
- import {AssertionError} from 'assertion-error';
22
- import {flag} from './flag.js';
23
- import {type} from './type-detect.js';
24
-
25
24
  export function expectTypes(obj, types) {
26
25
  var flagMsg = flag(obj, 'message');
27
26
  var ssfi = flag(obj, 'ssfi');
@@ -15,14 +15,14 @@
15
15
  * utils.flag(this, 'foo', 'bar'); // setter
16
16
  * utils.flag(this, 'foo'); // getter, returns `bar`
17
17
  *
18
- * @param {Object} object constructed Assertion
19
- * @param {String} key
20
- * @param {Mixed} value (optional)
18
+ * @param {object} obj object constructed Assertion
19
+ * @param {string} key
20
+ * @param {unknown} value (optional)
21
21
  * @namespace Utils
22
22
  * @name flag
23
- * @api private
23
+ * @returns {unknown | undefined}
24
+ * @private
24
25
  */
25
-
26
26
  export function flag(obj, key, value) {
27
27
  var flags = obj.__flags || (obj.__flags = Object.create(null));
28
28
  if (arguments.length === 3) {
@@ -9,12 +9,12 @@
9
9
  *
10
10
  * Returns the `actual` value for an Assertion.
11
11
  *
12
- * @param {Object} object (constructed Assertion)
13
- * @param {Arguments} chai.Assertion.prototype.assert arguments
12
+ * @param {object} obj object (constructed Assertion)
13
+ * @param {unknown} args chai.Assertion.prototype.assert arguments
14
+ * @returns {unknown}
14
15
  * @namespace Utils
15
16
  * @name getActual
16
17
  */
17
-
18
18
  export function getActual(obj, args) {
19
19
  return args.length > 4 ? args[4] : obj._obj;
20
20
  }
@@ -10,13 +10,12 @@
10
10
  * This allows the retrieval of enumerable property names of an object,
11
11
  * inherited or not.
12
12
  *
13
- * @param {Object} object
13
+ * @param {object} object
14
14
  * @returns {Array}
15
15
  * @namespace Utils
16
16
  * @name getEnumerableProperties
17
- * @api public
17
+ * @public
18
18
  */
19
-
20
19
  module.exports = function getEnumerableProperties(object) {
21
20
  var result = [];
22
21
  for (var name in object) {
@@ -20,13 +20,13 @@ import {objDisplay} from './objDisplay.js';
20
20
  * - `#{act}` actual value
21
21
  * - `#{exp}` expected value
22
22
  *
23
- * @param {Object} object (constructed Assertion)
24
- * @param {Arguments} chai.Assertion.prototype.assert arguments
23
+ * @param {object} obj object (constructed Assertion)
24
+ * @param {unknown} args chai.Assertion.prototype.assert arguments
25
+ * @returns {unknown}
25
26
  * @namespace Utils
26
27
  * @name getMessage
27
- * @api public
28
+ * @public
28
29
  */
29
-
30
30
  export function getMessage(obj, args) {
31
31
  var negate = flag(obj, 'negate')
32
32
  , val = flag(obj, 'object')
@@ -1,6 +1,10 @@
1
1
  import {flag} from './flag.js';
2
2
  import {type} from './type-detect.js';
3
3
 
4
+ /**
5
+ * @param {unknown} obj
6
+ * @returns {boolean}
7
+ */
4
8
  function isObjectType(obj) {
5
9
  var objectType = type(obj);
6
10
  var objectTypes = ['Array', 'Object', 'Function'];
@@ -17,13 +21,13 @@ function isObjectType(obj) {
17
21
  *
18
22
  * Returns the `operator` or `undefined` value for an Assertion.
19
23
  *
20
- * @param {Object} object (constructed Assertion)
21
- * @param {Arguments} chai.Assertion.prototype.assert arguments
24
+ * @param {object} obj object (constructed Assertion)
25
+ * @param {unknown} args chai.Assertion.prototype.assert arguments
26
+ * @returns {unknown}
22
27
  * @namespace Utils
23
28
  * @name getOperator
24
- * @api public
29
+ * @public
25
30
  */
26
-
27
31
  export function getOperator(obj, args) {
28
32
  var operator = flag(obj, 'operator');
29
33
  var negate = flag(obj, 'negate');
@@ -13,13 +13,12 @@ import {getOwnEnumerablePropertySymbols} from './getOwnEnumerablePropertySymbols
13
13
  * symbols of an object. This function is necessary because Object.keys only
14
14
  * returns enumerable property names, not enumerable property symbols.
15
15
  *
16
- * @param {Object} object
16
+ * @param {object} obj
17
17
  * @returns {Array}
18
18
  * @namespace Utils
19
19
  * @name getOwnEnumerableProperties
20
- * @api public
20
+ * @public
21
21
  */
22
-
23
22
  export function getOwnEnumerableProperties(obj) {
24
23
  return Object.keys(obj).concat(getOwnEnumerablePropertySymbols(obj));
25
24
  }
@@ -11,13 +11,12 @@
11
11
  * object. This function is necessary because Object.getOwnPropertySymbols
12
12
  * returns both enumerable and non-enumerable property symbols.
13
13
  *
14
- * @param {Object} object
14
+ * @param {object} obj
15
15
  * @returns {Array}
16
16
  * @namespace Utils
17
17
  * @name getOwnEnumerablePropertySymbols
18
- * @api public
18
+ * @public
19
19
  */
20
-
21
20
  export function getOwnEnumerablePropertySymbols(obj) {
22
21
  if (typeof Object.getOwnPropertySymbols !== 'function') return [];
23
22
 
@@ -10,16 +10,18 @@
10
10
  * This allows the retrieval of property names of an object, enumerable or not,
11
11
  * inherited or not.
12
12
  *
13
- * @param {Object} object
13
+ * @param {object} object
14
14
  * @returns {Array}
15
15
  * @namespace Utils
16
16
  * @name getProperties
17
- * @api public
17
+ * @public
18
18
  */
19
-
20
19
  export function getProperties(object) {
21
20
  var result = Object.getOwnPropertyNames(object);
22
21
 
22
+ /**
23
+ * @param {unknown} property
24
+ */
23
25
  function addProperty(property) {
24
26
  if (result.indexOf(property) === -1) {
25
27
  result.push(property);
@@ -11,7 +11,8 @@ import * as checkError from 'check-error';
11
11
  export {test} from './test.js';
12
12
 
13
13
  // type utility
14
- export {type} from './type-detect.js';
14
+ import {type} from './type-detect.js';
15
+ export {type};
15
16
 
16
17
  // expectTypes utility
17
18
  export {expectTypes} from './expectTypes.js';
@@ -40,7 +41,12 @@ export {default as eql} from 'deep-eql';
40
41
  // Deep path info
41
42
  export {getPathInfo, hasProperty} from 'pathval';
42
43
 
43
- // Function name
44
+ /**
45
+ * Function name
46
+ *
47
+ * @param {Function} fn
48
+ * @returns {string}
49
+ */
44
50
  export function getName(fn) {
45
51
  return fn.name
46
52
  }
@@ -89,3 +95,18 @@ export {isNaN} from './isNaN.js';
89
95
 
90
96
  // getOperator method
91
97
  export {getOperator} from './getOperator.js';
98
+
99
+ /**
100
+ * Determines if an object is a `RegExp`
101
+ * This is used since `instanceof` will not work in virtual contexts
102
+ *
103
+ * @param {*} obj Object to test
104
+ * @returns {boolean}
105
+ */
106
+ export function isRegExp(obj) {
107
+ return Object.prototype.toString.call(obj) === '[object RegExp]';
108
+ }
109
+
110
+ export function isNumeric(obj) {
111
+ return ['Number', 'BigInt'].includes(type(obj))
112
+ }
@@ -10,12 +10,13 @@ import {config} from '../config.js';
10
10
  * Echoes the value of a value. Tries to print the value out
11
11
  * in the best way possible given the different types.
12
12
  *
13
- * @param {Object} obj The object to print out.
14
- * @param {Boolean} showHidden Flag that shows hidden (not enumerable)
13
+ * @param {object} obj The object to print out.
14
+ * @param {boolean} showHidden Flag that shows hidden (not enumerable)
15
15
  * properties of objects. Default is false.
16
- * @param {Number} depth Depth in which to descend in object. Default is 2.
17
- * @param {Boolean} colors Flag to turn on ANSI escape codes to color the
16
+ * @param {number} depth Depth in which to descend in object. Default is 2.
17
+ * @param {boolean} colors Flag to turn on ANSI escape codes to color the
18
18
  * output. Default is false (no coloring).
19
+ * @returns {string}
19
20
  * @namespace Utils
20
21
  * @name inspect
21
22
  */
@@ -11,11 +11,11 @@
11
11
  *
12
12
  * utils.isNaN(NaN); // true
13
13
  *
14
- * @param {Value} The value which has to be checked if it is NaN
14
+ * @param {unknown} value The value which has to be checked if it is NaN
15
+ * @returns {boolean}
15
16
  * @name isNaN
16
- * @api private
17
+ * @private
17
18
  */
18
-
19
19
  function _isNaN(value) {
20
20
  // Refer http://www.ecma-international.org/ecma-262/6.0/#sec-isnan-number
21
21
  // section's NOTE.
@@ -15,8 +15,8 @@ import {config} from '../config.js';
15
15
  *
16
16
  * @namespace Utils
17
17
  * @name isProxyEnabled
18
+ * @returns {boolean}
18
19
  */
19
-
20
20
  export function isProxyEnabled() {
21
21
  return config.useProxy &&
22
22
  typeof Proxy !== 'undefined' &&
@@ -14,13 +14,12 @@ import {config} from '../config.js';
14
14
  * criteria to be inspected in-line for error
15
15
  * messages or should be truncated.
16
16
  *
17
- * @param {Mixed} javascript object to inspect
17
+ * @param {unknown} obj javascript object to inspect
18
18
  * @returns {string} stringified object
19
19
  * @name objDisplay
20
20
  * @namespace Utils
21
- * @api public
21
+ * @public
22
22
  */
23
-
24
23
  export function objDisplay(obj) {
25
24
  var str = inspect(obj)
26
25
  , type = Object.prototype.toString.call(obj);
@@ -16,10 +16,10 @@ import {transferFlags} from './transferFlags.js';
16
16
  * name.
17
17
  *
18
18
  * utils.overwriteChainableMethod(chai.Assertion.prototype, 'lengthOf',
19
- * function (_super) {
20
- * }
21
- * , function (_super) {
22
- * }
19
+ * function (_super) {
20
+ * }
21
+ * , function (_super) {
22
+ * }
23
23
  * );
24
24
  *
25
25
  * Can also be accessed directly from `chai.Assertion`.
@@ -31,15 +31,14 @@ import {transferFlags} from './transferFlags.js';
31
31
  * expect(myFoo).to.have.lengthOf(3);
32
32
  * expect(myFoo).to.have.lengthOf.above(3);
33
33
  *
34
- * @param {Object} ctx object whose method / property is to be overwritten
35
- * @param {String} name of method / property to overwrite
34
+ * @param {object} ctx object whose method / property is to be overwritten
35
+ * @param {string} name of method / property to overwrite
36
36
  * @param {Function} method function that returns a function to be used for name
37
37
  * @param {Function} chainingBehavior function that returns a function to be used for property
38
38
  * @namespace Utils
39
39
  * @name overwriteChainableMethod
40
- * @api public
40
+ * @public
41
41
  */
42
-
43
42
  export function overwriteChainableMethod(ctx, name, method, chainingBehavior) {
44
43
  var chainableBehavior = ctx.__methods[name];
45
44
 
@@ -18,14 +18,14 @@ import {transferFlags} from './transferFlags.js';
18
18
  * to be used for name.
19
19
  *
20
20
  * utils.overwriteMethod(chai.Assertion.prototype, 'equal', function (_super) {
21
- * return function (str) {
22
- * var obj = utils.flag(this, 'object');
23
- * if (obj instanceof Foo) {
24
- * new chai.Assertion(obj.value).to.equal(str);
25
- * } else {
26
- * _super.apply(this, arguments);
21
+ * return function (str) {
22
+ * var obj = utils.flag(this, 'object');
23
+ * if (obj instanceof Foo) {
24
+ * new chai.Assertion(obj.value).to.equal(str);
25
+ * } else {
26
+ * _super.apply(this, arguments);
27
+ * }
27
28
  * }
28
- * }
29
29
  * });
30
30
  *
31
31
  * Can also be accessed directly from `chai.Assertion`.
@@ -36,14 +36,13 @@ import {transferFlags} from './transferFlags.js';
36
36
  *
37
37
  * expect(myFoo).to.equal('bar');
38
38
  *
39
- * @param {Object} ctx object whose method is to be overwritten
40
- * @param {String} name of method to overwrite
39
+ * @param {object} ctx object whose method is to be overwritten
40
+ * @param {string} name of method to overwrite
41
41
  * @param {Function} method function that returns a function to be used for name
42
42
  * @namespace Utils
43
43
  * @name overwriteMethod
44
- * @api public
44
+ * @public
45
45
  */
46
-
47
46
  export function overwriteMethod(ctx, name, method) {
48
47
  var _method = ctx[name]
49
48
  , _super = function () {