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.2.0 to 4.2.1

2

dist/little-state-machine.es.js

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

import{createContext as e,useState as t,createElement as n,useContext as r,useRef as o,useEffect as a}from"react";var i=function(){var e,t={},n=[],r="__LSM__";try{e="undefined"!=typeof sessionStorage?window.sessionStorage:{}}catch(t){e={}}return{updateStore:function(n){try{t=JSON.parse(e.getItem(r)||"")||n}catch(e){t=n}},saveStore:function(){e.setItem(r,JSON.stringify(t))},get middleWares(){return n},set middleWares(e){n=e},get state(){return t},set state(e){t=e},get name(){return r},set name(e){r=e},get storageType(){return e},set storageType(t){e=t}}}(),s=e(void 0),_=function(e){var r=e.children,o=t(i.state);return n(s.Provider,{value:{state:o[0],setState:o[1]}},r)},d="onAction";function u(e,t){var n,r,o;t&&(t.name&&(i.name=t.name),t.storageType&&(i.storageType=t.storageType),t.middleWares&&(i.middleWares=t.middleWares),t.persist&&(d=t.persist)),"production"!==process.env.NODE_ENV&&(n=i.storageType,r=i.name,o=i.state,"undefined"!=typeof window&&(window.__LSM__=r,window.__LSM_NAME__=r,window.__LSM_DEBUG__=function(e){return n.setItem("___LSM_DEBUG__",e)},window.__LSM_RESET__=function(){return n.removeItem(r)},window.__LSM_GET_STORE__=function(){return n.getItem(r)},window.__LSM_SAVE_TO__=function(e){return window.localStorage.setItem(e,JSON.stringify(o))},window.__LSM_LOAD__=function(e){return n.setItem(r||"___LSM_DEBUG__",e.data||window.localStorage.getItem(e.storeName)||"")})),i.updateStore(e)}function c(e){var t,n=(t=r(s),"production"!==process.env.NODE_ENV&&(t||console.error("StateMachine context is undefined, please verify you are calling useStateMachine() as child of a <StateMachineProvider> component.")),t),_=n.state,u=n.setState,c=o(Object.entries(e||{}).reduce(function(e,t){var n;return Object.assign({},e,((n={})[t[0]]=function(e,t){return function(n){"production"!==process.env.NODE_ENV&&(window.__LSM_NAME__=t.name),i.state=t(i.state,n),i.middleWares&&(i.state=i.middleWares.reduce(function(e,r){return r(e,t.name,n)||e},i.state)),e(i.state),"onAction"===d&&i.saveStore()}}(u,t[1]),n))},{}));return a(function(){"beforeUnload"===d&&(window.onbeforeunload=function(){return i.saveStore()})},[]),{actions:c.current,state:_}}export{_ as StateMachineProvider,u as createStore,c as useStateMachine};
import*as e from"react";var t=function(){var e,t={},n=[],r="__LSM__";try{e="undefined"!=typeof sessionStorage?window.sessionStorage:{}}catch(t){e={}}return{updateStore:function(n){try{t=JSON.parse(e.getItem(r)||"")||n}catch(e){t=n}},saveStore:function(){e.setItem(r,JSON.stringify(t))},get middleWares(){return n},set middleWares(e){n=e},get state(){return t},set state(e){t=e},get name(){return r},set name(e){r=e},get storageType(){return e},set storageType(t){e=t}}}(),n=e.createContext(void 0),r=function(r){var o=r.children,s=e.useState(t.state);return e.createElement(n.Provider,{value:{state:s[0],setState:s[1]}},o)},o="onAction";function s(e,n){n&&(n.name&&(t.name=n.name),n.storageType&&(t.storageType=n.storageType),n.middleWares&&(t.middleWares=n.middleWares),n.persist&&(o=n.persist)),"production"!==process.env.NODE_ENV&&"undefined"!=typeof window&&(window.__LSM_NAME__=t.name,window.__LSM_RESET__=function(){return t.storageType.removeItem(t.name)}),t.updateStore(e)}function a(r){var s,a=(s=e.useContext(n),"production"!==process.env.NODE_ENV&&(s||console.error("LSM context is undefined.")),s),i=a.state,u=a.setState,c=e.useRef(Object.entries(r||{}).reduce(function(e,n){var r;return Object.assign({},e,((r={})[n[0]]=function(e,n){return function(r){"production"!==process.env.NODE_ENV&&(window.__LSM_NAME__=n.name),t.state=n(t.state,r),t.middleWares&&(t.state=t.middleWares.reduce(function(e,t){return t(e,n.name,r)||e},t.state)),e(t.state),"onAction"===o&&t.saveStore()}}(u,n[1]),r))},{}));return e.useEffect(function(){"beforeUnload"===o&&(window.onbeforeunload=function(){return t.saveStore()})},[]),{actions:c.current,state:i}}export{r as StateMachineProvider,s as createStore,a as useStateMachine};
//# sourceMappingURL=little-state-machine.es.js.map

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

var e=require("react"),t=function(){var e,t={},r=[],n="__LSM__";try{e="undefined"!=typeof sessionStorage?window.sessionStorage:{}}catch(t){e={}}return{updateStore:function(r){try{t=JSON.parse(e.getItem(n)||"")||r}catch(e){t=r}},saveStore:function(){e.setItem(n,JSON.stringify(t))},get middleWares(){return r},set middleWares(e){r=e},get state(){return t},set state(e){t=e},get name(){return n},set name(e){n=e},get storageType(){return e},set storageType(t){e=t}}}(),r=e.createContext(void 0),n="onAction";exports.StateMachineProvider=function(n){var a=n.children,s=e.useState(t.state);return e.createElement(r.Provider,{value:{state:s[0],setState:s[1]}},a)},exports.createStore=function(e,r){r&&(r.name&&(t.name=r.name),r.storageType&&(t.storageType=r.storageType),r.middleWares&&(t.middleWares=r.middleWares),r.persist&&(n=r.persist)),t.updateStore(e)},exports.useStateMachine=function(a){var s=e.useContext(r),o=s.state,i=s.setState,u=e.useRef(Object.entries(a||{}).reduce(function(e,r){var a;return Object.assign({},e,((a={})[r[0]]=function(e,r){return function(a){t.state=r(t.state,a),t.middleWares&&(t.state=t.middleWares.reduce(function(e,t){return t(e,r.name,a)||e},t.state)),e(t.state),"onAction"===n&&t.saveStore()}}(i,r[1]),a))},{}));return e.useEffect(function(){"beforeUnload"===n&&(window.onbeforeunload=function(){return t.saveStore()})},[]),{actions:u.current,state:o}};
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,t={},r=[],n="__LSM__";try{e="undefined"!=typeof sessionStorage?window.sessionStorage:{}}catch(t){e={}}return{updateStore:function(r){try{t=JSON.parse(e.getItem(n)||"")||r}catch(e){t=r}},saveStore:function(){e.setItem(n,JSON.stringify(t))},get middleWares(){return r},set middleWares(e){r=e},get state(){return t},set state(e){t=e},get name(){return n},set name(e){n=e},get storageType(){return e},set storageType(t){e=t}}}(),n=t.createContext(void 0),a="onAction";exports.StateMachineProvider=function(e){var a=e.children,s=t.useState(r.state);return t.createElement(n.Provider,{value:{state:s[0],setState:s[1]}},a)},exports.createStore=function(e,t){t&&(t.name&&(r.name=t.name),t.storageType&&(r.storageType=t.storageType),t.middleWares&&(r.middleWares=t.middleWares),t.persist&&(a=t.persist)),r.updateStore(e)},exports.useStateMachine=function(e){var s=t.useContext(n),o=s.state,u=s.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.middleWares&&(r.state=r.middleWares.reduce(function(e,r){return r(e,t.name,n)||e},r.state)),e(r.state),"onAction"===a&&r.saveStore()}}(u,t[1]),n))},{}));return t.useEffect(function(){"beforeUnload"===a&&(window.onbeforeunload=function(){return r.saveStore()})},[]),{actions:i.current,state:o}};
//# 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=e||self).littleStateMachine={},e.react)}(this,function(e,t){var n=function(){var e,t={},n=[],r="__LSM__";try{e="undefined"!=typeof sessionStorage?window.sessionStorage:{}}catch(t){e={}}return{updateStore:function(n){try{t=JSON.parse(e.getItem(r)||"")||n}catch(e){t=n}},saveStore:function(){e.setItem(r,JSON.stringify(t))},get middleWares(){return n},set middleWares(e){n=e},get state(){return t},set state(e){t=e},get name(){return r},set name(e){r=e},get storageType(){return e},set storageType(t){e=t}}}(),r=t.createContext(void 0),a="onAction";e.StateMachineProvider=function(e){var a=e.children,s=t.useState(n.state);return t.createElement(r.Provider,{value:{state:s[0],setState:s[1]}},a)},e.createStore=function(e,t){t&&(t.name&&(n.name=t.name),t.storageType&&(n.storageType=t.storageType),t.middleWares&&(n.middleWares=t.middleWares),t.persist&&(a=t.persist)),n.updateStore(e)},e.useStateMachine=function(e){var s=t.useContext(r),o=s.state,i=s.setState,u=t.useRef(Object.entries(e||{}).reduce(function(e,t){var r;return Object.assign({},e,((r={})[t[0]]=function(e,t){return function(r){n.state=t(n.state,r),n.middleWares&&(n.state=n.middleWares.reduce(function(e,n){return n(e,t.name,r)||e},n.state)),e(n.state),"onAction"===a&&n.saveStore()}}(i,t[1]),r))},{}));return t.useEffect(function(){"beforeUnload"===a&&(window.onbeforeunload=function(){return n.saveStore()})},[]),{actions:u.current,state:o}}});
!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 r(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 n=/*#__PURE__*/r(t),a=function(){var e,t={},r=[],n="__LSM__";try{e="undefined"!=typeof sessionStorage?window.sessionStorage:{}}catch(t){e={}}return{updateStore:function(r){try{t=JSON.parse(e.getItem(n)||"")||r}catch(e){t=r}},saveStore:function(){e.setItem(n,JSON.stringify(t))},get middleWares(){return r},set middleWares(e){r=e},get state(){return t},set state(e){t=e},get name(){return n},set name(e){n=e},get storageType(){return e},set storageType(t){e=t}}}(),o=n.createContext(void 0),s="onAction";e.StateMachineProvider=function(e){var t=e.children,r=n.useState(a.state);return n.createElement(o.Provider,{value:{state:r[0],setState:r[1]}},t)},e.createStore=function(e,t){t&&(t.name&&(a.name=t.name),t.storageType&&(a.storageType=t.storageType),t.middleWares&&(a.middleWares=t.middleWares),t.persist&&(s=t.persist)),a.updateStore(e)},e.useStateMachine=function(e){var t=n.useContext(o),r=t.state,i=t.setState,u=n.useRef(Object.entries(e||{}).reduce(function(e,t){var r;return Object.assign({},e,((r={})[t[0]]=function(e,t){return function(r){a.state=t(a.state,r),a.middleWares&&(a.state=a.middleWares.reduce(function(e,n){return n(e,t.name,r)||e},a.state)),e(a.state),"onAction"===s&&a.saveStore()}}(i,t[1]),r))},{}));return n.useEffect(function(){"beforeUnload"===s&&(window.onbeforeunload=function(){return a.saveStore()})},[]),{actions:u.current,state:r}}});
//# sourceMappingURL=little-state-machine.umd.js.map

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

],
"version": "4.2.0",
"version": "4.2.1",
"main": "dist/little-state-machine.js",

@@ -30,13 +30,13 @@ "module": "dist/little-state-machine.es.js",

"devDependencies": {
"@types/react": "^16.8.8",
"jest": "24.7.1",
"microbundle": "^0.12.4",
"@types/react": "^17.0.39",
"jest": "27.5.0",
"microbundle": "^0.14.2",
"npm-run-all": "^4.1.5",
"prettier": "^2.1.2",
"react": "^16.8.4",
"react-dom": "^16.8.4",
"prettier": "^2.5.1",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"rimraf": "^3.0.2",
"semantic-release": "^17.3.7",
"ts-jest": "^24.0.0",
"typescript": "^4.0.0"
"semantic-release": "^19.0.2",
"ts-jest": "^27.1.3",
"typescript": "^4.5.5"
},

@@ -43,0 +43,0 @@ "peerDependencies": {

@@ -224,4 +224,4 @@ <div align="center"><a href="https://lrz5wloklm.csb.app/"><img src="https://github.com/bluebill1049/little-state-machine/blob/master/docs/logo.png?raw=true" alt="Little State Machine - React Hooks for state management" width="140px" /></a>

src="https://avatars1.githubusercontent.com/u/42376060?s=60&amp;v=4"
width="40"
height="40"
width="45"
height="45"
alt="@sayav"

@@ -232,4 +232,4 @@ /></a>

src="https://avatars1.githubusercontent.com/u/35668113?s=60&amp;v=4"
width="40"
height="40"
width="45"
height="45"
alt="@lemcii"

@@ -239,5 +239,5 @@ /></a>

><img
src="https://avatars0.githubusercontent.com/u/5726140?s=460&u=b300a6fa08a24c59b9db6ebf246384cf8b16a140&v=4"
width="40"
height="40"
src="https://avatars.githubusercontent.com/u/5726140?v=4"
width="45"
height="45"
alt="@washingtonsoares"

@@ -247,5 +247,5 @@ /></a>

><img
src="https://avatars0.githubusercontent.com/u/4017964?s=460&u=3a3fdffeb97749d7509d9c5e9be2cafcb98e426f&v=4"
width="40"
height="40"
src="https://avatars.githubusercontent.com/u/4017964?v=4"
width="45"
height="45"
alt="@lixunn"

@@ -256,4 +256,4 @@ /></a>

src="https://avatars2.githubusercontent.com/u/3655410?s=60&amp;v=4"
width="40"
height="40"
width="45"
height="45"
alt="@SamSamskies"

@@ -264,4 +264,4 @@ /></a>

src="https://avatars2.githubusercontent.com/u/3356720?s=60&amp;v=4"
width="40"
height="40"
width="45"
height="45"
alt="@peaonunes"

@@ -272,4 +272,4 @@ /></a>

src="https://avatars2.githubusercontent.com/u/609452?s=60&amp;v=4"
width="40"
height="40"
width="45"
height="45"
alt="@wilhelmeek"

@@ -280,4 +280,4 @@ /></a>

src="https://avatars2.githubusercontent.com/u/279251?s=60&amp;v=4"
width="40"
height="40"
width="45"
height="45"
alt="@iwarner"

@@ -288,4 +288,4 @@ /></a>

src="https://avatars2.githubusercontent.com/u/10728145?s=60&amp;v=4"
width="40"
height="40"
width="45"
height="45"
alt="@joejknowles"

@@ -296,4 +296,4 @@ /></a>

src="https://avatars0.githubusercontent.com/u/5763108?s=60&amp;v=4"
width="40"
height="40"
width="45"
height="45"
alt="@chris-gunawardena"

@@ -304,4 +304,4 @@ /></a>

src="https://avatars1.githubusercontent.com/u/2625371?s=60&amp;v=4"
width="40"
height="40"
width="45"
height="45"
alt="@Tymek"

@@ -312,4 +312,4 @@ /></a>

src="https://avatars0.githubusercontent.com/u/2098777?s=60&amp;v=4"
width="40"
height="40"
width="45"
height="45"
alt="@Luchanso"

@@ -320,4 +320,4 @@ /></a>

src="https://avatars1.githubusercontent.com/u/1541093?s=60&amp;v=4"
width="40"
height="40"
width="45"
height="45"
alt="@vcarel"

@@ -328,4 +328,4 @@ /></a>

src="https://avatars0.githubusercontent.com/u/1481077?s=60&amp;v=4"
width="40"
height="40"
width="45"
height="45"
alt="@gragland"

@@ -336,4 +336,4 @@ /></a>

src="https://avatars2.githubusercontent.com/u/1254942?s=60&amp;v=4"
width="40"
height="40"
width="45"
height="45"
alt="@tjshipe"

@@ -344,4 +344,4 @@ /></a>

src="https://avatars1.githubusercontent.com/u/1087002?s=60&amp;v=4"
width="40"
height="40"
width="45"
height="45"
alt="@krnlde"

@@ -352,4 +352,4 @@ /></a>

src="https://avatars2.githubusercontent.com/u/784953?s=60&amp;v=4"
width="40"
height="40"
width="45"
height="45"
alt="@msutkowski"

@@ -360,4 +360,4 @@ /></a>

src="https://avatars3.githubusercontent.com/u/599247?s=60&amp;v=4"
width="40"
height="40"
width="45"
height="45"
alt="@mlukaszczyk"

@@ -368,4 +368,4 @@ /></a>

src="https://avatars0.githubusercontent.com/u/2566818?s=460&u=754ee26b96e321ff28dbc4a2744132015f534fe0&v=4"
width="40"
height="40"
width="45"
height="45"
/></a>

@@ -375,4 +375,4 @@ <a href="https://github.com/MatiasCiccone"

src="https://avatars3.githubusercontent.com/u/32602795?s=460&u=6a0c4dbe23c4f9a5628dc8867842b75989ecc4aa&v=4"
width="40"
height="40"
width="45"
height="45"
/></a>

@@ -382,10 +382,10 @@ <a href="https://github.com/ghostwriternr"

src="https://avatars0.githubusercontent.com/u/10023615?s=460&u=3ec1e4ba991699762fd22a9d9ef47a0599f937dc&v=4"
width="40"
height="40"
width="45"
height="45"
/></a>
<a href="https://github.com/neighborhood999"
><img
src="https://avatars3.githubusercontent.com/u/10325111?s=400&u=f60c932f81d95a60f77f5c7f2eab4590e07c29af&v=4"
width="40"
height="40"
src="https://avatars3.githubusercontent.com/u/10325111?s=450&u=f60c932f81d95a60f77f5c7f2eab4590e07c29af&v=4"
width="45"
height="45"
/></a>

@@ -395,5 +395,161 @@ <a href="https://github.com/yjp20"

src="https://avatars3.githubusercontent.com/u/44457064?s=460&u=a55119c84e0167f6a3f830dbad3133b28f0c0a8f&v=4"
width="40"
height="40"
width="45"
height="45"
/></a>
<a href="https://github.com/samantha-wong"
><img
src="https://avatars.githubusercontent.com/u/19571028?s=460&u=7421a02f600646b5836d5973359a257950cae8c4&v=4"
width="45"
height="45"
/></a>
<a href="https://github.com/msc-insure"
><img
src="https://avatars.githubusercontent.com/u/44406870?s=200&v=4"
width="45"
height="45"
/></a>
<a href="https://github.com/ccheney"
><img
src="https://avatars.githubusercontent.com/u/302437?v=4"
width="45"
height="45"
/></a>
<a href="https://github.com/artischockee"
><img
src="https://avatars.githubusercontent.com/u/22125223?v=4"
width="45"
height="45"
/></a>
<a href="https://github.com/tsongas"
><img
src="https://avatars.githubusercontent.com/u/2079598?v=4"
width="45"
height="45"
/></a>
<a href="https://github.com/knoefel"
><img
src="https://avatars.githubusercontent.com/u/2396344?v=4"
width="45"
height="45"
/></a>
<a href="https://github.com/JGibel"
><img
src="https://avatars.githubusercontent.com/u/1953965?v=4"
width="45"
height="45"
/></a>
<a href="https://github.com/gpalrepo"
><img
src="https://avatars.githubusercontent.com/u/41862257?v=4"
width="45"
height="45"
/></a>
<a href="https://github.com/pjsachdev"
><img
src="https://avatars.githubusercontent.com/u/43356139?v=4"
width="45"
height="45"
/></a>
<a href="https://github.com/svict4"
><img
src="https://avatars.githubusercontent.com/u/1137112?v=4"
width="45"
height="45"
/></a>
<a href="https://github.com/raisiqueira"
><img
src="https://avatars.githubusercontent.com/u/2914170?v=4"
width="45"
height="45"
/></a>
<a href="https://github.com/pashtet422"
><img
src="https://avatars.githubusercontent.com/u/45594821?v=4"
width="45"
height="45"
/></a>
<a href="https://github.com/ozywuli"
><img
src="https://avatars.githubusercontent.com/u/5769153?v=4"
width="45"
height="45"
/></a>
<a href="https://github.com/monkey0722"
><img
src="https://avatars.githubusercontent.com/u/12868063?v=4"
width="45"
height="45"
/></a>
<a href="https://github.com/KATT"
><img
src="https://avatars.githubusercontent.com/u/459267?v=4"
width="45"
height="45"
/></a>
<a href="https://github.com/jeroenvisser101"
><img
src="https://avatars.githubusercontent.com/u/1941348?v=4"
width="45"
height="45"
/></a>
<a href="https://github.com/sainu"
><img
src="https://avatars.githubusercontent.com/u/12888685?v=4"
width="45"
height="45"
/></a>
<a href="https://github.com/bkincart"
><img
src="https://avatars.githubusercontent.com/u/22803185?v=4"
width="45"
height="45"
/></a>
<a href="https://github.com/37108"
><img
src="https://avatars.githubusercontent.com/u/36793907?v=4"
width="45"
height="45"
/></a>
<a href="https://github.com/TadejPolajnar"
><img
src="https://avatars.githubusercontent.com/u/40028548?v=4"
width="45"
height="45"
/></a>
<a href="https://github.com/hahnlee"
><img
src="https://avatars.githubusercontent.com/u/16930958?v=4"
width="45"
height="45"
/></a>
<a href="https://github.com/ACPK"
><img
src="https://avatars.githubusercontent.com/u/2019893?v=4"
width="45"
height="45"
/></a>
<a href="https://github.com/alex-semenyuk"
><img
src="https://avatars.githubusercontent.com/u/5480441?v=4"
width="45"
height="45"
/></a>
<a href="https://github.com/Peter-AMD"
><img
src="https://avatars.githubusercontent.com/u/28400709?v=4"
width="45"
height="45"
/></a>
<a href="https://github.com/hjaber"
><img
src="https://avatars.githubusercontent.com/u/41503068?v=4"
width="45"
height="45"
/></a>
<a href="https://github.com/jprosevear"
><img
src="https://avatars.githubusercontent.com/u/699616?v=4"
width="45"
height="45"
/></a>
</p>

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