callbag-state
Advanced tools
Comparing version 0.2.0 to 0.2.1
@@ -1,1 +0,1 @@ | ||
var callbagState=function(t){"use strict";function e(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function n(t){return!t||!t.subs}function i(t,e,i,a,r){var s;if(1===a){var u=r,o=u.value?u.value[t]:void 0;(n(u.trace)&&o!==e()||!n(u.trace)&&t in(null===(s=u.trace)||void 0===s?void 0:s.subs))&&i(1,{value:o,trace:n(u.trace)?void 0:u.trace.subs[t]})}else i(a,r)}function a(t,e,n){return function(a,r){0===a&&t(0,i.bind(null,e,n,r))}}function r(t,e,n){for(var i=n.slice(0),a=0;a<i.length;a++){var r=i[a];-1!==n.indexOf(r)&&r(t,e)}}function s(t){return null==t||"number"==typeof t||"string"==typeof t||"boolean"==typeof t||t instanceof Date}function u(t,e){if(t!==e){if(!s(t)&&!s(e)){var n={subs:{}},i=new Set,a=!1;for(var r in t){i.add(r);var o=u(t[r],e[r]);o&&(n.subs[r]=o,a=!0)}for(var f in e)i.has(f)||(n.subs[f]=u(t[f],e[f]),a=!0);return a?n:void 0}return t instanceof Date&&e instanceof Date&&+t!=+e||t!==e?{from:t,to:e}:void 0}}function o(t){if(n(t.trace)&&t.trace){var e=u(t.trace.from,t.trace.to);if(e)return{value:t.value,trace:e}}return t}function f(t,e,n){r(2,n,t),t.length=0,e&&e(2,n)}function c(){return this(100)}function l(t){this(1,t)}function v(){this(2)}function h(){return this(101)}function d(){return this(102)}function b(t){var n,i,r,s=y(this.get()?this.get()[t]:void 0,a(this.downstream(),t,(function(){return s.get()})),(n=this.upstream(),i=t,r=this.get(),function(t,a){if(1===t){var s=a;r&&(r[i]=s.value),n(1,{value:r,trace:{subs:e({},i,s.trace)}})}else 2===t&&a&&n(2,a)}));return s}function k(t,e){if(2===e){var n=this.sinks.indexOf(t);n>=0&&this.sinks.splice(n,1),0===this.sinks.length&&(f(this.sinks,this.talkback),this.talkback=void 0)}}function p(t,e){var n=this;if(0===t){var i=e;this.sinks.push(i),i(0,k.bind(this,i)),1===this.sinks.length&&this.downstream(0,(function(t,e){if(0===t)n.talkback=e;else if(1===t){var i=o(e);i.value!==n.value&&(n.value=i.value),r(1,i,n.sinks)}else 2===t&&(f(n.sinks,n.talkback,e),n.talkback=void 0)}))}}function g(t,e,n){0===e?(t(0,n),t(1,this.value)):1===e?t(1,n.value):2===e&&t(2,n)}function m(t,e,n){if(0===e){var i=n;t(0,g.bind(this,i))}else if(1===e)this.upstream(1,{value:n,trace:{from:this.value,to:n}});else if(2===e)this.upstream(2,n),f(this.sinks,this.talkback,n),this.talkback=void 0;else{if(100===e)return this.value;if(101===e)return t;if(102===e)return this.upstream}}function y(t,e,n){var i={sinks:[],value:t,talkback:void 0,downstream:e,upstream:n},a=p.bind(i),r=m.bind(i,a);return r.get=c,r.set=l,r.clear=v,r.downstream=h,r.upstream=d,r.sub=b,r}function w(t){var e,n=(e=void 0,function(t,n){0===t?e||(e=n)(0,(function(t){2===t&&(e=void 0)})):e&&(e(t,n),2===t&&(e=void 0))});return y(t,n,n)}return t._Data=1,t._End=2,t._Start=0,t.broadcast=r,t.change=function(t,e){var n=u(t,e);if(n)return{value:e,trace:n}},t.default=w,t.isLeaf=n,t.isState=function(t){return t&&"function"==typeof t&&2===t.length&&t.get&&"function"==typeof t.get&&0===t.get.length&&t.set&&"function"==typeof t.set&&1===t.set.length&&t.clear&&"function"==typeof t.clear&&0===t.clear.length&&t.downstream&&"function"==typeof t.downstream&&0===t.downstream.length&&t.upstream&&"function"==typeof t.upstream&&0===t.upstream.length&&t.sub&&"function"==typeof t.sub&&1===t.sub.length},t.makeState=y,t.postTrace=o,t.state=w,t.trace=u,Object.defineProperty(t,"__esModule",{value:!0}),t}({}); | ||
var callbagState=function(t){"use strict";function e(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function n(t){return!t||!t.subs}function i(t,e,i,a,r){var s;if(1===a){var u=r,o=u.value?u.value[t]:void 0;(n(u.trace)&&o!==e()||!n(u.trace)&&t in(null===(s=u.trace)||void 0===s?void 0:s.subs))&&i(1,{value:o,trace:n(u.trace)?void 0:u.trace.subs[t]})}else i(a,r)}function a(t,e,n){return function(a,r){0===a&&t(0,i.bind(null,e,n,r))}}function r(t,e,n){for(var i=n.slice(0),a=0;a<i.length;a++){var r=i[a];-1!==n.indexOf(r)&&r(t,e)}}function s(t){return null==t||"number"==typeof t||"string"==typeof t||"boolean"==typeof t||t instanceof Date}function u(t,e){if(t!==e){if(!s(t)&&!s(e)){var n={subs:{}},i=new Set,a=!1;for(var r in t){i.add(r);var o=u(t[r],e[r]);o&&(n.subs[r]=o,a=!0)}for(var f in e)i.has(f)||(n.subs[f]=u(t[f],e[f]),a=!0);return a?n:void 0}return t instanceof Date&&e instanceof Date&&+t!=+e||t!==e?{from:t,to:e}:void 0}}function o(t){if(n(t.trace)&&t.trace){var e=u(t.trace.from,t.trace.to);if(e)return{value:t.value,trace:e}}return t}function f(t,e,n){r(2,n,t),t.length=0,e&&e(2,n)}function c(){return this(100)}function l(t){this(1,t)}function v(){this(2)}function h(){return this(101)}function d(){return this(102)}function b(t){var n,i,r,s=y(this.get()?this.get()[t]:void 0,a(this.downstream(),t,(function(){return s.get()})),(n=this.upstream(),i=t,r=this.get(),function(t,a){if(1===t){var s=a;r&&(r[i]=s.value),n(1,{value:r,trace:{subs:e({},i,s.trace)}})}else 2===t&&a&&n(2,a)}));return s}function k(t,e){if(2===e){var n=this.sinks.indexOf(t);n>=0&&this.sinks.splice(n,1),0===this.sinks.length&&(f(this.sinks,this.talkback),this.talkback=void 0)}}function g(t,e){var n=this;if(0===t){var i=e;this.sinks.push(i),i(0,k.bind(this,i)),1===this.sinks.length&&this.downstream(0,(function(t,e){if(0===t)n.talkback=e;else if(1===t){var i=o(e);i.value!==n.value&&(n.value=i.value),r(1,i,n.sinks)}else 2===t&&(f(n.sinks,n.talkback,e),n.talkback=void 0)}))}}function p(t,e,n){0===e?(t(0,n),t(1,this.value)):1===e?t(1,n.value):2===e&&t(2,n)}function m(t,e,n){if(0===e){var i=n;t(0,p.bind(this,i))}else if(1===e)this.upstream(1,{value:n,trace:{from:this.value,to:n}}),0===this.sinks.length&&(this.value=n);else if(2===e)this.upstream(2,n),f(this.sinks,this.talkback,n),this.talkback=void 0;else{if(100===e)return this.value;if(101===e)return t;if(102===e)return this.upstream}}function y(t,e,n){var i={sinks:[],value:t,talkback:void 0,downstream:e,upstream:n},a=g.bind(i),r=m.bind(i,a);return r.get=c,r.set=l,r.clear=v,r.downstream=h,r.upstream=d,r.sub=b,r}function w(t){var e,n=(e=void 0,function(t,n){0===t?e||(e=n)(0,(function(t){2===t&&(e=void 0)})):e&&(e(t,n),2===t&&(e=void 0))});return y(t,n,n)}return t._Data=1,t._End=2,t._Start=0,t.broadcast=r,t.change=function(t,e){var n=u(t,e);if(n)return{value:e,trace:n}},t.default=w,t.isLeaf=n,t.isState=function(t){return t&&"function"==typeof t&&2===t.length&&t.get&&"function"==typeof t.get&&0===t.get.length&&t.set&&"function"==typeof t.set&&1===t.set.length&&t.clear&&"function"==typeof t.clear&&0===t.clear.length&&t.downstream&&"function"==typeof t.downstream&&0===t.downstream.length&&t.upstream&&"function"==typeof t.upstream&&0===t.upstream.length&&t.sub&&"function"==typeof t.sub&&1===t.sub.length},t.makeState=y,t.postTrace=o,t.state=w,t.trace=u,Object.defineProperty(t,"__esModule",{value:!0}),t}({}); |
@@ -1,1 +0,1 @@ | ||
var callbagState=function(t){"use strict";function e(t){return!t||!t.subs}function n(t,n,s,i,a){var u;if(1===i){const i=a,o=i.value?i.value[t]:void 0;(e(i.trace)&&o!==n()||!e(i.trace)&&t in(null===(u=i.trace)||void 0===u?void 0:u.subs))&&s(1,{value:o,trace:e(i.trace)?void 0:i.trace.subs[t]})}else s(i,a)}function s(t,e,s){return(i,a)=>{0===i&&t(0,n.bind(null,e,s,a))}}function i(t,e,n){const s=n.slice(0);for(let i=0;i<s.length;i++){const a=s[i];-1!==n.indexOf(a)&&a(t,e)}}function a(t){return null==t||"number"==typeof t||"string"==typeof t||"boolean"==typeof t||t instanceof Date}function u(t,e){if(t!==e){if(!a(t)&&!a(e)){const n={subs:{}},s=new Set;let i=!1;for(const a in t){s.add(a);const o=u(t[a],e[a]);o&&(n.subs[a]=o,i=!0)}for(const a in e)s.has(a)||(n.subs[a]=u(t[a],e[a]),i=!0);return i?n:void 0}return t instanceof Date&&e instanceof Date&&+t!=+e||t!==e?{from:t,to:e}:void 0}}function o(t){if(e(t.trace)&&t.trace){const e=u(t.trace.from,t.trace.to);if(e)return{value:t.value,trace:e}}return t}function r(t,e,n){i(2,n,t),t.length=0,e&&e(2,n)}function c(){return this(100)}function f(t){this(1,t)}function l(){this(2)}function h(){return this(101)}function v(){return this(102)}function d(t){const e=m(this.get()?this.get()[t]:void 0,s(this.downstream(),t,(()=>e.get())),(n=this.upstream(),i=t,a=this.get(),(t,e)=>{if(1===t){const t=e;a&&(a[i]=t.value),n(1,{value:a,trace:{subs:{[i]:t.trace}}})}else 2===t&&e&&n(2,e)}));var n,i,a;return e}function b(t,e){if(2===e){const e=this.sinks.indexOf(t);e>=0&&this.sinks.splice(e,1),0===this.sinks.length&&(r(this.sinks,this.talkback),this.talkback=void 0)}}function k(t,e){if(0===t){const t=e;this.sinks.push(t),t(0,b.bind(this,t)),1===this.sinks.length&&this.downstream(0,((t,e)=>{if(0===t)this.talkback=e;else if(1===t){const t=o(e);t.value!==this.value&&(this.value=t.value),i(1,t,this.sinks)}else 2===t&&(r(this.sinks,this.talkback,e),this.talkback=void 0)}))}}function p(t,e,n){0===e?(t(0,n),t(1,this.value)):1===e?t(1,n.value):2===e&&t(2,n)}function g(t,e,n){if(0===e){const e=n;t(0,p.bind(this,e))}else if(1===e)this.upstream(1,{value:n,trace:{from:this.value,to:n}});else if(2===e)this.upstream(2,n),r(this.sinks,this.talkback,n),this.talkback=void 0;else{if(100===e)return this.value;if(101===e)return t;if(102===e)return this.upstream}}function m(t,e,n){const s={sinks:[],value:t,talkback:void 0,downstream:e,upstream:n},i=k.bind(s),a=g.bind(s,i);return a.get=c,a.set=f,a.clear=l,a.downstream=h,a.upstream=v,a.sub=d,a}function y(t){const e=function(){let t=void 0;return(e,n)=>{0===e?t||(t=n,t(0,(e=>{2===e&&(t=void 0)}))):t&&(t(e,n),2===e&&(t=void 0))}}();return m(t,e,e)}return t._Data=1,t._End=2,t._Start=0,t.broadcast=i,t.change=function(t,e){const n=u(t,e);if(n)return{value:e,trace:n}},t.default=y,t.isLeaf=e,t.isState=function(t){return t&&"function"==typeof t&&2===t.length&&t.get&&"function"==typeof t.get&&0===t.get.length&&t.set&&"function"==typeof t.set&&1===t.set.length&&t.clear&&"function"==typeof t.clear&&0===t.clear.length&&t.downstream&&"function"==typeof t.downstream&&0===t.downstream.length&&t.upstream&&"function"==typeof t.upstream&&0===t.upstream.length&&t.sub&&"function"==typeof t.sub&&1===t.sub.length},t.makeState=m,t.postTrace=o,t.state=y,t.trace=u,Object.defineProperty(t,"__esModule",{value:!0}),t}({}); | ||
var callbagState=function(t){"use strict";function e(t){return!t||!t.subs}function n(t,n,s,i,a){var u;if(1===i){const i=a,o=i.value?i.value[t]:void 0;(e(i.trace)&&o!==n()||!e(i.trace)&&t in(null===(u=i.trace)||void 0===u?void 0:u.subs))&&s(1,{value:o,trace:e(i.trace)?void 0:i.trace.subs[t]})}else s(i,a)}function s(t,e,s){return(i,a)=>{0===i&&t(0,n.bind(null,e,s,a))}}function i(t,e,n){const s=n.slice(0);for(let i=0;i<s.length;i++){const a=s[i];-1!==n.indexOf(a)&&a(t,e)}}function a(t){return null==t||"number"==typeof t||"string"==typeof t||"boolean"==typeof t||t instanceof Date}function u(t,e){if(t!==e){if(!a(t)&&!a(e)){const n={subs:{}},s=new Set;let i=!1;for(const a in t){s.add(a);const o=u(t[a],e[a]);o&&(n.subs[a]=o,i=!0)}for(const a in e)s.has(a)||(n.subs[a]=u(t[a],e[a]),i=!0);return i?n:void 0}return t instanceof Date&&e instanceof Date&&+t!=+e||t!==e?{from:t,to:e}:void 0}}function o(t){if(e(t.trace)&&t.trace){const e=u(t.trace.from,t.trace.to);if(e)return{value:t.value,trace:e}}return t}function r(t,e,n){i(2,n,t),t.length=0,e&&e(2,n)}function c(){return this(100)}function f(t){this(1,t)}function l(){this(2)}function h(){return this(101)}function v(){return this(102)}function d(t){const e=m(this.get()?this.get()[t]:void 0,s(this.downstream(),t,(()=>e.get())),(n=this.upstream(),i=t,a=this.get(),(t,e)=>{if(1===t){const t=e;a&&(a[i]=t.value),n(1,{value:a,trace:{subs:{[i]:t.trace}}})}else 2===t&&e&&n(2,e)}));var n,i,a;return e}function b(t,e){if(2===e){const e=this.sinks.indexOf(t);e>=0&&this.sinks.splice(e,1),0===this.sinks.length&&(r(this.sinks,this.talkback),this.talkback=void 0)}}function k(t,e){if(0===t){const t=e;this.sinks.push(t),t(0,b.bind(this,t)),1===this.sinks.length&&this.downstream(0,((t,e)=>{if(0===t)this.talkback=e;else if(1===t){const t=o(e);t.value!==this.value&&(this.value=t.value),i(1,t,this.sinks)}else 2===t&&(r(this.sinks,this.talkback,e),this.talkback=void 0)}))}}function g(t,e,n){0===e?(t(0,n),t(1,this.value)):1===e?t(1,n.value):2===e&&t(2,n)}function p(t,e,n){if(0===e){const e=n;t(0,g.bind(this,e))}else if(1===e)this.upstream(1,{value:n,trace:{from:this.value,to:n}}),0===this.sinks.length&&(this.value=n);else if(2===e)this.upstream(2,n),r(this.sinks,this.talkback,n),this.talkback=void 0;else{if(100===e)return this.value;if(101===e)return t;if(102===e)return this.upstream}}function m(t,e,n){const s={sinks:[],value:t,talkback:void 0,downstream:e,upstream:n},i=k.bind(s),a=p.bind(s,i);return a.get=c,a.set=f,a.clear=l,a.downstream=h,a.upstream=v,a.sub=d,a}function y(t){const e=function(){let t=void 0;return(e,n)=>{0===e?t||(t=n,t(0,(e=>{2===e&&(t=void 0)}))):t&&(t(e,n),2===e&&(t=void 0))}}();return m(t,e,e)}return t._Data=1,t._End=2,t._Start=0,t.broadcast=i,t.change=function(t,e){const n=u(t,e);if(n)return{value:e,trace:n}},t.default=y,t.isLeaf=e,t.isState=function(t){return t&&"function"==typeof t&&2===t.length&&t.get&&"function"==typeof t.get&&0===t.get.length&&t.set&&"function"==typeof t.set&&1===t.set.length&&t.clear&&"function"==typeof t.clear&&0===t.clear.length&&t.downstream&&"function"==typeof t.downstream&&0===t.downstream.length&&t.upstream&&"function"==typeof t.upstream&&0===t.upstream.length&&t.sub&&"function"==typeof t.sub&&1===t.sub.length},t.makeState=m,t.postTrace=o,t.state=y,t.trace=u,Object.defineProperty(t,"__esModule",{value:!0}),t}({}); |
@@ -84,2 +84,5 @@ "use strict"; | ||
this.upstream(types_1._Data, { value: m, trace: { from: this.value, to: m } }); | ||
if (this.sinks.length === 0) { | ||
this.value = m; | ||
} | ||
} | ||
@@ -86,0 +89,0 @@ else if (type === types_1._End) { |
@@ -80,2 +80,5 @@ import { subDownstream, subUpstream } from './substream'; | ||
this.upstream(_Data, { value: m, trace: { from: this.value, to: m } }); | ||
if (this.sinks.length === 0) { | ||
this.value = m; | ||
} | ||
} | ||
@@ -82,0 +85,0 @@ else if (type === _End) { |
{ | ||
"name": "callbag-state", | ||
"version": "0.2.0", | ||
"version": "0.2.1", | ||
"description": "Callbag-based State Management", | ||
@@ -53,3 +53,3 @@ "main": "dist/es5/index.js", | ||
"@types/webpack": "^4.41.24", | ||
"@types/estree": "0.0.45", | ||
"@types/estree": "^0.0.45", | ||
"callbag-behavior-subject": "^1.2.0", | ||
@@ -56,0 +56,0 @@ "callbag-interval": "^1.1.0", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
74503
778