These are a work-in progress.
term | meaning |
---|---|
iterator | An object that follows the Iterator Protocol. |
reactor | Shorthand for an asynchronous iterator. |
producer | An object that's either an iterator or reactor. |
adapter | A function that transforms a value into a producer. |
filter | A function that transforms a producer into another kind of producer. |
reducer | A function that transforms a producer into an ordinary value, like an array or a number. |
generic | A function that is polymorphic across one or more of its arguments. |
Adapters are functions that take a value and return a producer.
producer value → producer
name | type | description |
---|---|---|
value | any | Any value intended to be transformed into a producer. |
→ producer | producer | A producer (an iterator or reactor). |
assert isIterator (producer [])
assert isReactor (producer -> yield await null)
events name, source → reactor
name | type | description |
---|---|---|
name | string | The name of the event to produce. |
source | object | The source of the events. Must have an on method for registering handlers. |
→ reactor | reactor | A reactor that produces the named events from the source. |
read stream → reactor
name | type | description |
---|---|---|
stream | stream | A readable stream-like object, with data , error , and end events. |
→ reactor | reactor | A reactor that produces the data events from the stream. |