Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including relational-join-stream with all npm packages installed. Try it out:

var relationalJoinStream = require("relational-join-stream")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

relational-join-stream v1.1.0

relational-join-stream

Relational Style JOIN query with streams.

A slightly different take to hash-join but the same basic idea.

Stability

Unstable: Expect patches and features, possible api changes.

Example

var join = require('relational-join-stream')

join(
  [streamA, streamB], // streams to join
  function getKey(data, i) {
    //return the key to join on!
    //i is the index of the stream.

    return data.id
  },
  function map (data, i) { //OPTIONAL
    //return what you want to join for this row.
    return data
  },
  function (array, key) {
    //`array` is a matched values from each stream.
    //`key` is the key they where matched on.
    //whatever you return from
    return [key, array.length]
  })

join will merge the streams, matching on getKey, (optionally) map input, and then merge matches, then stream any successful matches.

License

MIT

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free