1.0.0 • Published 6 years ago
hypertransduce v1.0.0
hypertransduce
Distributed simple-transduce.
example
const output = hypercore(ram)
const multiplyBy5 = st.mapTransducer((value) => value + 5)
const notMultipleOf3 = st.filterTransducer((value) => value % 3 !== 0)
const square = st.mapTransducer((value) => value * value)
const notMultipleOf4 = st.filterTransducer((value) => value % 4 !== 0)
const transducer = st.compose(multiplyBy5, notMultipleOf3, square, notMultipleOf4)
const feed = ht(ram, output, transducer(st.concat))
output.createReadStream({ live: true })
.on('data', data => {
console.log(data)
})
for (let i = 1; i <= 10; i++) {
feed.append(i)
}
outputs:
[49]
[49,121]
[49,121,169]
1.0.0
6 years ago