@ghostry/finity-solidjs
Version:
Finite state management with exhaustiveness and transition enforcement for TypeScript.
2 lines • 2.57 kB
JavaScript
import*as t from"@ghostry/finity-core";import*as r from"solid-js";function e(t,r){(null==r||r>t.length)&&(r=t.length);for(var e=0,n=Array(r);e<r;e++)n[e]=t[e];return n}function n(t){return(n=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function o(t,r){return(o=Object.setPrototypeOf||function(t,r){return t.__proto__=r,t})(t,r)}function i(t,r){return function(t){if(Array.isArray(t))return t}(t)||function(t,r){var e,n,o=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=o){var i=[],u=!0,c=!1;try{for(o=o.call(t);!(u=(e=o.next()).done)&&(i.push(e.value),!r||i.length!==r);u=!0);}catch(t){c=!0,n=t}finally{try{u||null==o.return||o.return()}finally{if(c)throw n}}return i}}(t,r)||function(t,r){if(t){if("string"==typeof t)return e(t,r);var n=Object.prototype.toString.call(t).slice(8,-1);if("Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return e(t,r)}}(t,r)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function u(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(u=function(){return!!t})()}var c=function(t){"use strict";if("function"!=typeof t&&null!==t)throw TypeError("Super expression must either be null or a function");function e(){var t,o,c,a,f;if(!(this instanceof e))throw TypeError("Cannot call a class as a function");return o=e,c=arguments,o=n(o),a=t=function(t,r){var e;if(r&&("object"==((e=r)&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e)||"function"==typeof r))return r;if(void 0===t)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(this,u()?Reflect.construct(o,c||[],n(this).constructor):o.apply(this,c)),f=function(){(0,r.createEffect)(function(){var r=t.state(),e=t.cases.find(function(t){var e=i(t,2),n=e[0];return e[1],n.includes(r.kind)});if(e){var n=i(e,2);(n[0],n[1])(r)}else throw Error("[finity] Invalid state switch!")})},"use"in a?Object.defineProperty(a,"use",{value:f,enumerable:!0,configurable:!0,writable:!0}):a.use=f,t}return e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&o(e,t),e}(t.ExhaustiveSwitchInstance);function a(t){return function(t){return new c(t,[])}}export{a as default};
//# sourceMappingURL=useEffect.js.map