hyphy
produce a Kefir stream of nodes that come over a hyperlog
background
since we cannot know the order in which we will receive hyperlog nodes, CES/FRP gives us an advantage. we can use bufferBy
, bufferWhileBy
, and other tricks, followed by a final scan
to produce a stream of application states, all of which are built incrementally from hyperlog messages
we can use the resulting stream objects to power react/virtual-dom-like views, and/or to save stuff into an app db. with some trickery, we can even use such a stream to purposefully remember/replicate only certain parts of the hyperlog, although doing that is outside of this module's scope.
installation
npm install hyphy
usage
var hyphy = var hyperlog = var memdb = // a function that takes a kefir stream, and returns a kefir stream { // return a stream return messageS // filter for new chat messages // take just the chat object from them // create an object chats, key'd by chat.id } var log = var hy = processhy log // > 'new app state!' {}// > 'new app state!' {1: {id: 1, name: 'my cool chat', description: 'join me in my cool chat'}}
api
hyphy(hyperlog)
returns a Kefir stream of data that comes over the hyperlog. see the Kefir docs for details on interacting with Kefir streams.
license
BSD