|
|
@@ -4,7 +4,7 @@ import {FIELD_KEYS, FIELDS} from './consts';
|
|
|
|
|
|
export type ProcessingConfig = {
|
|
|
/** The number of minutes to group on. */
|
|
|
- alignWindow: number,
|
|
|
+ alignWindow?: number,
|
|
|
|
|
|
/**
|
|
|
* The minimum absolute difference between elements before
|
|
|
@@ -12,7 +12,7 @@ export type ProcessingConfig = {
|
|
|
* earlier diff of 0.01, but isn't a spike. A `minChange` of
|
|
|
* 2 would ignore this.
|
|
|
*/
|
|
|
- minSpikeChange: number,
|
|
|
+ minSpikeChange?: number,
|
|
|
|
|
|
/**
|
|
|
* The minimum multiplier of differences between sibling
|
|
|
@@ -21,7 +21,7 @@ export type ProcessingConfig = {
|
|
|
* is a 2.5x difference. A min multiplier of 3 would
|
|
|
* ignore this.
|
|
|
*/
|
|
|
- minSpikeMultiplier: number
|
|
|
+ minSpikeMultiplier?: number
|
|
|
};
|
|
|
|
|
|
const defaultConfig:ProcessingConfig = {
|
|
|
@@ -39,12 +39,12 @@ const defaultConfig:ProcessingConfig = {
|
|
|
*/
|
|
|
export function processData(
|
|
|
data:Reading[],
|
|
|
- config?:ProcessingConfig
|
|
|
+ config:ProcessingConfig = defaultConfig
|
|
|
):Values {
|
|
|
// Note: This is not tested, as everything it calls is tested, and setting up
|
|
|
// an expected output would be very cumbersome.
|
|
|
|
|
|
- config = config || defaultConfig;
|
|
|
+ config = Object.assign(defaultConfig, config);
|
|
|
|
|
|
const values:Values = splitData(data);
|
|
|
|