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

callbag-from-obs

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

callbag-from-obs - npm Package Compare versions

Comparing version 1.1.0 to 1.2.0

5

package.json
{
"name": "callbag-from-obs",
"version": "1.1.0",
"version": "1.2.0",
"description": "Convert an observable to a callbag listenable source",

@@ -20,3 +20,6 @@ "repository": {

"tape": "^4.8.0"
},
"dependencies": {
"symbol-observable": "^1.2.0"
}
}

3

readme.js

@@ -45,2 +45,4 @@ /**

const $$observable = require('symbol-observable').default;
const fromObs = observable => (start, sink) => {

@@ -55,2 +57,3 @@ if (start !== 0) return;

});
observable = observable[$$observable] ? observable[$$observable]() : observable;
dispose = observable.subscribe({

@@ -57,0 +60,0 @@ next: x => sink(1, x),

const test = require('tape');
const $$observable = require('symbol-observable').default;
const fromObs = require('./readme');

@@ -143,1 +144,52 @@

test('it converts using $$observable', (t) => {
t.plan(13);
const source = fromObs({
[$$observable]() {
return {
subscribe(observer) {
let i = 0;
let id = setInterval(() => observer.next(i++), 100);
return function unsubscribe() {
clearInterval(id);
};
}
}
}
});
const downwardsExpectedTypes = [
[0, 'function'],
[1, 'number'],
[1, 'number'],
[1, 'number']
];
const downwardsExpected = [0, 1, 2];
let talkback;
source(0, function observe(type, data) {
const et = downwardsExpectedTypes.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) {
talkback = data;
return;
}
if (type === 1) {
const e = downwardsExpected.shift();
t.deepEquals(data, e, 'downwards data is expected: ' + e);
if (downwardsExpected.length === 0) {
talkback(2);
t.pass('sink disposes the source');
}
}
});
setTimeout(() => {
t.pass('nothing else happens after dispose()');
t.end();
}, 700);
});
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