Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function getDiagramPromise(stream, scheduler) {
let diagram = {};
let subject = new Rx.BehaviorSubject([]);
stream
.observeOn(scheduler)
.timestamp(scheduler)
.map(x => {
if (typeof x.value !== 'object') {
x.value = Immutable.Map({
content: x.value,
id: Utils.calculateNotificationContentHash(x.value)
});
}
// converts timestamp to % of MAX_VT_TIME
return x.value.set('time', (x.timestamp / MAX_VT_TIME) * 100);
})
.reduce((acc, x) => {
acc.push(x);
return acc;