UNPKG

@sandstack/neuron

Version:

Neuron is a lightweight framework agnostic global state manager for Javascript apps, with React support

3 lines (2 loc) 947 B
(function(r,l){typeof exports=="object"&&typeof module<"u"?l(exports,require("../core")):typeof define=="function"&&define.amd?define(["exports","../core"],l):(r=typeof globalThis<"u"?globalThis:r||self,l(r.shallow={},r.core))})(this,function(r,l){"use strict";const o=(e,t)=>{if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}if(!Array.isArray(e)&&!Array.isArray(t)){const n=Object.keys(e),f=Object.keys(t);if(n.length!==f.length)return!1;for(const i of n)if(e[i]!==t[i])return!1;return!0}return!1},s=()=>new l.Module({name:"@sandstack/neuron-shallow",onDispatch:e=>{o(e.prevState,e.state)&&e.cancelDispatch()}});globalThis.NeuronShallow={Shallow:s,shallowEqual:o},r.Shallow=s,r.shallowEqual=o,Object.defineProperty(r,Symbol.toStringTag,{value:"Module"})}); //# sourceMappingURL=shallow.js.map