callbag-state
Advanced tools
Comparing version 0.1.4 to 0.1.5
@@ -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 function(t){if(Array.isArray(t))return r(t)}(t)||function(t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t))return Array.from(t)}(t)||function(t,e){if(!t)return;if("string"==typeof t)return r(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return r(t,e)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function r(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function o(t){return!t||!t.subs}function u(t,e,r){n(r).forEach((function(n){r.indexOf(n)>=0&&n(t,e)}))}function i(t){return null==t||"number"==typeof t||"string"==typeof t||"boolean"==typeof t||t instanceof Date}function a(t,e){if(t!==e){if(!i(t)&&!i(e)){var n={subs:{}},r=new Set,o=!1;for(var u in t){r.add(u);var f=a(t[u],e[u]);f&&(n.subs[u]=f,o=!0)}for(var c in e)r.has(c)||(n.subs[c]=a(t[c],e[c]),o=!0);return o?n:void 0}return t instanceof Date&&e instanceof Date&&+t!=+e||t!==e?{from:t,to:e}:void 0}}function f(t){if(o(t.trace)&&t.trace){var e=a(t.trace.from,t.trace.to);if(e)return{value:t.value,trace:e}}return t}function c(t,n,r){var i=[],a=t,l=void 0,s=function(t){u(2,t,i),i.length=0,l=void 0},v=function(t,e){if(0===t){var r=e;i.push(r),r(0,(function(t){if(2===t){var e=i.indexOf(r);e>=0&&i.splice(e,1),0===i.length&&l&&l(2)}})),1===i.length&&n(0,(function(t,e){if(0===t)l=e;else if(1===t){var n=f(e);n.value!==a&&(a=n.value),u(1,n,i)}else 2===t&&s(e)}))}},d=function(t,e){if(0===t){var n=e;v(0,(function(t,e){0===t?(n(0,e),n(1,a)):1===t?n(1,e.value):2===t&&n(2,e)}))}else 1===t?r(1,{value:e,trace:{from:a,to:e}}):2===t&&(r(2,e),s(e))};return d.get=function(){return a},d.set=function(t){return d(1,t)},d.clear=function(){return d(2)},d.downstream=function(){return v},d.upstream=function(){return r},d.sub=function(t){var n,u,i,f=c(a?a[t]:void 0,(n=v,u=t,i=function(){return f.get()},function(t,e){if(0===t){var r=void 0;n(0,(function(t,n){var a;if(0===t)r=n;else if(1===t){var f=n,c=f.value?f.value[u]:void 0;(o(f.trace)&&c!==i()||!o(f.trace)&&u in(null===(a=f.trace)||void 0===a?void 0:a.subs))&&e(1,{value:c,trace:o(f.trace)?void 0:f.trace.subs[u]})}else 2===t&&e(2,n)})),e(0,(function(t,e){r&&r(t,e)}))}}),function(t,n,r){return function(o,u){if(1===o){var i=u;r&&(r[n]=i.value),t(1,{value:r,trace:{subs:e({},n,i.trace)}})}else 2===o&&u&&t(2,u)}}(r,t,a));return f},d}function l(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 c(t,n,n)}return t.change=function(t,e){var n=a(t,e);if(n)return{value:e,trace:n}},t.default=l,t.isLeaf=o,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=c,t.postTrace=f,t.state=l,t.trace=a,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 function(t){if(Array.isArray(t))return r(t)}(t)||function(t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t))return Array.from(t)}(t)||function(t,e){if(!t)return;if("string"==typeof t)return r(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return r(t,e)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function r(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function o(t){return!t||!t.subs}function u(t,e,r){n(r).forEach((function(n){r.indexOf(n)>=0&&n(t,e)}))}function a(t){return null==t||"number"==typeof t||"string"==typeof t||"boolean"==typeof t||t instanceof Date}function i(t,e){if(t!==e){if(!a(t)&&!a(e)){var n={subs:{}},r=new Set,o=!1;for(var u in t){r.add(u);var f=i(t[u],e[u]);f&&(n.subs[u]=f,o=!0)}for(var c in e)r.has(c)||(n.subs[c]=i(t[c],e[c]),o=!0);return o?n:void 0}return t instanceof Date&&e instanceof Date&&+t!=+e||t!==e?{from:t,to:e}:void 0}}function f(t){if(o(t.trace)&&t.trace){var e=i(t.trace.from,t.trace.to);if(e)return{value:t.value,trace:e}}return t}function c(t,n,r){var a=[],i=t,s=void 0,l=function(t){u(2,t,a),a.length=0,s=void 0},v=function(t,e){if(0===t){var r=e;a.push(r),r(0,(function(t){if(2===t){var e=a.indexOf(r);e>=0&&a.splice(e,1),0===a.length&&s&&s(2)}})),1===a.length&&n(0,(function(t,e){if(0===t)s=e;else if(1===t){var n=f(e);n.value!==i&&(i=n.value),u(1,n,a)}else 2===t&&l(e)}))}},d=function(t,e){if(0===t){var n=e;v(0,(function(t,e){0===t?(n(0,e),n(1,i)):1===t?n(1,e.value):2===t&&n(2,e)}))}else 1===t?r(1,{value:e,trace:{from:i,to:e}}):2===t&&(r(2,e),l(e))};return d.get=function(){return i},d.set=function(t){return d(1,t)},d.clear=function(){return d(2)},d.downstream=function(){return v},d.upstream=function(){return r},d.sub=function(t){var n,u,a,f=c(i?i[t]:void 0,(n=v,u=t,a=function(){return f.get()},function(t,e){if(0===t){var r=void 0;n(0,(function(t,n){var i;if(0===t)r=n;else if(1===t){var f=n,c=f.value?f.value[u]:void 0;(o(f.trace)&&c!==a()||!o(f.trace)&&u in(null===(i=f.trace)||void 0===i?void 0:i.subs))&&e(1,{value:c,trace:o(f.trace)?void 0:f.trace.subs[u]})}else 2===t&&e(2,n)})),e(0,(function(t,e){r&&r(t,e)}))}}),function(t,n,r){return function(o,u){if(1===o){var a=u;r&&(r[n]=a.value),t(1,{value:r,trace:{subs:e({},n,a.trace)}})}else 2===o&&u&&t(2,u)}}(r,t,i));return f},d}function s(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 c(t,n,n)}return t._Data=1,t._End=2,t._Start=0,t.broadcast=u,t.change=function(t,e){var n=i(t,e);if(n)return{value:e,trace:n}},t.default=s,t.isLeaf=o,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=c,t.postTrace=f,t.state=s,t.trace=i,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,e,n){[...n].forEach((o=>{n.indexOf(o)>=0&&o(t,e)}))}function o(t){return null==t||"number"==typeof t||"string"==typeof t||"boolean"==typeof t||t instanceof Date}function r(t,e){if(t!==e){if(!o(t)&&!o(e)){const n={subs:{}},o=new Set;let u=!1;for(const s in t){o.add(s);const a=r(t[s],e[s]);a&&(n.subs[s]=a,u=!0)}for(const s in e)o.has(s)||(n.subs[s]=r(t[s],e[s]),u=!0);return u?n:void 0}return t instanceof Date&&e instanceof Date&&+t!=+e||t!==e?{from:t,to:e}:void 0}}function u(t){if(e(t.trace)&&t.trace){const e=r(t.trace.from,t.trace.to);if(e)return{value:t.value,trace:e}}return t}function s(t,o,r){const a=[];let c=t,i=void 0;const f=t=>{n(2,t,a),a.length=0,i=void 0},l=(t,e)=>{if(0===t){const t=e;a.push(t),t(0,(e=>{if(2===e){const e=a.indexOf(t);e>=0&&a.splice(e,1),0===a.length&&i&&i(2)}})),1===a.length&&o(0,((t,e)=>{if(0===t)i=e;else if(1===t){const t=u(e);t.value!==c&&(c=t.value),n(1,t,a)}else 2===t&&f(e)}))}},v=(t,e)=>{if(0===t){const t=e;l(0,((e,n)=>{0===e?(t(0,n),t(1,c)):1===e?t(1,n.value):2===e&&t(2,n)}))}else 1===t?r(1,{value:e,trace:{from:c,to:e}}):2===t&&(r(2,e),f(e))};return v.get=()=>c,v.set=t=>v(1,t),v.clear=()=>v(2),v.downstream=()=>l,v.upstream=()=>r,v.sub=t=>{const n=s(c?c[t]:void 0,(o=l,u=t,a=()=>n.get(),(t,n)=>{if(0!==t)return;let r=void 0;o(0,((t,o)=>{var s;if(0===t)r=o;else if(1===t){const t=o,r=t.value?t.value[u]:void 0;(e(t.trace)&&r!==a()||!e(t.trace)&&u in(null===(s=t.trace)||void 0===s?void 0:s.subs))&&n(1,{value:r,trace:e(t.trace)?void 0:t.trace.subs[u]})}else 2===t&&n(2,o)})),n(0,((t,e)=>{r&&r(t,e)}))}),function(t,e,n){return(o,r)=>{if(1===o){const o=r;n&&(n[e]=o.value),t(1,{value:n,trace:{subs:{[e]:o.trace}}})}else 2===o&&r&&t(2,r)}}(r,t,c));var o,u,a;return n},v}function a(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 s(t,e,e)}return t.change=function(t,e){const n=r(t,e);if(n)return{value:e,trace:n}},t.default=a,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=s,t.postTrace=u,t.state=a,t.trace=r,Object.defineProperty(t,"__esModule",{value:!0}),t}({}); | ||
var callbagState=function(t){"use strict";function e(t){return!t||!t.subs}function n(t,e,n){[...n].forEach((o=>{n.indexOf(o)>=0&&o(t,e)}))}function o(t){return null==t||"number"==typeof t||"string"==typeof t||"boolean"==typeof t||t instanceof Date}function r(t,e){if(t!==e){if(!o(t)&&!o(e)){const n={subs:{}},o=new Set;let a=!1;for(const u in t){o.add(u);const s=r(t[u],e[u]);s&&(n.subs[u]=s,a=!0)}for(const u in e)o.has(u)||(n.subs[u]=r(t[u],e[u]),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 a(t){if(e(t.trace)&&t.trace){const e=r(t.trace.from,t.trace.to);if(e)return{value:t.value,trace:e}}return t}function u(t,o,r){const s=[];let c=t,i=void 0;const f=t=>{n(2,t,s),s.length=0,i=void 0},l=(t,e)=>{if(0===t){const t=e;s.push(t),t(0,(e=>{if(2===e){const e=s.indexOf(t);e>=0&&s.splice(e,1),0===s.length&&i&&i(2)}})),1===s.length&&o(0,((t,e)=>{if(0===t)i=e;else if(1===t){const t=a(e);t.value!==c&&(c=t.value),n(1,t,s)}else 2===t&&f(e)}))}},v=(t,e)=>{if(0===t){const t=e;l(0,((e,n)=>{0===e?(t(0,n),t(1,c)):1===e?t(1,n.value):2===e&&t(2,n)}))}else 1===t?r(1,{value:e,trace:{from:c,to:e}}):2===t&&(r(2,e),f(e))};return v.get=()=>c,v.set=t=>v(1,t),v.clear=()=>v(2),v.downstream=()=>l,v.upstream=()=>r,v.sub=t=>{const n=u(c?c[t]:void 0,(o=l,a=t,s=()=>n.get(),(t,n)=>{if(0!==t)return;let r=void 0;o(0,((t,o)=>{var u;if(0===t)r=o;else if(1===t){const t=o,r=t.value?t.value[a]:void 0;(e(t.trace)&&r!==s()||!e(t.trace)&&a in(null===(u=t.trace)||void 0===u?void 0:u.subs))&&n(1,{value:r,trace:e(t.trace)?void 0:t.trace.subs[a]})}else 2===t&&n(2,o)})),n(0,((t,e)=>{r&&r(t,e)}))}),function(t,e,n){return(o,r)=>{if(1===o){const o=r;n&&(n[e]=o.value),t(1,{value:n,trace:{subs:{[e]:o.trace}}})}else 2===o&&r&&t(2,r)}}(r,t,c));var o,a,s;return n},v}function s(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 u(t,e,e)}return t._Data=1,t._End=2,t._Start=0,t.broadcast=n,t.change=function(t,e){const n=r(t,e);if(n)return{value:e,trace:n}},t.default=s,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=u,t.postTrace=a,t.state=s,t.trace=r,Object.defineProperty(t,"__esModule",{value:!0}),t}({}); |
export { makeState } from './state'; | ||
export { trace, change, postTrace } from './trace'; | ||
export { Change, ChangeTrace, ChangeTraceLeaf, ChangeTraceNode, isLeaf, Downstream, Upstream, State, isState, SubState, } from './types'; | ||
export { Change, ChangeTrace, ChangeTraceLeaf, ChangeTraceNode, isLeaf, Downstream, Upstream, State, isState, SubState, MsgType, _Start, _Data, _End, } from './types'; | ||
export { broadcast } from './util/broadcast'; | ||
export declare function state<T>(t: T): import("./types").State<T>; | ||
export default state; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.state = exports.isState = exports.isLeaf = exports.postTrace = exports.change = exports.trace = exports.makeState = void 0; | ||
exports.state = exports.broadcast = exports._End = exports._Data = exports._Start = exports.isState = exports.isLeaf = exports.postTrace = exports.change = exports.trace = exports.makeState = void 0; | ||
var state_1 = require("./state"); | ||
@@ -13,2 +13,7 @@ Object.defineProperty(exports, "makeState", { enumerable: true, get: function () { return state_1.makeState; } }); | ||
Object.defineProperty(exports, "isState", { enumerable: true, get: function () { return types_1.isState; } }); | ||
Object.defineProperty(exports, "_Start", { enumerable: true, get: function () { return types_1._Start; } }); | ||
Object.defineProperty(exports, "_Data", { enumerable: true, get: function () { return types_1._Data; } }); | ||
Object.defineProperty(exports, "_End", { enumerable: true, get: function () { return types_1._End; } }); | ||
var broadcast_1 = require("./util/broadcast"); | ||
Object.defineProperty(exports, "broadcast", { enumerable: true, get: function () { return broadcast_1.broadcast; } }); | ||
var state_2 = require("./state"); | ||
@@ -15,0 +20,0 @@ var bouncer_1 = require("./util/bouncer"); |
export { makeState } from './state'; | ||
export { trace, change, postTrace } from './trace'; | ||
export { Change, ChangeTrace, ChangeTraceLeaf, ChangeTraceNode, isLeaf, Downstream, Upstream, State, isState, SubState, } from './types'; | ||
export { Change, ChangeTrace, ChangeTraceLeaf, ChangeTraceNode, isLeaf, Downstream, Upstream, State, isState, SubState, MsgType, _Start, _Data, _End, } from './types'; | ||
export { broadcast } from './util/broadcast'; | ||
export declare function state<T>(t: T): import("./types").State<T>; | ||
export default state; |
export { makeState } from './state'; | ||
export { trace, change, postTrace } from './trace'; | ||
export { isLeaf, isState, } from './types'; | ||
export { isLeaf, isState, _Start, _Data, _End, } from './types'; | ||
export { broadcast } from './util/broadcast'; | ||
import { makeState } from './state'; | ||
@@ -5,0 +6,0 @@ import { bouncer } from './util/bouncer'; |
{ | ||
"name": "callbag-state", | ||
"version": "0.1.4", | ||
"version": "0.1.5", | ||
"description": "Callbag-based State Management", | ||
@@ -5,0 +5,0 @@ "main": "dist/es5/index.js", |
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
77028
854