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

cuprum

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cuprum - npm Package Compare versions

Comparing version 0.1.8 to 0.1.9

2

dist/bundle.common.min.js

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

"use strict";Object.defineProperty(exports,"__esModule",{value:!0});class s{constructor(){this.subscribers=new Set,this.subscribersHot=new Set,this.dispatched=!1,this.hot=!1}dispatch(s){const t=this.val;this.val=s,this.dispatched=!0,this.subscribers.forEach(e=>e(s,t))}subscribeNext(s){return this.subscribers.add(s),this.notifyHotSubscribers(),{unsubscribe:()=>{this.subscribers.delete(s)}}}subscribe(s){return this.dispatched&&s(this.val),this.subscribeNext(s)}unsubscribe(s){this.subscribers.delete(s),this.notifyHotSubscribers()}notifyHotSubscribers(){this.subscribers.size>0!=this.hot&&(this.hot=this.subscribers.size>0,this.subscribersHot.forEach(s=>s(this.hot)))}subscribeHot(s){return this.subscribersHot.add(s),{unsubscribe:()=>{this.subscribersHot.delete(s)}}}clear(){this.subscribers.clear(),this.subscribersHot.clear()}value(){return this.val}promise(){return new Promise(s=>{const t=this.subscribe((function(e){t.unsubscribe(),s(e)}))})}map(t){const e=new s,i=s=>{e.dispatch(t(s))};return e.subscribeHot(s=>{s?this.subscribe(i):this.unsubscribe(i)}),e}filter(t){const e=new s,i=s=>{t(s)&&e.dispatch(s)};return e.subscribeHot(s=>{s?this.subscribe(i):this.unsubscribe(i)}),e}}exports.Cuprum=s,exports.Subscription=class{},exports.combine=function(t,e){const i=new s;let r,b;return i.subscribeHot(s=>{s?(r=t.subscribe(s=>{i.dispatch([s,e.value()])}),b=e.subscribe(s=>{i.dispatch([t.value(),s])})):(r.unsubscribe(),b.unsubscribe())}),i},exports.fromEvent=function(t,e){const i=new s,r=s=>{i.dispatch(s)};return i.subscribeHot(s=>{s?t.addEventListener(e,r,!1):t.removeEventListener(e,r,!1)}),i},exports.tap=function(s){return s(this.val),this};
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});class s{constructor(){this.subscribers=new Set,this.subscribersHot=new Set,this.dispatched=!1,this.hot=!1}dispatch(s){const t=this.val;this.val=s,this.dispatched=!0,this.subscribers.forEach(e=>e(s,t))}subscribeNext(s){return this.subscribers.add(s),this.notifyHotSubscribers(),{unsubscribe:()=>{this.subscribers.delete(s)}}}subscribe(s){return this.dispatched&&s(this.val),this.subscribeNext(s)}unsubscribe(s){this.subscribers.delete(s),this.notifyHotSubscribers()}notifyHotSubscribers(){this.subscribers.size>0!=this.hot&&(this.hot=this.subscribers.size>0,this.subscribersHot.forEach(s=>s(this.hot)))}subscribeHot(s){return this.subscribersHot.add(s),{unsubscribe:()=>{this.subscribersHot.delete(s)}}}clear(){this.subscribers.clear(),this.subscribersHot.clear()}value(){return this.val}promise(){return new Promise(s=>{const t=this.subscribe((function(e){t.unsubscribe(),s(e)}))})}map(t){const e=new s,r=s=>{e.dispatch(t(s))};return e.subscribeHot(s=>{s?this.subscribe(r):this.unsubscribe(r)}),e}filter(t){const e=new s,r=s=>{t(s)&&e.dispatch(s)};return e.subscribeHot(s=>{s?this.subscribe(r):this.unsubscribe(r)}),e}}exports.Cuprum=s,exports.combine=function(...t){const e=new s,r=new Set;return e.subscribeHot(s=>{s?t.forEach(s=>{r.add(s.subscribe(()=>{e.dispatch(t.map(s=>s.value()))}))}):r.forEach(s=>s.unsubscribe())}),e},exports.fromEvent=function(t,e){const r=new s,i=s=>{r.dispatch(s)};return r.subscribeHot(s=>{s?t.addEventListener(e,i,!1):t.removeEventListener(e,i,!1)}),r},exports.tap=function(s){return s(this.val),this};
//# sourceMappingURL=bundle.common.min.js.map

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

class s{constructor(){this.subscribers=new Set,this.subscribersHot=new Set,this.dispatched=!1,this.hot=!1}dispatch(s){const t=this.val;this.val=s,this.dispatched=!0,this.subscribers.forEach(i=>i(s,t))}subscribeNext(s){return this.subscribers.add(s),this.notifyHotSubscribers(),{unsubscribe:()=>{this.subscribers.delete(s)}}}subscribe(s){return this.dispatched&&s(this.val),this.subscribeNext(s)}unsubscribe(s){this.subscribers.delete(s),this.notifyHotSubscribers()}notifyHotSubscribers(){this.subscribers.size>0!=this.hot&&(this.hot=this.subscribers.size>0,this.subscribersHot.forEach(s=>s(this.hot)))}subscribeHot(s){return this.subscribersHot.add(s),{unsubscribe:()=>{this.subscribersHot.delete(s)}}}clear(){this.subscribers.clear(),this.subscribersHot.clear()}value(){return this.val}promise(){return new Promise(s=>{const t=this.subscribe((function(i){t.unsubscribe(),s(i)}))})}map(t){const i=new s,e=s=>{i.dispatch(t(s))};return i.subscribeHot(s=>{s?this.subscribe(e):this.unsubscribe(e)}),i}filter(t){const i=new s,e=s=>{t(s)&&i.dispatch(s)};return i.subscribeHot(s=>{s?this.subscribe(e):this.unsubscribe(e)}),i}}class t{}function i(s){return s(this.val),this}function e(t,i){const e=new s,r=s=>{e.dispatch(s)};return e.subscribeHot(s=>{s?t.addEventListener(i,r,!1):t.removeEventListener(i,r,!1)}),e}function r(t,i){const e=new s;let r,b;return e.subscribeHot(s=>{s?(r=t.subscribe(s=>{e.dispatch([s,i.value()])}),b=i.subscribe(s=>{e.dispatch([t.value(),s])})):(r.unsubscribe(),b.unsubscribe())}),e}export{s as Cuprum,t as Subscription,r as combine,e as fromEvent,i as tap};
class s{constructor(){this.subscribers=new Set,this.subscribersHot=new Set,this.dispatched=!1,this.hot=!1}dispatch(s){const t=this.val;this.val=s,this.dispatched=!0,this.subscribers.forEach(i=>i(s,t))}subscribeNext(s){return this.subscribers.add(s),this.notifyHotSubscribers(),{unsubscribe:()=>{this.subscribers.delete(s)}}}subscribe(s){return this.dispatched&&s(this.val),this.subscribeNext(s)}unsubscribe(s){this.subscribers.delete(s),this.notifyHotSubscribers()}notifyHotSubscribers(){this.subscribers.size>0!=this.hot&&(this.hot=this.subscribers.size>0,this.subscribersHot.forEach(s=>s(this.hot)))}subscribeHot(s){return this.subscribersHot.add(s),{unsubscribe:()=>{this.subscribersHot.delete(s)}}}clear(){this.subscribers.clear(),this.subscribersHot.clear()}value(){return this.val}promise(){return new Promise(s=>{const t=this.subscribe((function(i){t.unsubscribe(),s(i)}))})}map(t){const i=new s,e=s=>{i.dispatch(t(s))};return i.subscribeHot(s=>{s?this.subscribe(e):this.unsubscribe(e)}),i}filter(t){const i=new s,e=s=>{t(s)&&i.dispatch(s)};return i.subscribeHot(s=>{s?this.subscribe(e):this.unsubscribe(e)}),i}}function t(s){return s(this.val),this}function i(t,i){const e=new s,r=s=>{e.dispatch(s)};return e.subscribeHot(s=>{s?t.addEventListener(i,r,!1):t.removeEventListener(i,r,!1)}),e}function e(...t){const i=new s,e=new Set;return i.subscribeHot(s=>{s?t.forEach(s=>{e.add(s.subscribe(()=>{i.dispatch(t.map(s=>s.value()))}))}):e.forEach(s=>s.unsubscribe())}),i}export{s as Cuprum,e as combine,i as fromEvent,t as tap};
//# sourceMappingURL=bundle.min.js.map

@@ -21,7 +21,14 @@ export declare class Cuprum<T> {

}
export declare class Subscription {
unsubscribe: () => void;
}
export declare function tap(fn: (val: any) => any): any;
export declare function fromEvent(element: any, eventType: any): Cuprum<Event>;
export declare function combine<T>(obs1$: Cuprum<T>): Cuprum<[T]>;
export declare function combine<T, U>(obs1$: Cuprum<T>, obs2$: Cuprum<U>): Cuprum<[T, U]>;
export declare function combine<T, U, V>(obs1$: Cuprum<T>, obs2$: Cuprum<U>, obs3$: Cuprum<V>): Cuprum<[T, U, V]>;
export declare function combine<T, U, V, W>(obs1$: Cuprum<T>, obs2$: Cuprum<U>, obs3$: Cuprum<V>, obs4$: Cuprum<W>): Cuprum<[T, U, V, W]>;
export declare function combine<T, U, V, W, X>(obs1$: Cuprum<T>, obs2$: Cuprum<U>, obs3$: Cuprum<V>, obs4$: Cuprum<W>, obs5$: Cuprum<X>): Cuprum<[T, U, V, W, X]>;
export declare function combine<T, U, V, W, X, Y>(obs1$: Cuprum<T>, obs2$: Cuprum<U>, obs3$: Cuprum<V>, obs4$: Cuprum<W>, obs5$: Cuprum<X>, obs6$: Cuprum<Y>): Cuprum<[T, U, V, W, X, Y]>;
export declare function combine<T, U, V, W, X, Y, Z>(obs1$: Cuprum<T>, obs2$: Cuprum<U>, obs3$: Cuprum<V>, obs4$: Cuprum<W>, obs5$: Cuprum<X>, obs6$: Cuprum<Y>, obs7$: Cuprum<Z>): Cuprum<[T, U, V, W, X, Y, Z]>;
interface Subscription {
unsubscribe: () => void;
}
export {};
{
"name": "cuprum",
"version": "0.1.8",
"description": "Tiny state management library",
"main": "dist/bundle.common.min.js",
"module": "dist/bundle.min.js",
"types": "dist/cuprum.d.ts",
"sideEffects": false,
"scripts": {
"start": "http-server -o demo/ --silent",
"build": "rollup --config --sourcemap",
"dev": "rollup --config --sourcemap --watch",
"release": "npm i --package-lock && npm test && npm run build && npm publish",
"test": "karma start",
"lint": "npx eslint . --ext .js,.ts"
},
"repository": {
"type": "git",
"url": "git+https://github.com/edwinm/cuprum.git"
},
"files": [
"src/cuprum.ts",
"dist/cuprum.d.ts",
"dist/bundle.min.js",
"dist/bundle.min.js.map",
"dist/bundle.common.min.js",
"dist/bundle.common.min.js.map"
],
"author": {
"name": "Edwin Martin",
"email": "edwin@bitstorm.org",
"url": "https://bitstorm.org/"
},
"license": "MIT",
"bugs": {
"url": "https://github.com/edwinm/cuprum/issues"
},
"homepage": "https://github.com/edwinm/cuprum#readme",
"dependencies": {},
"devDependencies": {
"@types/mocha": "^7.0.2",
"@types/node": "^14.0.4",
"@typescript-eslint/eslint-plugin": "^3.0.2",
"@typescript-eslint/parser": "^3.0.2",
"eslint": "^7.1.0",
"eslint-config-prettier": "^6.11.0",
"http-server": "^0.12.3",
"husky": "^4.2.5",
"karma": "^5.0.9",
"karma-chai": "^0.1.0",
"karma-chrome-launcher": "^3.1.0",
"karma-coverage": "^2.0.2",
"karma-mocha": "^2.0.1",
"karma-typescript": "^5.0.3",
"mocha": "^7.2.0",
"prettier": "^2.0.5",
"pretty-quick": "^2.0.1",
"rollup": "^2.10.2",
"rollup-plugin-terser": "^5.3.0",
"rollup-plugin-typescript2": "^0.27.1",
"tslib": "^2.0.0",
"typescript": "^3.9.2"
},
"husky": {
"hooks": {
"pre-commit": "pretty-quick --staged"
}
"name": "cuprum",
"version": "0.1.9",
"description": "Tiny state management library",
"main": "dist/bundle.common.min.js",
"module": "dist/bundle.min.js",
"types": "dist/cuprum.d.ts",
"sideEffects": false,
"scripts": {
"start": "http-server -o demo/ --silent",
"build": "rollup --config --sourcemap",
"dev": "rollup --config --sourcemap --watch",
"release": "npm i --package-lock && npm test && npm run build && npm publish",
"test": "karma start",
"lint": "npx eslint . --ext .js,.ts"
},
"repository": {
"type": "git",
"url": "git+https://github.com/edwinm/cuprum.git"
},
"files": [
"src/cuprum.ts",
"dist/cuprum.d.ts",
"dist/bundle.min.js",
"dist/bundle.min.js.map",
"dist/bundle.common.min.js",
"dist/bundle.common.min.js.map"
],
"author": {
"name": "Edwin Martin",
"email": "edwin@bitstorm.org",
"url": "https://bitstorm.org/"
},
"license": "MIT",
"bugs": {
"url": "https://github.com/edwinm/cuprum/issues"
},
"homepage": "https://github.com/edwinm/cuprum#readme",
"dependencies": {},
"devDependencies": {
"@types/mocha": "^7.0.2",
"@types/node": "^14.0.4",
"@typescript-eslint/eslint-plugin": "^3.0.2",
"@typescript-eslint/parser": "^3.0.2",
"eslint": "^7.1.0",
"eslint-config-prettier": "^6.11.0",
"http-server": "^0.12.3",
"husky": "^4.2.5",
"karma": "^5.0.9",
"karma-chai": "^0.1.0",
"karma-chrome-launcher": "^3.1.0",
"karma-coverage": "^2.0.2",
"karma-mocha": "^2.0.1",
"karma-typescript": "^5.0.3",
"mocha": "^7.2.0",
"prettier": "^2.0.5",
"pretty-quick": "^2.0.1",
"rollup": "^2.10.2",
"rollup-plugin-terser": "^5.3.0",
"rollup-plugin-typescript2": "^0.27.1",
"tslib": "^2.0.0",
"typescript": "^3.9.2"
},
"husky": {
"hooks": {
"pre-commit": "pretty-quick --staged"
}
}
}

@@ -106,6 +106,2 @@ export class Cuprum<T> {

export class Subscription {
unsubscribe: () => void;
}
export function tap(fn: (val: any) => any) {

@@ -116,3 +112,2 @@ fn(this.val);

// TODO: 1st arg is string, then doc.querySelectAll
export function fromEvent(element, eventType) {

@@ -133,20 +128,58 @@ const obs$ = new Cuprum<Event>();

// TODO: combine with more than two arguments
export function combine<T, U>(obs1$: Cuprum<T>, obs2$: Cuprum<U>) {
const obs$ = new Cuprum<[T, U]>();
let sub1: Subscription;
let sub2: Subscription;
export function combine<T>(obs1$: Cuprum<T>): Cuprum<[T]>;
export function combine<T, U>(
obs1$: Cuprum<T>,
obs2$: Cuprum<U>
): Cuprum<[T, U]>;
export function combine<T, U, V>(
obs1$: Cuprum<T>,
obs2$: Cuprum<U>,
obs3$: Cuprum<V>
): Cuprum<[T, U, V]>;
export function combine<T, U, V, W>(
obs1$: Cuprum<T>,
obs2$: Cuprum<U>,
obs3$: Cuprum<V>,
obs4$: Cuprum<W>
): Cuprum<[T, U, V, W]>;
export function combine<T, U, V, W, X>(
obs1$: Cuprum<T>,
obs2$: Cuprum<U>,
obs3$: Cuprum<V>,
obs4$: Cuprum<W>,
obs5$: Cuprum<X>
): Cuprum<[T, U, V, W, X]>;
export function combine<T, U, V, W, X, Y>(
obs1$: Cuprum<T>,
obs2$: Cuprum<U>,
obs3$: Cuprum<V>,
obs4$: Cuprum<W>,
obs5$: Cuprum<X>,
obs6$: Cuprum<Y>
): Cuprum<[T, U, V, W, X, Y]>;
export function combine<T, U, V, W, X, Y, Z>(
obs1$: Cuprum<T>,
obs2$: Cuprum<U>,
obs3$: Cuprum<V>,
obs4$: Cuprum<W>,
obs5$: Cuprum<X>,
obs6$: Cuprum<Y>,
obs7$: Cuprum<Z>
): Cuprum<[T, U, V, W, X, Y, Z]>;
export function combine(...cuprumList: Cuprum<any>[]) {
const obs$ = new Cuprum();
const subs = new Set<Subscription>();
obs$.subscribeHot((hot) => {
if (hot) {
sub1 = obs1$.subscribe((val1) => {
obs$.dispatch([val1, obs2$.value()]);
cuprumList.forEach((obs) => {
subs.add(
obs.subscribe(() => {
obs$.dispatch(cuprumList.map((obs1) => obs1.value()));
})
);
});
sub2 = obs2$.subscribe((val2) => {
obs$.dispatch([obs1$.value(), val2]);
});
} else {
sub1.unsubscribe();
sub2.unsubscribe();
subs.forEach((sub) => sub.unsubscribe());
}

@@ -157,1 +190,5 @@ });

}
interface Subscription {
unsubscribe: () => void;
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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