{"name":"sorted-union-stream","version":"3.2.2","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":"9091586f5e054bc3203586e035327a0668bb70d7","_id":"sorted-union-stream@3.2.2","_nodeVersion":"16.17.0","_npmVersion":"8.15.0","dist":{"integrity":"sha512-Q6iVm3OPQcIG4rfh53MhPpegzbRDAnCSrcTUKYDc44cUd01jwev/5bVB4Ij32tc3I04d1vz+bQ8c8fXwQPWJ6Q==","shasum":"9b10a87966acbfc186090a3a495c38de405984c5","tarball":"http://registry-npm.ywwl.com/sorted-union-stream/download/sorted-union-stream-3.2.2.tgz","fileCount":7,"unpackedSize":9252,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQC3bUJJqlKQ7z5xy4TTeFgnux66Wk7qnQUOP9dKKXLgSwIgLXyHsi3oksRaBApZY2Lco70Uos+RaN/QWDgruOX0WWY="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkANq6ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpOFA//YfZfV15Xt3oQGLT8Xs3pjrmn+smgYcQZtxsKnCcyT+127uw2\r\nUK13g4zKoffgHeC3z6zIfi5O7++kLABrI9aVuJmBtg2oUS8vBk4DGjEXPa72\r\npijTRtix3H35Msco3sC371qcMSYcVNOfICi35CTqpkz0y7Tic7H1FysuDCd+\r\nq5pYBTuWKEh/bXn7+ORF2rfMPiNKpog8wvwKbzU0jebUlzQyFvGUmYmVrI5i\r\nOzgmphSkuF8iE5m6HLe+ZIREcoUsVsan8zL42tqS7s2GTYfP6WdZF4rFymvN\r\nuw6nOPEvKgmlLff9LC0Fdi3eEkMENSKZJW7ykjcv2/7fU+8ipEWLx6Cu2+GI\r\nRGxO/s02720dQ1TmhUYjcLj1btdn8/rH6kz5GWILHz+q1Eak84eOn+VT7Ud9\r\nVIkgJAALY8qtFe3+Pk+9hnyQDPLo/p9bQ1TA8f/pTpVZSB6HRuaKmIhz4N2U\r\nrUmfFqpJeShSrjhCMDggzZNjLnsr4P5Ovr/OjcGQWl9e1VGsBN0qYOBSZqwA\r\nb0JffCH5Y+CphBQs9/6S5k500TTNCd4gl/070xEUcQE3DcQmhdCyXNVWXdZH\r\nXKNLGLq02DHss5Y/+9+C6AbSu62AbqS77eENq7c17XISWzHZHwGiVubA/5FP\r\n4Wg1GTSQh+MFCQqR/7PeuCw9q8LOvBD7O/M=\r\n=15J0\r\n-----END PGP SIGNATURE-----\r\n","size":3076,"noattachment":false,"key":"/sorted-union-stream/-/sorted-union-stream-3.2.2.tgz"},"_npmUser":{"name":"mafintosh","email":"mathiasbuus@gmail.com"},"directories":{},"maintainers":[{"name":"mafintosh","email":"mathiasbuus@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/sorted-union-stream_3.2.2_1677777594328_0.2347540870731848"},"_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":1677777594510,"_cnpm_publish_time":1677777594510,"dist-tags":{"latest":"3.2.3"}}