Members
(static) inherits
Inherit the prototype methods from one constructor into another.
(inner) path
Module dependencies.
Methods
(static) clamp(value, range) → {number}
Clamps a numeric value to an inclusive range.
Parameters:
Name | Type | Description |
---|---|---|
value |
number | Value to be clamped. |
range |
Array:.<number:> | Two element array specifying [min, max] range. |
Returns:
clamped value
- Type
- number
(static) clean(str) → {string}
Strip the function definition from str
, and re-indent for pre whitespace.
Parameters:
Name | Type | Description |
---|---|---|
str |
string |
Returns:
- Type
- string
(static) createMap(…objopt) → {Object}
A "map" is an object with no prototype, for our purposes. In some cases
this would be more appropriate than a Map
, especially if your environment
doesn't support it. Recommended for use in Mocha's public APIs.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
obj |
* |
<optional> <repeatable> |
Arguments to |
Returns:
An object with no prototype, having ...obj
properties
- Type
- Object
(static) defineConstants(…objopt) → {Object}
This differs from createMap only in that
the argument must be non-empty, because the result is frozen.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
obj |
* |
<optional> <repeatable> |
Arguments to |
Throws:
-
if argument is not a non-empty object.
- Type
- TypeError
Returns:
A frozen object with no prototype, having ...obj
properties
- Type
- Object
(static) isPromise(value) → {boolean}
Crude, but effective.
Parameters:
Name | Type | Description |
---|---|---|
value |
* |
Returns:
Whether or not value
is a Promise
- Type
- boolean
(static) noop()
It's a noop.
(static) stackTraceFilter() → {function}
This Filter based on mocha-clean
module.(see: github.com/rstacruz/mocha-clean
)
When invoking this function you get a filter function that get the Error.stack as an input,
and return a prettify output.
(i.e: strip Mocha and internal node functions from stack trace).
Returns:
- Type
- function
(static) supportsEsModules(whether) → {Boolean}
Versions prior to 10 did not support ES Modules, and version 10 has an old incompatible version of ESM.
This function returns whether Node.JS has ES Module supports that is compatible with Mocha's needs,
which is version >=12.11.
Parameters:
Name | Type | Description |
---|---|---|
whether |
partialSupport | the full Node.js ESM support is available (>= 12) or just something that supports the runtime (>= 10) |
Returns:
whether the current version of Node.JS supports ES Modules in a way that is compatible with Mocha
- Type
- Boolean