{"name":"sorted-union-stream","version":"3.0.1","repository":{"type":"git","url":"git://github.com/mafintosh/sorted-union-stream.git"},"license":"MIT","description":"Get the union of two sorted streams","keywords":["union","sorted","stream"],"author":{"name":"Mathias Buus Madsen","email":"mathiasbuus@gmail.com"},"scripts":{"test":"tape test.js"},"dependencies":{"streamx":"^2.6.0"},"devDependencies":{"standard":"^14.3.1","tape":"^4.13.0"},"bugs":{"url":"https://github.com/mafintosh/sorted-union-stream/issues"},"homepage":"https://github.com/mafintosh/sorted-union-stream","main":"index.js","gitHead":"d1ed515cbbd676ae57f8b326f1b72b2eed7c6d39","_id":"sorted-union-stream@3.0.1","_nodeVersion":"12.14.1","_npmVersion":"6.13.4","dist":{"integrity":"sha512-6uEBXGIMF3OfUMaWdEWiCfLxuc8i0efrzqxjgvhTHqt5tT87vWN7EmQwazEvSDAaxTQ2562S9VJ2x5LH1Y8ONg==","shasum":"36db3e5c0651d3a6f888814443f664fc25cb63f1","tarball":"http://registry-npm.ywwl.com/sorted-union-stream/download/sorted-union-stream-3.0.1.tgz","fileCount":7,"unpackedSize":8529,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeHw74CRA9TVsSAnZWagAA9IsP/0prWEZAHUJJUJKHT2fw\npOZMZxcpGSS3LSkfXf6hSWL6RCo8NEm8x2wkz0ahIPR5x6o+9MsBiF6FiIbN\nkYKQO6dyJBFTxaqO1kYcLkqaVShX/HU2Ccg9ZD5KrKDg1Ug0RO1cI6z0uQWe\nWytuT8wbXP3+huHQGFiIkbwYWmnG2PlTDpkg9n3OFj/UmuvnNnlrY3pUUhtZ\nkFYrZ0nr/9/SyDIB6stZ8LszeBTnZ9H/xnwl8xj+xOp5AHAOWbGEwWnwTEg4\nvmqj0Er4PakTG7DiQ5wbt/xim0XKCrichMtew3I0qsJ298+QQ0YElllvbfGd\nHw37vW4JtalkrbaRuihFkYw/EI0NiIesyOBjWZyf6muY05x60PeGrQ2Mu3Cx\nOcZhXWe4FEMaL8OZzzYsVhEYs/KLJgSyFmAPBeHPvDGPKTJZOByJ/L8BLBYJ\nbA/yAaoojBRkDcbGaPntjh1axBUXjTbKqc9NdztuDFcLdVTR50tLLlqkiT2a\n3D9OgSipJD3+KQ7QpNqUztkkYG4aBJGBqVFYJSzQylljYmMq3HHjD+E3p7GK\nAXUKYcKthKesC9gy0IiDZBWT2AevhK92jcBqu2aP3G3YkIHhS5QOWOnQc6AA\nC+7yy/pqDLO/SG2mReKNB2NMhUBuMFBXGw10rZbPPwZpymyQaFxPHRv29SC1\ngo3x\r\n=1BDJ\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDlgGJxMIr5Xp7pWDmtBhOro51CamgAIJQ8V01hd0pAmQIgez8fcncvMhRfvN7jP/w2jp2NoFPA7q+jmnahANPBHYY="}],"size":2933,"noattachment":false,"key":"/sorted-union-stream/-/sorted-union-stream-3.0.1.tgz"},"maintainers":[{"name":"mafintosh","email":"mathiasbuus@gmail.com"}],"_npmUser":{"name":"mafintosh","email":"mathiasbuus@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/sorted-union-stream_3.0.1_1579093752078_0.29731168187142454"},"_hasShrinkwrap":false,"readme":"# sorted-union-stream\n\nGet the union of two sorted streams\n\n```\nnpm install sorted-union-stream\n```\n\n[![build status](https://secure.travis-ci.org/mafintosh/sorted-union-stream.png)](http://travis-ci.org/mafintosh/sorted-union-stream)\n\n## Usage\n\n``` js\nconst union = require('sorted-union-stream')\nconst { Readable } = require('streamx')\n\n// from converts an array into a stream\nconst sorted1 = Readable.from([1, 10, 24, 42, 43, 50, 55])\nconst sorted2 = Readable.from([10, 42, 53, 55, 60])\n\n// combine the two streams into a single sorted stream\nconst u = new Union(sorted1, sorted2)\n\nu.on('data', function(data) {\n  console.log(data)\n})\nu.on('end', function() {\n  console.log('no more data')\n})\n```\n\nRunning the above example will print\n\n```\n1\n10\n24\n42\n43\n50\n53\n55\n60\nno more data\n```\n\n## Streaming objects\n\nIf you are streaming objects sorting is based on the compare function you can pass as the 3rd argument.\n\n``` js\nconst sorted1 = Readable.from([{ foo:'a' }, { foo:'b' }, { foo:'c' }])\nconst sorted2 = Readable.from([{ foo:'b' }, { foo:'d' }])\n\nconst u = new Union(sorted1, sorted2, function(a, b) {\n  return a.foo < b.foo ? -1 : a.foo > b.foo ? 1 : 0 \n})\n\nunion.on('data', function(data) {\n  console.log(data)\n})\n```\n\nRunning the above will print\n\n``` js\n{ foo: 'a' }\n{ foo: 'b' }\n{ foo: 'c' }\n{ foo: 'd' }\n```\n\n## License\n\nMIT\n","publish_time":1579093752191,"_cnpm_publish_time":1579093752191,"dist-tags":{"latest":"3.2.3"}}