Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

multi-sort-stream

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

multi-sort-stream

merge multiple sorted streams into a single sorted stream

  • 1.0.4
  • latest
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

multi-sort-stream

merge multiple sorted streams into a single sorted stream

example

var multiSort = require('multi-sort-stream')
var { Readable, Transform, pipeline } = require('stream')
var a = Readable.from([5,10,15])
var b = Readable.from([3,20,50,55])
var c = Readable.from([17,25])

pipeline(
  multiSort([a,b,c], (a,b) => a < b ? -1 : +1),
  Transform({
    writableObjectMode: true,
    transform: (row,enc,next) => next(null, JSON.stringify(row)+'\n'),
  }),
  process.stdout,
  (err) => { if (err) console.error(err) }
)

output:

3
5
10
15
17
20
25
50
55

api

var multiSort = require('multi-sort-stream')

var stream = multiSort(streams, opts)

Create a readable stream of sorted output from an array of sorted readable streams.

  • opts.compare(a,b) - comparison function (return -1 or +1)

If opts is a function, it will be used as the opts.compare function.

install

npm install multi-sort-stream

license

bsd

FAQs

Package last updated on 04 Jul 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc