UNPKG

moar-js

Version:

Simple JavaScript files I use across projects

22 lines (16 loc) 396 B
const {__, websocketStreamSource} = require('../fusto') const hasError = json => Object.hasOwn(json, 'error') module.exports = client => { const source = __(websocketStreamSource(client)) .map(JSON.parse) const feed = source .filter(json => !hasError(json)) .pluck('result') const errors = source .observe() .filter(hasError) return { feed, errors, } }