10 lines
389 B
JavaScript
10 lines
389 B
JavaScript
|
|
"use strict";
|
||
|
|
|
||
|
|
function transition(previous, current) {
|
||
|
|
if (!previous) return { notify: false, state: current, kind: "baseline" };
|
||
|
|
if (previous.ok === current.ok && previous.detail === current.detail) return { notify: false, state: current, kind: "unchanged" };
|
||
|
|
return { notify: true, state: current, kind: current.ok ? "recovered" : "anomaly" };
|
||
|
|
}
|
||
|
|
|
||
|
|
module.exports = { transition };
|