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

little-state-machine

Package Overview
Dependencies
Maintainers
1
Versions
210
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

little-state-machine - npm Package Compare versions

Comparing version 4.3.3-beta.5 to 4.3.3-beta.6

2

dist/little-state-machine.es.js

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

import*as e from"react";var t=function(){var e={name:"__LSM__",middleWares:[],storageType:{},persist:""},t={};try{e.storageType="undefined"!=typeof sessionStorage?window.sessionStorage:{}}catch(e){}return{updateStore:function(n){try{t=JSON.parse(e.storageType.getItem(e.name)||"")||n}catch(e){t=n}},saveStore:function(){e.storageType.setItem(e.name,JSON.stringify(t))},get state(){return t},set state(e){t=e},get options(){return e},set options(t){e=t}}}();function n(){return n=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},n.apply(this,arguments)}function o(e,o){o&&(t.options=n({},t.options,o)),"production"!==process.env.NODE_ENV&&"undefined"!=typeof window&&(window.__LSM_NAME__=t.options.name,window.__LSM_RESET__=function(){return t.options.storageType.removeItem(t.options.name)}),t.updateStore(e)}function r(n){var o=i(),r=o.state,s=o.setState,a=e.useRef(Object.entries(n||{}).reduce(function(e,n){var o;return Object.assign({},e,((o={})[n[0]]=function(e,n){return function(o){"production"!==process.env.NODE_ENV&&(window.__LSM_NAME__=n.name),t.state=n(t.state,o),t.options.middleWares&&(t.state=t.options.middleWares.reduce(function(e,t){return t(e,n.name,o)||e},t.state)),e(t.state),t.saveStore()}}(s,n[1]),o))},{}));return{actions:a.current,state:r}}var s=e.createContext(void 0),a=function(n){var o=n.children,r=e.useState(t.state),a=r[0],i=r[1];return e.useEffect(function(){"beforeUnload"===t.options.persist&&(window.onbeforeunload=function(){return t.saveStore()},t.options.storageType.removeItem(t.options.name))},["onAction"]),e.createElement(s.Provider,{value:{state:a,setState:i}},o)},i=function(){return e.useContext(s)};export{a as StateMachineProvider,o as createStore,r as useStateMachine};
import*as e from"react";var t=function(){var e={name:"__LSM__",middleWares:[],storageType:{},persist:""},t={};try{e.storageType="undefined"!=typeof sessionStorage?window.sessionStorage:{}}catch(e){}return{updateStore:function(n){try{t=JSON.parse(e.storageType.getItem(e.name)||"")||n}catch(e){t=n}},saveStore:function(){e.storageType.setItem(e.name,JSON.stringify(t))},get state(){return t},set state(e){t=e},get options(){return e},set options(t){e=t}}}(),n=e.createContext(void 0),o=function(o){var r=o.children,s=e.useState(t.state),a=s[0],i=s[1];return e.useEffect(function(){"beforeUnload"===t.options.persist&&(window.onbeforeunload=function(){return t.saveStore()},t.options.storageType.removeItem(t.options.name))},[]),e.createElement(n.Provider,{value:{state:a,setState:i}},r)};function r(){return r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},r.apply(this,arguments)}function s(e,n){n&&(t.options=r({},t.options,n)),"production"!==process.env.NODE_ENV&&"undefined"!=typeof window&&(window.__LSM_NAME__=t.options.name,window.__LSM_RESET__=function(){return t.options.storageType.removeItem(t.options.name)}),t.updateStore(e)}function a(o){var r=e.useContext(n),s=r.state,a=r.setState,i=e.useRef(Object.entries(o||{}).reduce(function(e,n){var o;return Object.assign({},e,((o={})[n[0]]=function(e,n){return function(o){"production"!==process.env.NODE_ENV&&(window.__LSM_NAME__=n.name),t.state=n(t.state,o),t.options.middleWares&&(t.state=t.options.middleWares.reduce(function(e,t){return t(e,n.name,o)||e},t.state)),e(t.state),"onAction"===t.options.persist&&t.saveStore()}}(a,n[1]),o))},{}));return{actions:i.current,state:s}}export{o as StateMachineProvider,s as createStore,a as useStateMachine};
//# sourceMappingURL=little-state-machine.es.js.map

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

function e(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach(function(r){if("default"!==r){var n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:function(){return e[r]}})}}),t.default=e,t}var t=/*#__PURE__*/e(require("react")),r=function(){var e={name:"__LSM__",middleWares:[],storageType:{},persist:""},t={};try{e.storageType="undefined"!=typeof sessionStorage?window.sessionStorage:{}}catch(e){}return{updateStore:function(r){try{t=JSON.parse(e.storageType.getItem(e.name)||"")||r}catch(e){t=r}},saveStore:function(){e.storageType.setItem(e.name,JSON.stringify(t))},get state(){return t},set state(e){t=e},get options(){return e},set options(t){e=t}}}();function n(){return n=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},n.apply(this,arguments)}var o=t.createContext(void 0);exports.StateMachineProvider=function(e){var n=e.children,a=t.useState(r.state),s=a[0],i=a[1];return t.useEffect(function(){"beforeUnload"===r.options.persist&&(window.onbeforeunload=function(){return r.saveStore()},r.options.storageType.removeItem(r.options.name))},["onAction"]),t.createElement(o.Provider,{value:{state:s,setState:i}},n)},exports.createStore=function(e,t){t&&(r.options=n({},r.options,t)),r.updateStore(e)},exports.useStateMachine=function(e){var n=t.useContext(o),a=n.state,s=n.setState,i=t.useRef(Object.entries(e||{}).reduce(function(e,t){var n;return Object.assign({},e,((n={})[t[0]]=function(e,t){return function(n){r.state=t(r.state,n),r.options.middleWares&&(r.state=r.options.middleWares.reduce(function(e,r){return r(e,t.name,n)||e},r.state)),e(r.state),r.saveStore()}}(s,t[1]),n))},{}));return{actions:i.current,state:a}};
function e(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach(function(r){if("default"!==r){var n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:function(){return e[r]}})}}),t.default=e,t}var t=/*#__PURE__*/e(require("react")),r=function(){var e={name:"__LSM__",middleWares:[],storageType:{},persist:""},t={};try{e.storageType="undefined"!=typeof sessionStorage?window.sessionStorage:{}}catch(e){}return{updateStore:function(r){try{t=JSON.parse(e.storageType.getItem(e.name)||"")||r}catch(e){t=r}},saveStore:function(){e.storageType.setItem(e.name,JSON.stringify(t))},get state(){return t},set state(e){t=e},get options(){return e},set options(t){e=t}}}(),n=t.createContext(void 0);function o(){return o=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},o.apply(this,arguments)}exports.StateMachineProvider=function(e){var o=e.children,s=t.useState(r.state),a=s[0],i=s[1];return t.useEffect(function(){"beforeUnload"===r.options.persist&&(window.onbeforeunload=function(){return r.saveStore()},r.options.storageType.removeItem(r.options.name))},[]),t.createElement(n.Provider,{value:{state:a,setState:i}},o)},exports.createStore=function(e,t){t&&(r.options=o({},r.options,t)),r.updateStore(e)},exports.useStateMachine=function(e){var o=t.useContext(n),s=o.state,a=o.setState,i=t.useRef(Object.entries(e||{}).reduce(function(e,t){var n;return Object.assign({},e,((n={})[t[0]]=function(e,t){return function(n){r.state=t(r.state,n),r.options.middleWares&&(r.state=r.options.middleWares.reduce(function(e,r){return r(e,t.name,n)||e},r.state)),e(r.state),"onAction"===r.options.persist&&r.saveStore()}}(a,t[1]),n))},{}));return{actions:i.current,state:s}};
//# sourceMappingURL=little-state-machine.js.map

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

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react")):"function"==typeof define&&define.amd?define(["exports","react"],t):t((e||self).littleStateMachine={},e.react)}(this,function(e,t){function n(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach(function(n){if("default"!==n){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})}}),t.default=e,t}var r=/*#__PURE__*/n(t),o=function(){var e={name:"__LSM__",middleWares:[],storageType:{},persist:""},t={};try{e.storageType="undefined"!=typeof sessionStorage?window.sessionStorage:{}}catch(e){}return{updateStore:function(n){try{t=JSON.parse(e.storageType.getItem(e.name)||"")||n}catch(e){t=n}},saveStore:function(){e.storageType.setItem(e.name,JSON.stringify(t))},get state(){return t},set state(e){t=e},get options(){return e},set options(t){e=t}}}();function a(){return a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},a.apply(this,arguments)}var s=r.createContext(void 0);e.StateMachineProvider=function(e){var t=e.children,n=r.useState(o.state),a=n[0],i=n[1];return r.useEffect(function(){"beforeUnload"===o.options.persist&&(window.onbeforeunload=function(){return o.saveStore()},o.options.storageType.removeItem(o.options.name))},["onAction"]),r.createElement(s.Provider,{value:{state:a,setState:i}},t)},e.createStore=function(e,t){t&&(o.options=a({},o.options,t)),o.updateStore(e)},e.useStateMachine=function(e){var t=r.useContext(s),n=t.state,a=t.setState,i=r.useRef(Object.entries(e||{}).reduce(function(e,t){var n;return Object.assign({},e,((n={})[t[0]]=function(e,t){return function(n){o.state=t(o.state,n),o.options.middleWares&&(o.state=o.options.middleWares.reduce(function(e,r){return r(e,t.name,n)||e},o.state)),e(o.state),o.saveStore()}}(a,t[1]),n))},{}));return{actions:i.current,state:n}}});
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react")):"function"==typeof define&&define.amd?define(["exports","react"],t):t((e||self).littleStateMachine={},e.react)}(this,function(e,t){function n(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach(function(n){if("default"!==n){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})}}),t.default=e,t}var r=/*#__PURE__*/n(t),o=function(){var e={name:"__LSM__",middleWares:[],storageType:{},persist:""},t={};try{e.storageType="undefined"!=typeof sessionStorage?window.sessionStorage:{}}catch(e){}return{updateStore:function(n){try{t=JSON.parse(e.storageType.getItem(e.name)||"")||n}catch(e){t=n}},saveStore:function(){e.storageType.setItem(e.name,JSON.stringify(t))},get state(){return t},set state(e){t=e},get options(){return e},set options(t){e=t}}}(),a=r.createContext(void 0);function s(){return s=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},s.apply(this,arguments)}e.StateMachineProvider=function(e){var t=e.children,n=r.useState(o.state),s=n[0],i=n[1];return r.useEffect(function(){"beforeUnload"===o.options.persist&&(window.onbeforeunload=function(){return o.saveStore()},o.options.storageType.removeItem(o.options.name))},[]),r.createElement(a.Provider,{value:{state:s,setState:i}},t)},e.createStore=function(e,t){t&&(o.options=s({},o.options,t)),o.updateStore(e)},e.useStateMachine=function(e){var t=r.useContext(a),n=t.state,s=t.setState,i=r.useRef(Object.entries(e||{}).reduce(function(e,t){var n;return Object.assign({},e,((n={})[t[0]]=function(e,t){return function(n){o.state=t(o.state,n),o.options.middleWares&&(o.state=o.options.middleWares.reduce(function(e,r){return r(e,t.name,n)||e},o.state)),e(o.state),"onAction"===o.options.persist&&o.saveStore()}}(s,t[1]),n))},{}));return{actions:i.current,state:n}}});
//# sourceMappingURL=little-state-machine.umd.js.map

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

import { StateMachineOptions, GlobalState, AnyCallback, AnyActions, ActionsOutput, PersistOptions } from './types';
export declare let persistOption: PersistOptions;
import { StateMachineOptions, GlobalState, AnyCallback, AnyActions, ActionsOutput } from './types';
export declare function createStore(defaultState: GlobalState, options?: StateMachineOptions): void;

@@ -4,0 +3,0 @@ export declare function useStateMachine<TCallback extends AnyCallback, TActions extends AnyActions<TCallback>>(actions?: TActions): {

@@ -8,3 +8,3 @@ {

],
"version": "4.3.3-beta.5",
"version": "4.3.3-beta.6",
"main": "dist/little-state-machine.js",

@@ -11,0 +11,0 @@ "module": "dist/little-state-machine.es.js",

Sorry, the diff of this file is not supported yet

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