callbag-combine
Advanced tools
Comparing version
{ | ||
"name": "callbag-combine", | ||
"version": "1.0.0", | ||
"description": | ||
"Callbag factory that combines data from multiple callbag sources", | ||
"version": "1.0.1", | ||
"description": "Callbag factory that combines data from multiple callbag sources", | ||
"repository": { | ||
@@ -10,3 +9,3 @@ "type": "git", | ||
}, | ||
"main": "index.js", | ||
"main": "readme.js", | ||
"scripts": { | ||
@@ -17,2 +16,5 @@ "test": "tape test.js" | ||
"license": "MIT", | ||
"keywords": [ | ||
"callbag" | ||
], | ||
"devDependencies": { | ||
@@ -19,0 +21,0 @@ "tape": "^4.8.0" |
88
test.js
const test = require('tape'); | ||
const combine = require('./index'); | ||
const combine = require('./readme'); | ||
@@ -7,6 +7,6 @@ test('it combines 1 async finite listenable source', (t) => { | ||
const downwardsExpectedType = [ | ||
[0, 'function'], | ||
[1, 'object'], | ||
[1, 'object'], | ||
[0, 'function'], | ||
[1, 'object'], | ||
[1, 'object'], | ||
[1, 'object'], | ||
[2, 'undefined'] | ||
@@ -22,7 +22,7 @@ ]; | ||
i++; | ||
sink(1, i); | ||
if (i === 3) { | ||
clearInterval(id); | ||
sink(2); | ||
} | ||
sink(1, i); | ||
if (i === 3) { | ||
clearInterval(id); | ||
sink(2); | ||
} | ||
}, 100); | ||
@@ -56,12 +56,12 @@ sink(0, sourceA); | ||
const downwardsExpectedType = [ | ||
[0, 'function'], | ||
[1, 'object'], | ||
[1, 'object'], | ||
[1, 'object'], | ||
[1, 'object'], | ||
[1, 'object'], | ||
[0, 'function'], | ||
[1, 'object'], | ||
[1, 'object'], | ||
[1, 'object'], | ||
[1, 'object'], | ||
[1, 'object'], | ||
[2, 'undefined'] | ||
]; | ||
const downwardsExpected = [ | ||
[2, 'a'], | ||
[2, 'a'], | ||
[3, 'a'], | ||
@@ -79,7 +79,7 @@ [4, 'a'], | ||
i++; | ||
sink(1, i); | ||
if (i === 5) { | ||
clearInterval(id); | ||
sink(2); | ||
} | ||
sink(1, i); | ||
if (i === 5) { | ||
clearInterval(id); | ||
sink(2); | ||
} | ||
}, 100); | ||
@@ -126,6 +126,6 @@ sink(0, sourceA); | ||
const downwardsExpectedType = [ | ||
[0, 'function'], | ||
[1, 'object'], | ||
[1, 'object'], | ||
[0, 'function'], | ||
[1, 'object'], | ||
[1, 'object'], | ||
[1, 'object'], | ||
]; | ||
@@ -135,3 +135,3 @@ const downwardsExpected = [[10], [20], [30]]; | ||
function makeSource() { | ||
let sent = 0; | ||
let sent = 0; | ||
let id; | ||
@@ -143,7 +143,7 @@ const source = (type, data) => { | ||
if (type === 0) { | ||
const sink = data; | ||
id = setInterval(() => { | ||
const sink = data; | ||
id = setInterval(() => { | ||
sink(1, (++sent)*10); | ||
}, 100); | ||
sink(0, source); | ||
}, 100); | ||
sink(0, source); | ||
} else if (type === 2) { | ||
@@ -170,5 +170,5 @@ clearInterval(id); | ||
if (downwardsExpected.length === 0) { | ||
talkback(2); | ||
talkback(2); | ||
} | ||
}; | ||
}; | ||
} | ||
@@ -198,11 +198,11 @@ | ||
const downwardsExpectedType = [ | ||
[0, 'function'], | ||
[1, 'object'], | ||
[1, 'object'], | ||
[1, 'object'], | ||
[1, 'object'], | ||
[1, 'object'] | ||
[0, 'function'], | ||
[1, 'object'], | ||
[1, 'object'], | ||
[1, 'object'], | ||
[1, 'object'], | ||
[1, 'object'] | ||
]; | ||
const downwardsExpected = [ | ||
[2, 'a'], | ||
[2, 'a'], | ||
[3, 'a'], | ||
@@ -242,9 +242,9 @@ [4, 'a'], | ||
id = setTimeout(() => { | ||
sink(1, 'a'); | ||
sink(1, 'a'); | ||
id = setTimeout(() => { | ||
sink(1, 'b'); | ||
sink(1, 'b'); | ||
id = setTimeout(() => { | ||
sink(1, 'c'); | ||
sink(1, 'c'); | ||
id = setTimeout(() => { | ||
sink(1, 'd'); | ||
sink(1, 'd'); | ||
}, 230); | ||
@@ -278,5 +278,5 @@ }, 230); | ||
if (downwardsExpected.length === 0) { | ||
talkback(2); | ||
talkback(2); | ||
} | ||
}; | ||
}; | ||
} | ||
@@ -283,0 +283,0 @@ |
10453
2.34%325
9.43%74
184.62%4
-20%