New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

callbag-flatten

Package Overview
Dependencies
Maintainers
2
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

callbag-flatten - npm Package Compare versions

Comparing version

to
1.5.0

.github/workflows/node.js.yml

2

index.cjs.js

@@ -12,3 +12,3 @@ 'use strict';

innerTalkback && innerTalkback(2);
outerTalkback(2);
if (!outerEnded) outerTalkback(2);
}

@@ -15,0 +15,0 @@ }

@@ -10,3 +10,3 @@ const flatten = source => (start, sink) => {

innerTalkback && innerTalkback(2);
outerTalkback(2);
if (!outerEnded) outerTalkback(2);
}

@@ -13,0 +13,0 @@ }

{
"name": "callbag-flatten",
"version": "1.4.0",
"version": "1.5.0",
"description": "Callbag operator that flattens a higher-order callbag source",

@@ -25,2 +25,3 @@ "repository": {

"callbag-map": "1.0.0",
"callbag-never": "^1.0.0",
"rollup": "^0.63.4",

@@ -27,0 +28,0 @@ "tape": "^4.8.0"

const test = require('tape');
const map = require('callbag-map');
const never = require('callbag-never');
const flatten = require('.');

@@ -391,1 +392,43 @@

});
test('it should not try unsubscribe from completed source when waiting for inner completion', t => {
t.plan(5);
const outerExpectedType = [
[0, 'function'],
];
const downwardsExpectedType = [
[0, 'function'],
];
function sourceOuter(type, data) {
const et = outerExpectedType.shift();
t.equals(type, et[0], 'outer type is expected: ' + et[0]);
t.equals(typeof data, et[1], 'outer data type is expected: ' + et[1]);
if (type === 0) {
const sink = data;
sink(0, sourceOuter);
sink(1, true);
sink(2);
}
}
function sink(type, data) {
const et = downwardsExpectedType.shift();
t.equals(type, et[0], 'downwards type is expected: ' + et[0]);
t.equals(typeof data, et[1], 'downwards data type is expected: ' + et[1]);
if (type === 0) {
const talkback = data;
setTimeout(() => talkback(2), 0);
}
};
const source = flatten(map(() => never)(sourceOuter));
source(0, sink);
setTimeout(() => {
t.pass('nothing else happens');
t.end();
}, 100);
});