Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jacobbubu/pull-merge
https://github.com/jacobbubu/pull-merge
Last synced: 15 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/jacobbubu/pull-merge
- Owner: jacobbubu
- License: mit
- Created: 2020-08-22T10:22:59.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2020-08-23T02:57:29.000Z (over 4 years ago)
- Last Synced: 2025-01-01T14:46:28.387Z (27 days ago)
- Language: TypeScript
- Homepage:
- Size: 80.1 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: .github/CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# @jacobbubu/pull-merge
[![Build Status](https://github.com/jacobbubu/pull-merge/workflows/Build%20and%20Release/badge.svg)](https://github.com/jacobbubu/pull-merge/actions?query=workflow%3A%22Build+and+Release%22)
[![Coverage Status](https://coveralls.io/repos/github/jacobbubu/pull-merge/badge.svg)](https://coveralls.io/github/jacobbubu/pull-merge)
[![npm](https://img.shields.io/npm/v/@jacobbubu/pull-merge.svg)](https://www.npmjs.com/package/@jacobbubu/pull-merge/)> Rewriting the [pull-merge](https://github.com/dominictarr/pull-merge) with TypeScript.
# pull-merge
merge sorted pull-streams into one pull stream, while maintaining back-pressure.
Source pull streams MUST be in order.## why rewriting?
* Familiarity with the original author's intent
* Strong type declarations for colleagues to understand and migrate to other programming languages## example
``` ts
import * as pull from 'pull-stream'
import merge from '@jacobbubu/pull-merge'pull(
merge(pull.values([1, 5, 6]), pull.values([2, 4, 7])),
pull.collect(function (err, ary) {
if(err) throw errconsole.log(ary)
//=> [1, 2, 4, 5, 6, 7]
})
)```
## signatures
### merge(left, right, compare?)
return a stream that is the merge of left and right streams.
merge pulls a chunk from both `left` and `right` and then
compares them. `compare` has the same signature as `Array#sort(compare)`.If the two chunks are compared the same, the chunk from the right stream
is taken, but the left chunk is dropped.Otherwise, the lowest chunk is passed to the stream.
### merge([streams...], compare?)
Merge a collection of steams. This calls the first signature recursively.
## License
MIT