Skip to content

Latest commit

 

History

History
34 lines (25 loc) · 538 Bytes

README.md

File metadata and controls

34 lines (25 loc) · 538 Bytes

flyd-takeuntil

Emit values from a stream until a second stream emits a value.

Graph

a:               {---1---2---3---4}
b:               {---------x------}
takeUntil(a, b): {---1---2--------}

Signature

Stream a -> Stream b -> Stream a

Usage

const takeUntil = require('flyd/module/takeuntil')

const source = flyd.stream()
const end = flyd.stream()
const result = takeUntil(source, end)

source(1)(2)
result() // 2
source(3)
result() // 3

end(true)
result() // 3
source(4)(5)
result() // 3