UNPKG

@sandstack/neuron

Version:

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

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