Methods
(inner) ArrayCalculateAverage(array) → {number}
Finds the mean of a set of numbers. Array must not be empty.
Parameters:
Name | Type | Description |
---|---|---|
array |
Array.<number> |
Returns:
- Type
- number
- Source:
(inner) ArrayFindIndexOfHighestValue(values) → {number}
Finds the largest value in an array of numbers, and returns the index of that
value, e.g. [1, 3, 2] returns 1. Array must not be empty.
Parameters:
Name | Type | Description |
---|---|---|
values |
Array.<number> |
Returns:
- Type
- number
- Source:
(inner) Assert(condition) → {void}
Standard assertion. Throws if condition is false.
Note: Todo: To better merge w/ Jest, I'll propagate this throughout, and build in a preprocessor switch, driven by Node launch arg.
Note: Todo: To better merge w/ Jest, I'll propagate this throughout, and build in a preprocessor switch, driven by Node launch arg.
Parameters:
Name | Type | Description |
---|---|---|
condition |
boolean |
Returns:
- Type
- void
- Source:
(inner) CheckFloat0to1Exclusive(x) → {boolean}
Returns true if x is in the range { 0 < x < 1 }.
Parameters:
Name | Type | Description |
---|---|---|
x |
number |
Returns:
- Type
- boolean
- Source:
(inner) CheckNonNegativeInteger(x) → {boolean}
Returns true if x is a positive integer or zero.
Parameters:
Name | Type | Description |
---|---|---|
x |
number |
Returns:
- Type
- boolean
- Source:
(inner) CheckPositiveInteger(x) → {boolean}
Returns true if x is an integer greater than zero.
Parameters:
Name | Type | Description |
---|---|---|
x |
number |
Returns:
- Type
- boolean
- Source:
(inner) QueueRotate(queue, newSample, count)
Fills a queue with numbers up to a length limit. Once that limit has been
reached, it drops the oldest first (does a dequeue before the enqueue).
Parameters:
Name | Type | Description |
---|---|---|
queue |
Array.<number> | The set of numbers. |
newSample |
number | The number to add. |
count |
number | The queue max-size limit. |
- Source:
(inner) ThrowCaughtUnknown(messagePrefix, errorOrException)
Throws a relayed exception, with logic that checks the type of the
caught object in order produce a cleaner error message.
Note: This is done because TypeScript does not yet have typed catch().
Note: This is done because TypeScript does not yet have typed catch().
Parameters:
Name | Type | Description |
---|---|---|
messagePrefix |
string | A short message to prepend to the thrown error. |
errorOrException |
unknown | The object originally caught. |
- Source:
(inner) ValidateTextForCSV(x)
Takes arguments in a variety of types, converts them to strings, and checks
whether those string representations will break CSV formatting. Specifically,
it throws in the event it finds a comma or newline. Otherwise it returns
silently.
Parameters:
Name | Type | Description |
---|---|---|
x |
string | number | boolean |
- Source:
(inner) WriteDurationReport(durationMS) → {string}
Creates a string that represents a duration in milliseconds, and variations
of the same in seconds, minutes and hours.
Parameters:
Name | Type | Description |
---|---|---|
durationMS |
number | The time in milliseconds |
Returns:
Example: "15000 ms / 15.00 sec / 0.25 min / 0.0 hr"
- Type
- string
- Source: