@sandstack/neuron
Version:
Neuron is a lightweight framework agnostic global state manager for Javascript apps, with React support
41 lines (40 loc) • 901 B
JavaScript
import { Module as o } from "../core";
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), s = Object.keys(r);
if (t.length !== s.length)
return !1;
for (const l of t)
if (e[l] !== r[l])
return !1;
return !0;
}
return !1;
}, a = () => new o({
name: "@sandstack/neuron-shallow",
onDispatch: (e) => {
n(
e.prevState,
e.state
) && e.cancelDispatch();
}
});
globalThis.NeuronShallow = {
Shallow: a,
shallowEqual: n
};
export {
a as Shallow,
n as shallowEqual
};
//# sourceMappingURL=index.js.map