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

rxjs-interop

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rxjs-interop - npm Package Compare versions

Comparing version 0.0.1-beta.2 to 0.0.1-beta.3

dist/cjs/index.js.map

2

dist/cjs/index.js

@@ -9,2 +9,2 @@ "use strict";

__export(require("./to-observer"));
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zb3VyY2UvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7QUFLQSw2QkFBd0I7QUFDeEIsK0JBQTBCO0FBQzFCLG1DQUE4QiJ9
//# sourceMappingURL=index.js.map

@@ -6,3 +6,5 @@ "use strict";

if (!Symbol.observable) {
if (typeof arg === "function" && arg.prototype[Symbol.observable]) {
if (typeof arg === "function" &&
arg.prototype &&
arg.prototype[Symbol.observable]) {
arg.prototype[symbols_1.observable] = arg.prototype[Symbol.observable];

@@ -19,2 +21,2 @@ delete arg.prototype[Symbol.observable];

exports.patch = patch;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicGF0Y2guanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zb3VyY2UvcGF0Y2gudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFLQSx1Q0FBdUM7QUFPdkMsU0FBZ0IsS0FBSyxDQUNuQixHQUE4RTtJQUU5RSxJQUFJLENBQUMsTUFBTSxDQUFDLFVBQVUsRUFBRTtRQUN0QixJQUFJLE9BQU8sR0FBRyxLQUFLLFVBQVUsSUFBSSxHQUFHLENBQUMsU0FBUyxDQUFDLE1BQU0sQ0FBQyxVQUFVLENBQUMsRUFBRTtZQUNoRSxHQUFHLENBQUMsU0FBaUIsQ0FBQyxvQkFBVSxDQUFDLEdBQUcsR0FBRyxDQUFDLFNBQVMsQ0FBQyxNQUFNLENBQUMsVUFBVSxDQUFDLENBQUM7WUFDdEUsT0FBTyxHQUFHLENBQUMsU0FBUyxDQUFDLE1BQU0sQ0FBQyxVQUFVLENBQUMsQ0FBQztTQUN6QzthQUFNO1lBQ0osR0FBVyxDQUFDLG9CQUFVLENBQUMsR0FBRyxHQUFHLENBQUMsTUFBTSxDQUFDLFVBQVUsQ0FBQyxDQUFDO1lBQ2xELE9BQU8sR0FBRyxDQUFDLE1BQU0sQ0FBQyxVQUFVLENBQUMsQ0FBQztTQUMvQjtLQUNGO0lBQ0QsT0FBTyxHQUFHLENBQUM7QUFDYixDQUFDO0FBYkQsc0JBYUMifQ==
//# sourceMappingURL=patch.js.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.observable = Symbol.observable || "@@observable";
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3ltYm9scy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NvdXJjZS9zeW1ib2xzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBWWEsUUFBQSxVQUFVLEdBQUcsTUFBTSxDQUFDLFVBQVUsSUFBSSxjQUFjLENBQUMifQ==
//# sourceMappingURL=symbols.js.map

@@ -24,2 +24,2 @@ "use strict";

exports.toObserver = toObserver;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidG8tb2JzZXJ2ZXIuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zb3VyY2UvdG8tb2JzZXJ2ZXIudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFPQSxNQUFNLElBQUksR0FBRyxHQUFHLEVBQUUsR0FBRSxDQUFDLENBQUM7QUFFdEIsU0FBZ0IsVUFBVSxDQUN4QixjQUFpRSxFQUNqRSxLQUFxQyxFQUNyQyxRQUE4QjtJQUU5QixJQUFJLGNBQWMsSUFBSSxPQUFPLGNBQWMsS0FBSyxVQUFVLEVBQUU7UUFDMUQsSUFDRSxjQUFjLENBQUMsSUFBSTtZQUNuQixjQUFjLENBQUMsS0FBSztZQUNwQixjQUFjLENBQUMsUUFBUSxFQUN2QjtZQUNBLE9BQU8sY0FBNkIsQ0FBQztTQUN0QztRQUNELE9BQU87WUFDTCxRQUFRLEVBQUUsQ0FBQyxjQUFjLENBQUMsUUFBUSxJQUFJLElBQUksQ0FBQyxDQUFDLElBQUksQ0FBQyxjQUFjLENBQUM7WUFDaEUsS0FBSyxFQUFFLENBQUMsY0FBYyxDQUFDLEtBQUssSUFBSSxJQUFJLENBQUMsQ0FBQyxJQUFJLENBQUMsY0FBYyxDQUFDO1lBQzFELElBQUksRUFBRSxDQUFDLGNBQWMsQ0FBQyxJQUFJLElBQUksSUFBSSxDQUFDLENBQUMsSUFBSSxDQUFDLGNBQWMsQ0FBQztTQUN6RCxDQUFDO0tBQ0g7SUFDRCxPQUFPO1FBQ0wsUUFBUSxFQUFFLFFBQVEsSUFBSSxJQUFJO1FBQzFCLEtBQUssRUFBRSxLQUFLLElBQUksSUFBSTtRQUNwQixJQUFJLEVBQUUsY0FBYyxJQUFJLElBQUk7S0FDN0IsQ0FBQztBQUNKLENBQUM7QUF4QkQsZ0NBd0JDIn0=
//# sourceMappingURL=to-observer.js.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHlwZXMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zb3VyY2UvdHlwZXMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IiJ9
//# sourceMappingURL=types.js.map
export * from "./patch";
export * from "./symbols";
export * from "./to-observer";
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zb3VyY2UvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBS0EsY0FBYyxTQUFTLENBQUM7QUFDeEIsY0FBYyxXQUFXLENBQUM7QUFDMUIsY0FBYyxlQUFlLENBQUMifQ==
//# sourceMappingURL=index.js.map
import { observable } from "./symbols";
export function patch(arg) {
if (!Symbol.observable) {
if (typeof arg === "function" && arg.prototype[Symbol.observable]) {
if (typeof arg === "function" &&
arg.prototype &&
arg.prototype[Symbol.observable]) {
arg.prototype[observable] = arg.prototype[Symbol.observable];

@@ -15,2 +17,2 @@ delete arg.prototype[Symbol.observable];

}
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicGF0Y2guanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zb3VyY2UvcGF0Y2gudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBS0EsT0FBTyxFQUFFLFVBQVUsRUFBRSxNQUFNLFdBQVcsQ0FBQztBQU92QyxNQUFNLFVBQVUsS0FBSyxDQUNuQixHQUE4RTtJQUU5RSxJQUFJLENBQUMsTUFBTSxDQUFDLFVBQVUsRUFBRTtRQUN0QixJQUFJLE9BQU8sR0FBRyxLQUFLLFVBQVUsSUFBSSxHQUFHLENBQUMsU0FBUyxDQUFDLE1BQU0sQ0FBQyxVQUFVLENBQUMsRUFBRTtZQUNoRSxHQUFHLENBQUMsU0FBaUIsQ0FBQyxVQUFVLENBQUMsR0FBRyxHQUFHLENBQUMsU0FBUyxDQUFDLE1BQU0sQ0FBQyxVQUFVLENBQUMsQ0FBQztZQUN0RSxPQUFPLEdBQUcsQ0FBQyxTQUFTLENBQUMsTUFBTSxDQUFDLFVBQVUsQ0FBQyxDQUFDO1NBQ3pDO2FBQU07WUFDSixHQUFXLENBQUMsVUFBVSxDQUFDLEdBQUcsR0FBRyxDQUFDLE1BQU0sQ0FBQyxVQUFVLENBQUMsQ0FBQztZQUNsRCxPQUFPLEdBQUcsQ0FBQyxNQUFNLENBQUMsVUFBVSxDQUFDLENBQUM7U0FDL0I7S0FDRjtJQUNELE9BQU8sR0FBRyxDQUFDO0FBQ2IsQ0FBQyJ9
//# sourceMappingURL=patch.js.map
export const observable = Symbol.observable || "@@observable";
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3ltYm9scy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NvdXJjZS9zeW1ib2xzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQVlBLE1BQU0sQ0FBQyxNQUFNLFVBQVUsR0FBRyxNQUFNLENBQUMsVUFBVSxJQUFJLGNBQWMsQ0FBQyJ9
//# sourceMappingURL=symbols.js.map

@@ -21,2 +21,2 @@ const noop = () => { };

}
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidG8tb2JzZXJ2ZXIuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zb3VyY2UvdG8tb2JzZXJ2ZXIudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBT0EsTUFBTSxJQUFJLEdBQUcsR0FBRyxFQUFFLEdBQUUsQ0FBQyxDQUFDO0FBRXRCLE1BQU0sVUFBVSxVQUFVLENBQ3hCLGNBQWlFLEVBQ2pFLEtBQXFDLEVBQ3JDLFFBQThCO0lBRTlCLElBQUksY0FBYyxJQUFJLE9BQU8sY0FBYyxLQUFLLFVBQVUsRUFBRTtRQUMxRCxJQUNFLGNBQWMsQ0FBQyxJQUFJO1lBQ25CLGNBQWMsQ0FBQyxLQUFLO1lBQ3BCLGNBQWMsQ0FBQyxRQUFRLEVBQ3ZCO1lBQ0EsT0FBTyxjQUE2QixDQUFDO1NBQ3RDO1FBQ0QsT0FBTztZQUNMLFFBQVEsRUFBRSxDQUFDLGNBQWMsQ0FBQyxRQUFRLElBQUksSUFBSSxDQUFDLENBQUMsSUFBSSxDQUFDLGNBQWMsQ0FBQztZQUNoRSxLQUFLLEVBQUUsQ0FBQyxjQUFjLENBQUMsS0FBSyxJQUFJLElBQUksQ0FBQyxDQUFDLElBQUksQ0FBQyxjQUFjLENBQUM7WUFDMUQsSUFBSSxFQUFFLENBQUMsY0FBYyxDQUFDLElBQUksSUFBSSxJQUFJLENBQUMsQ0FBQyxJQUFJLENBQUMsY0FBYyxDQUFDO1NBQ3pELENBQUM7S0FDSDtJQUNELE9BQU87UUFDTCxRQUFRLEVBQUUsUUFBUSxJQUFJLElBQUk7UUFDMUIsS0FBSyxFQUFFLEtBQUssSUFBSSxJQUFJO1FBQ3BCLElBQUksRUFBRSxjQUFjLElBQUksSUFBSTtLQUM3QixDQUFDO0FBQ0osQ0FBQyJ9
//# sourceMappingURL=to-observer.js.map

@@ -1,1 +0,1 @@

//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHlwZXMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zb3VyY2UvdHlwZXMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IiJ9
//# sourceMappingURL=types.js.map

@@ -54,4 +54,4 @@ {

"scripts": {
"dist": "yarn run dist:build",
"dist:build": "yarn run dist:clean && yarn run dist:build:cjs && yarn run dist:build:esm",
"dist": "yarn run dist:clean && yarn run dist:build",
"dist:build": "yarn run dist:build:cjs && yarn run dist:build:esm",
"dist:build:cjs": "tsc -p tsconfig-dist-cjs.json",

@@ -61,2 +61,3 @@ "dist:build:esm": "tsc -p tsconfig-dist-esm.json",

"lint": "tslint --project tsconfig.json source/**/*.ts",
"prepublishOnly": "yarn run test && yarn run dist",
"prettier": "prettier --write \"./**/{scripts,source}/**/*.{js,json,ts}\"",

@@ -70,3 +71,3 @@ "prettier:ci": "prettier --check \"./**/{scripts,source}/**/*.{js,json,ts}\"",

"types": "./dist/esm/index.d.ts",
"version": "0.0.1-beta.2"
"version": "0.0.1-beta.3"
}

@@ -18,2 +18,4 @@ # rxjs-interop

This package has no dependency on RxJS and is small, but if you want to publish an interop package with no dependencies, just copy the license and the code from this project into yours.
## Install

@@ -47,3 +49,3 @@

You can use the `patch` and `toObserver` helpers in this package to more easily implement `subscribe` and to make sure that the interop observable will work with RxJS without `Symbol.observable` having to be initialized:
You can use the `toObserver` and `patch` helpers in this package to more easily implement `subscribe` and to make sure that the interop observable will work with RxJS without `Symbol.observable` having to be initialized:

@@ -66,2 +68,4 @@ ```ts

`patch` can be passed either an interop observable instance or the constructor of an interop observable class.
`patch` can be passed either an interop observable instance or the constructor of an interop observable class.
For an example of how this package can be used, check out [Christoph Guttandin](https://github.com/chrisguttandin)'s [`subscribable-things`](https://github.com/chrisguttandin/subscribable-things).

@@ -39,3 +39,3 @@ /**

patch(interop);
Rx.from(interop).subscribe(value => values.push(42));
Rx.from(interop).subscribe(value => values.push(value));
expect(values).to.deep.equal([42]);

@@ -54,3 +54,3 @@ });

}
Rx.from(new Interop()).subscribe(value => values.push(42));
Rx.from(new Interop()).subscribe(value => values.push(value));
expect(values).to.deep.equal([42]);

@@ -67,5 +67,18 @@ });

patch(Interop);
Rx.from(new Interop()).subscribe(value => values.push(42));
Rx.from(new Interop()).subscribe(value => values.push(value));
expect(values).to.deep.equal([42]);
});
it("should patch a function", () => {
const values: number[] = [];
const interop = (
...args: Parameters<Subscribable<number>["subscribe"]>
) => subscribable.subscribe(...args);
interop[Symbol.observable] = (): Subscribable<number> => {
return subscribable;
};
patch(interop);
Rx.from(interop).subscribe(value => values.push(value));
expect(values).to.deep.equal([42]);
});
});

@@ -89,3 +102,3 @@

patch(interop);
Rx.from(interop).subscribe(value => values.push(42));
Rx.from(interop).subscribe(value => values.push(value));
expect(values).to.deep.equal([42]);

@@ -104,3 +117,3 @@ });

}
Rx.from(new Interop()).subscribe(value => values.push(42));
Rx.from(new Interop()).subscribe(value => values.push(value));
expect(values).to.deep.equal([42]);

@@ -117,6 +130,19 @@ });

patch(Interop);
Rx.from(new Interop()).subscribe(value => values.push(42));
Rx.from(new Interop()).subscribe(value => values.push(value));
expect(values).to.deep.equal([42]);
});
it("should patch a function", () => {
const values: number[] = [];
const interop = (
...args: Parameters<Subscribable<number>["subscribe"]>
) => subscribable.subscribe(...args);
interop[Symbol.observable] = (): Subscribable<number> => {
return subscribable;
};
patch(interop);
Rx.from(interop).subscribe(value => values.push(value));
expect(values).to.deep.equal([42]);
});
afterEach(() => {

@@ -123,0 +149,0 @@ (Symbol as any).observable = symbol;

@@ -17,3 +17,7 @@ /**

if (!Symbol.observable) {
if (typeof arg === "function" && arg.prototype[Symbol.observable]) {
if (
typeof arg === "function" &&
arg.prototype &&
arg.prototype[Symbol.observable]
) {
(arg.prototype as any)[observable] = arg.prototype[Symbol.observable];

@@ -20,0 +24,0 @@ delete arg.prototype[Symbol.observable];

{
"compilerOptions": {
"declaration": true,
"inlineSourceMap": true,
"module": "commonjs",

@@ -9,6 +7,3 @@ "outDir": "dist/cjs",

},
"exclude": [
"source/**/*-spec.ts"
],
"extends": "./tsconfig.json"
"extends": "./tsconfig-dist.json"
}
{
"compilerOptions": {
"declaration": true,
"inlineSourceMap": true,
"module": "esnext",

@@ -9,3 +7,3 @@ "outDir": "dist/esm",

},
"extends": "./tsconfig-dist-cjs.json"
"extends": "./tsconfig-dist.json"
}
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