Giter VIP home page Giter VIP logo

flyd-zip's Introduction

Creates a stream with values from any number of source streams lined up with each other. For example if you have two streams with values [1, 2, 3] and [4, 5, 6, 7], the resulting stream will emit [1, 4], [2, 5], and [3, 6]. The resulting stream will emit the next value only when it has at least one value from each source.

const s1 = flyd.stream()
const s2 = flyd.stream()
const zipped = zip([s1, s2])
s1(1)
s2(2)
zipped() // [1, 2]
s2(3)
zipped() // [1, 2] -- s1 still has old value so zipped does not change
s1(4)
zipped() // [4, 3]

Zip is not like lift, because lift will give you a pair for every new value. For example:

const s1 = flyd.stream()
const s2 = flyd.stream()
const lifted = lift((v1, v2) => [v1, v2], s1, s2)

s1(1)
s2(2)
lifted() // [1,2]
s2(3)    // [1,3]

flyd-zip's People

Contributors

jayrbolton avatar

Watchers

James Cloos avatar  avatar

Forkers

commitchange

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.