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

pull-flat-merge

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pull-flat-merge - npm Package Compare versions

Comparing version 1.0.1 to 1.1.0

10

index.js
var S = require('pull-stream/pull')
var once = require('pull-stream/sources/once')
S.drain = require('pull-stream/sinks/drain')
var many = require('pull-many')
module.exports = function flatMerge () {
module.exports = function flatMerge (onErr) {
return function sink (source) {
var m = many()
S(source, S.drain(function onEvent (s) {
if (typeof s !== 'function') {
return m.add(once(s))
}
m.add(s)
}, function onEnd (err) {
m.cap()
if (err) {
if (onErr) onErr(err)
else throw err
}
}))

@@ -13,0 +21,0 @@ return m

2

package.json
{
"name": "pull-flat-merge",
"version": "1.0.1",
"version": "1.1.0",
"description": "Flat map for pull streams",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -5,2 +5,19 @@ var test = require('tape')

test('pass through non streams', function (t) {
t.plan(2)
var source = S.values([
S.values([1,2]),
3
])
S(
source,
flatMerge(),
S.collect(function (err, evs) {
t.error(err)
t.deepEqual(evs, [1,3,2], 'should pass through non streams')
})
)
})
test('flat merge', function (t) {

@@ -7,0 +24,0 @@ t.plan(2)

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