Comparing version 4.5.1 to 4.5.2
@@ -80,3 +80,3 @@ import type { StateCreator, StoreMutatorIdentifier } from '../vanilla'; | ||
*/ | ||
migrate?: (persistedState: unknown, version: number) => S | Promise<S>; | ||
migrate?: (persistedState: unknown, version: number) => PersistedState | Promise<PersistedState>; | ||
/** | ||
@@ -83,0 +83,0 @@ * A function to perform custom hydration merges when combining the stored state with the current one. |
@@ -34,4 +34,4 @@ import ReactExports from 'react'; | ||
} | ||
for (let i = 0; i < keysA.length; i++) { | ||
if (!Object.prototype.hasOwnProperty.call(objB, keysA[i]) || !Object.is(objA[keysA[i]], objB[keysA[i]])) { | ||
for (const keyA of keysA) { | ||
if (!Object.prototype.hasOwnProperty.call(objB, keyA) || !Object.is(objA[keyA], objB[keyA])) { | ||
return false; | ||
@@ -38,0 +38,0 @@ } |
@@ -32,4 +32,4 @@ function shallow$1(objA, objB) { | ||
} | ||
for (let i = 0; i < keysA.length; i++) { | ||
if (!Object.prototype.hasOwnProperty.call(objB, keysA[i]) || !Object.is(objA[keysA[i]], objB[keysA[i]])) { | ||
for (const keyA of keysA) { | ||
if (!Object.prototype.hasOwnProperty.call(objB, keyA) || !Object.is(objA[keyA], objB[keyA])) { | ||
return false; | ||
@@ -36,0 +36,0 @@ } |
@@ -32,4 +32,4 @@ function shallow(objA, objB) { | ||
} | ||
for (let i = 0; i < keysA.length; i++) { | ||
if (!Object.prototype.hasOwnProperty.call(objB, keysA[i]) || !Object.is(objA[keysA[i]], objB[keysA[i]])) { | ||
for (const keyA of keysA) { | ||
if (!Object.prototype.hasOwnProperty.call(objB, keyA) || !Object.is(objA[keyA], objB[keyA])) { | ||
return false; | ||
@@ -36,0 +36,0 @@ } |
@@ -80,3 +80,3 @@ import type { StateCreator, StoreMutatorIdentifier } from '../vanilla'; | ||
*/ | ||
migrate?: (persistedState: unknown, version: number) => S | Promise<S>; | ||
migrate?: (persistedState: unknown, version: number) => PersistedState | Promise<PersistedState>; | ||
/** | ||
@@ -83,0 +83,0 @@ * A function to perform custom hydration merges when combining the stored state with the current one. |
{ | ||
"name": "zustand", | ||
"private": false, | ||
"version": "4.5.1", | ||
"version": "4.5.2", | ||
"description": "🐻 Bear necessities for state management in React", | ||
@@ -194,3 +194,4 @@ "main": "./index.js", | ||
} | ||
} | ||
}, | ||
"packageManager": "yarn@1.22.21+sha256.dbed5b7e10c552ba0e1a545c948d5473bc6c5a28ce22a8fd27e493e3e5eb6370" | ||
} |
@@ -70,4 +70,5 @@ 'use strict'; | ||
} | ||
for (var i = 0; i < keysA.length; i++) { | ||
if (!Object.prototype.hasOwnProperty.call(objB, keysA[i]) || !Object.is(objA[keysA[i]], objB[keysA[i]])) { | ||
for (var _i = 0, _keysA = keysA; _i < _keysA.length; _i++) { | ||
var keyA = _keysA[_i]; | ||
if (!Object.prototype.hasOwnProperty.call(objB, keyA) || !Object.is(objA[keyA], objB[keyA])) { | ||
return false; | ||
@@ -74,0 +75,0 @@ } |
@@ -68,4 +68,5 @@ 'use strict'; | ||
} | ||
for (var i = 0; i < keysA.length; i++) { | ||
if (!Object.prototype.hasOwnProperty.call(objB, keysA[i]) || !Object.is(objA[keysA[i]], objB[keysA[i]])) { | ||
for (var _i = 0, _keysA = keysA; _i < _keysA.length; _i++) { | ||
var keyA = _keysA[_i]; | ||
if (!Object.prototype.hasOwnProperty.call(objB, keyA) || !Object.is(objA[keyA], objB[keyA])) { | ||
return false; | ||
@@ -72,0 +73,0 @@ } |
@@ -1,5 +0,5 @@ | ||
System.register([],function(b){"use strict";return{execute:function(){b("createJSONStorage",T);const A=b("redux",(d,c)=>(s,a,n)=>(n.dispatch=e=>(s(g=>d(g,e),!1,e),e),n.dispatchFromDevtools=!0,{dispatch:(...e)=>n.dispatch(...e),...c})),I=new Map,w=d=>{const c=I.get(d);return c?Object.fromEntries(Object.entries(c.stores).map(([s,a])=>[s,a.getState()])):{}},E=(d,c,s)=>{if(d===void 0)return{type:"untracked",connection:c.connect(s)};const a=I.get(s.name);if(a)return{type:"tracked",store:d,...a};const n={connection:c.connect(s),stores:{}};return I.set(s.name,n),{type:"tracked",store:d,...n}},P=b("devtools",(d,c={})=>(s,a,n)=>{const{enabled:e,anonymousActionType:g,store:u,...p}=c;let m;try{m=(e!=null?e:!1)&&window.__REDUX_DEVTOOLS_EXTENSION__}catch{}if(!m)return d(s,a,n);const{connection:l,...S}=E(u,m,p);let h=!0;n.setState=(r,o,i)=>{const t=s(r,o);if(!h)return t;const f=i===void 0?{type:g||"anonymous"}:typeof i=="string"?{type:i}:i;return u===void 0?(l==null||l.send(f,a()),t):(l==null||l.send({...f,type:`${u}/${f.type}`},{...w(p.name),[u]:n.getState()}),t)};const v=(...r)=>{const o=h;h=!1,s(...r),h=o},y=d(n.setState,a,n);if(S.type==="untracked"?l==null||l.init(y):(S.stores[S.store]=n,l==null||l.init(Object.fromEntries(Object.entries(S.stores).map(([r,o])=>[r,r===S.store?y:o.getState()])))),n.dispatchFromDevtools&&typeof n.dispatch=="function"){const r=n.dispatch;n.dispatch=(...o)=>{r(...o)}}return l.subscribe(r=>{var o;switch(r.type){case"ACTION":if(typeof r.payload!="string"){console.error("[zustand devtools middleware] Unsupported action format");return}return _(r.payload,i=>{if(i.type==="__setState"){if(u===void 0){v(i.state);return}Object.keys(i.state).length!==1&&console.error(` | ||
System.register([],function(b){"use strict";return{execute:function(){b("createJSONStorage",T);const A=b("redux",(d,c)=>(s,a,n)=>(n.dispatch=e=>(s(g=>d(g,e),!1,e),e),n.dispatchFromDevtools=!0,{dispatch:(...e)=>n.dispatch(...e),...c})),I=new Map,w=d=>{const c=I.get(d);return c?Object.fromEntries(Object.entries(c.stores).map(([s,a])=>[s,a.getState()])):{}},E=(d,c,s)=>{if(d===void 0)return{type:"untracked",connection:c.connect(s)};const a=I.get(s.name);if(a)return{type:"tracked",store:d,...a};const n={connection:c.connect(s),stores:{}};return I.set(s.name,n),{type:"tracked",store:d,...n}},P=b("devtools",(d,c={})=>(s,a,n)=>{const{enabled:e,anonymousActionType:g,store:u,...p}=c;let m;try{m=(e!=null?e:!1)&&window.__REDUX_DEVTOOLS_EXTENSION__}catch(r){}if(!m)return d(s,a,n);const{connection:l,...S}=E(u,m,p);let h=!0;n.setState=(r,o,i)=>{const t=s(r,o);if(!h)return t;const f=i===void 0?{type:g||"anonymous"}:typeof i=="string"?{type:i}:i;return u===void 0?(l==null||l.send(f,a()),t):(l==null||l.send({...f,type:`${u}/${f.type}`},{...w(p.name),[u]:n.getState()}),t)};const v=(...r)=>{const o=h;h=!1,s(...r),h=o},y=d(n.setState,a,n);if(S.type==="untracked"?l==null||l.init(y):(S.stores[S.store]=n,l==null||l.init(Object.fromEntries(Object.entries(S.stores).map(([r,o])=>[r,r===S.store?y:o.getState()])))),n.dispatchFromDevtools&&typeof n.dispatch=="function"){const r=n.dispatch;n.dispatch=(...o)=>{r(...o)}}return l.subscribe(r=>{var o;switch(r.type){case"ACTION":if(typeof r.payload!="string"){console.error("[zustand devtools middleware] Unsupported action format");return}return _(r.payload,i=>{if(i.type==="__setState"){if(u===void 0){v(i.state);return}Object.keys(i.state).length!==1&&console.error(` | ||
[zustand devtools middleware] Unsupported __setState action format. | ||
When using 'store' option in devtools(), the 'state' should have only one key, which is a value of 'store' that was passed in devtools(), | ||
and value of this only key should be a state object. Example: { "type": "__setState", "state": { "abc123Store": { "foo": "bar" } } } | ||
`);const t=i.state[u];if(t==null)return;JSON.stringify(n.getState())!==JSON.stringify(t)&&v(t);return}n.dispatchFromDevtools&&typeof n.dispatch=="function"&&n.dispatch(i)});case"DISPATCH":switch(r.payload.type){case"RESET":return v(y),u===void 0?l==null?void 0:l.init(n.getState()):l==null?void 0:l.init(w(p.name));case"COMMIT":if(u===void 0){l==null||l.init(n.getState());return}return l==null?void 0:l.init(w(p.name));case"ROLLBACK":return _(r.state,i=>{if(u===void 0){v(i),l==null||l.init(n.getState());return}v(i[u]),l==null||l.init(w(p.name))});case"JUMP_TO_STATE":case"JUMP_TO_ACTION":return _(r.state,i=>{if(u===void 0){v(i);return}JSON.stringify(n.getState())!==JSON.stringify(i[u])&&v(i[u])});case"IMPORT_STATE":{const{nextLiftedState:i}=r.payload,t=(o=i.computedStates.slice(-1)[0])==null?void 0:o.state;if(!t)return;v(u===void 0?t:t[u]),l==null||l.send(null,i);return}case"PAUSE_RECORDING":return h=!h}return}}),y}),_=(d,c)=>{let s;try{s=JSON.parse(d)}catch(a){console.error("[zustand devtools middleware] Could not parse the received json",a)}s!==void 0&&c(s)},H=b("subscribeWithSelector",d=>(c,s,a)=>{const n=a.subscribe;return a.subscribe=(e,g,u)=>{let p=e;if(g){const m=(u==null?void 0:u.equalityFn)||Object.is;let l=e(a.getState());p=S=>{const h=e(S);if(!m(l,h)){const v=l;g(l=h,v)}},u!=null&&u.fireImmediately&&g(l,l)}return n(p)},d(c,s,a)}),R=b("combine",(d,c)=>(...s)=>Object.assign({},d,c(...s)));function T(d,c){let s;try{s=d()}catch{return}return{getItem:a=>{var n;const e=u=>u===null?null:JSON.parse(u,c==null?void 0:c.reviver),g=(n=s.getItem(a))!=null?n:null;return g instanceof Promise?g.then(e):e(g)},setItem:(a,n)=>s.setItem(a,JSON.stringify(n,c==null?void 0:c.replacer)),removeItem:a=>s.removeItem(a)}}const O=d=>c=>{try{const s=d(c);return s instanceof Promise?s:{then(a){return O(a)(s)},catch(a){return this}}}catch(s){return{then(a){return this},catch(a){return O(a)(s)}}}},N=(d,c)=>(s,a,n)=>{let e={getStorage:()=>localStorage,serialize:JSON.stringify,deserialize:JSON.parse,partialize:o=>o,version:0,merge:(o,i)=>({...i,...o}),...c},g=!1;const u=new Set,p=new Set;let m;try{m=e.getStorage()}catch{}if(!m)return d((...o)=>{console.warn(`[zustand persist middleware] Unable to update item '${e.name}', the given storage is currently unavailable.`),s(...o)},a,n);const l=O(e.serialize),S=()=>{const o=e.partialize({...a()});let i;const t=l({state:o,version:e.version}).then(f=>m.setItem(e.name,f)).catch(f=>{i=f});if(i)throw i;return t},h=n.setState;n.setState=(o,i)=>{h(o,i),S()};const v=d((...o)=>{s(...o),S()},a,n);let y;const r=()=>{var o;if(!m)return;g=!1,u.forEach(t=>t(a()));const i=((o=e.onRehydrateStorage)==null?void 0:o.call(e,a()))||void 0;return O(m.getItem.bind(m))(e.name).then(t=>{if(t)return e.deserialize(t)}).then(t=>{if(t)if(typeof t.version=="number"&&t.version!==e.version){if(e.migrate)return e.migrate(t.state,t.version);console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return t.state}).then(t=>{var f;return y=e.merge(t,(f=a())!=null?f:v),s(y,!0),S()}).then(()=>{i==null||i(y,void 0),g=!0,p.forEach(t=>t(y))}).catch(t=>{i==null||i(void 0,t)})};return n.persist={setOptions:o=>{e={...e,...o},o.getStorage&&(m=o.getStorage())},clearStorage:()=>{m==null||m.removeItem(e.name)},getOptions:()=>e,rehydrate:()=>r(),hasHydrated:()=>g,onHydrate:o=>(u.add(o),()=>{u.delete(o)}),onFinishHydration:o=>(p.add(o),()=>{p.delete(o)})},r(),y||v},z=(d,c)=>(s,a,n)=>{let e={storage:T(()=>localStorage),partialize:r=>r,version:0,merge:(r,o)=>({...o,...r}),...c},g=!1;const u=new Set,p=new Set;let m=e.storage;if(!m)return d((...r)=>{console.warn(`[zustand persist middleware] Unable to update item '${e.name}', the given storage is currently unavailable.`),s(...r)},a,n);const l=()=>{const r=e.partialize({...a()});return m.setItem(e.name,{state:r,version:e.version})},S=n.setState;n.setState=(r,o)=>{S(r,o),l()};const h=d((...r)=>{s(...r),l()},a,n);n.getInitialState=()=>h;let v;const y=()=>{var r,o;if(!m)return;g=!1,u.forEach(t=>{var f;return t((f=a())!=null?f:h)});const i=((o=e.onRehydrateStorage)==null?void 0:o.call(e,(r=a())!=null?r:h))||void 0;return O(m.getItem.bind(m))(e.name).then(t=>{if(t)if(typeof t.version=="number"&&t.version!==e.version){if(e.migrate)return e.migrate(t.state,t.version);console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return t.state}).then(t=>{var f;return v=e.merge(t,(f=a())!=null?f:h),s(v,!0),l()}).then(()=>{i==null||i(v,void 0),v=a(),g=!0,p.forEach(t=>t(v))}).catch(t=>{i==null||i(void 0,t)})};return n.persist={setOptions:r=>{e={...e,...r},r.storage&&(m=r.storage)},clearStorage:()=>{m==null||m.removeItem(e.name)},getOptions:()=>e,rehydrate:()=>y(),hasHydrated:()=>g,onHydrate:r=>(u.add(r),()=>{u.delete(r)}),onFinishHydration:r=>(p.add(r),()=>{p.delete(r)})},e.skipHydration||y(),v||h},$=b("persist",(d,c)=>"getStorage"in c||"serialize"in c||"deserialize"in c?N(d,c):z(d,c))}}}); | ||
`);const t=i.state[u];if(t==null)return;JSON.stringify(n.getState())!==JSON.stringify(t)&&v(t);return}n.dispatchFromDevtools&&typeof n.dispatch=="function"&&n.dispatch(i)});case"DISPATCH":switch(r.payload.type){case"RESET":return v(y),u===void 0?l==null?void 0:l.init(n.getState()):l==null?void 0:l.init(w(p.name));case"COMMIT":if(u===void 0){l==null||l.init(n.getState());return}return l==null?void 0:l.init(w(p.name));case"ROLLBACK":return _(r.state,i=>{if(u===void 0){v(i),l==null||l.init(n.getState());return}v(i[u]),l==null||l.init(w(p.name))});case"JUMP_TO_STATE":case"JUMP_TO_ACTION":return _(r.state,i=>{if(u===void 0){v(i);return}JSON.stringify(n.getState())!==JSON.stringify(i[u])&&v(i[u])});case"IMPORT_STATE":{const{nextLiftedState:i}=r.payload,t=(o=i.computedStates.slice(-1)[0])==null?void 0:o.state;if(!t)return;v(u===void 0?t:t[u]),l==null||l.send(null,i);return}case"PAUSE_RECORDING":return h=!h}return}}),y}),_=(d,c)=>{let s;try{s=JSON.parse(d)}catch(a){console.error("[zustand devtools middleware] Could not parse the received json",a)}s!==void 0&&c(s)},H=b("subscribeWithSelector",d=>(c,s,a)=>{const n=a.subscribe;return a.subscribe=(e,g,u)=>{let p=e;if(g){const m=(u==null?void 0:u.equalityFn)||Object.is;let l=e(a.getState());p=S=>{const h=e(S);if(!m(l,h)){const v=l;g(l=h,v)}},u!=null&&u.fireImmediately&&g(l,l)}return n(p)},d(c,s,a)}),R=b("combine",(d,c)=>(...s)=>Object.assign({},d,c(...s)));function T(d,c){let s;try{s=d()}catch(a){return}return{getItem:a=>{var n;const e=u=>u===null?null:JSON.parse(u,c==null?void 0:c.reviver),g=(n=s.getItem(a))!=null?n:null;return g instanceof Promise?g.then(e):e(g)},setItem:(a,n)=>s.setItem(a,JSON.stringify(n,c==null?void 0:c.replacer)),removeItem:a=>s.removeItem(a)}}const O=d=>c=>{try{const s=d(c);return s instanceof Promise?s:{then(a){return O(a)(s)},catch(a){return this}}}catch(s){return{then(a){return this},catch(a){return O(a)(s)}}}},N=(d,c)=>(s,a,n)=>{let e={getStorage:()=>localStorage,serialize:JSON.stringify,deserialize:JSON.parse,partialize:o=>o,version:0,merge:(o,i)=>({...i,...o}),...c},g=!1;const u=new Set,p=new Set;let m;try{m=e.getStorage()}catch(o){}if(!m)return d((...o)=>{console.warn(`[zustand persist middleware] Unable to update item '${e.name}', the given storage is currently unavailable.`),s(...o)},a,n);const l=O(e.serialize),S=()=>{const o=e.partialize({...a()});let i;const t=l({state:o,version:e.version}).then(f=>m.setItem(e.name,f)).catch(f=>{i=f});if(i)throw i;return t},h=n.setState;n.setState=(o,i)=>{h(o,i),S()};const v=d((...o)=>{s(...o),S()},a,n);let y;const r=()=>{var o;if(!m)return;g=!1,u.forEach(t=>t(a()));const i=((o=e.onRehydrateStorage)==null?void 0:o.call(e,a()))||void 0;return O(m.getItem.bind(m))(e.name).then(t=>{if(t)return e.deserialize(t)}).then(t=>{if(t)if(typeof t.version=="number"&&t.version!==e.version){if(e.migrate)return e.migrate(t.state,t.version);console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return t.state}).then(t=>{var f;return y=e.merge(t,(f=a())!=null?f:v),s(y,!0),S()}).then(()=>{i==null||i(y,void 0),g=!0,p.forEach(t=>t(y))}).catch(t=>{i==null||i(void 0,t)})};return n.persist={setOptions:o=>{e={...e,...o},o.getStorage&&(m=o.getStorage())},clearStorage:()=>{m==null||m.removeItem(e.name)},getOptions:()=>e,rehydrate:()=>r(),hasHydrated:()=>g,onHydrate:o=>(u.add(o),()=>{u.delete(o)}),onFinishHydration:o=>(p.add(o),()=>{p.delete(o)})},r(),y||v},z=(d,c)=>(s,a,n)=>{let e={storage:T(()=>localStorage),partialize:r=>r,version:0,merge:(r,o)=>({...o,...r}),...c},g=!1;const u=new Set,p=new Set;let m=e.storage;if(!m)return d((...r)=>{console.warn(`[zustand persist middleware] Unable to update item '${e.name}', the given storage is currently unavailable.`),s(...r)},a,n);const l=()=>{const r=e.partialize({...a()});return m.setItem(e.name,{state:r,version:e.version})},S=n.setState;n.setState=(r,o)=>{S(r,o),l()};const h=d((...r)=>{s(...r),l()},a,n);n.getInitialState=()=>h;let v;const y=()=>{var r,o;if(!m)return;g=!1,u.forEach(t=>{var f;return t((f=a())!=null?f:h)});const i=((o=e.onRehydrateStorage)==null?void 0:o.call(e,(r=a())!=null?r:h))||void 0;return O(m.getItem.bind(m))(e.name).then(t=>{if(t)if(typeof t.version=="number"&&t.version!==e.version){if(e.migrate)return e.migrate(t.state,t.version);console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return t.state}).then(t=>{var f;return v=e.merge(t,(f=a())!=null?f:h),s(v,!0),l()}).then(()=>{i==null||i(v,void 0),v=a(),g=!0,p.forEach(t=>t(v))}).catch(t=>{i==null||i(void 0,t)})};return n.persist={setOptions:r=>{e={...e,...r},r.storage&&(m=r.storage)},clearStorage:()=>{m==null||m.removeItem(e.name)},getOptions:()=>e,rehydrate:()=>y(),hasHydrated:()=>g,onHydrate:r=>(u.add(r),()=>{u.delete(r)}),onFinishHydration:r=>(p.add(r),()=>{p.delete(r)})},e.skipHydration||y(),v||h},$=b("persist",(d,c)=>"getStorage"in c||"serialize"in c||"deserialize"in c?N(d,c):z(d,c))}}}); |
@@ -43,4 +43,4 @@ System.register(['react'], (function (exports) { | ||
} | ||
for (let i = 0; i < keysA.length; i++) { | ||
if (!Object.prototype.hasOwnProperty.call(objB, keysA[i]) || !Object.is(objA[keysA[i]], objB[keysA[i]])) { | ||
for (const keyA of keysA) { | ||
if (!Object.prototype.hasOwnProperty.call(objB, keyA) || !Object.is(objA[keyA], objB[keyA])) { | ||
return false; | ||
@@ -47,0 +47,0 @@ } |
@@ -1,1 +0,1 @@ | ||
System.register(["react"],function(o){"use strict";var s;return{setters:[function(c){s=c.default}],execute:function(){o("useShallow",f);function c(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[r,i]of e)if(!Object.is(i,t.get(r)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const r of e)if(!t.has(r))return!1;return!0}const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(let r=0;r<n.length;r++)if(!Object.prototype.hasOwnProperty.call(t,n[r])||!Object.is(e[n[r]],t[n[r]]))return!1;return!0}const{useRef:u}=s;function f(e){const t=u();return n=>{const r=e(n);return c(t.current,r)?t.current:t.current=r}}}}}); | ||
System.register(["react"],function(o){"use strict";var c;return{setters:[function(s){c=s.default}],execute:function(){o("useShallow",u);function s(r,t){if(Object.is(r,t))return!0;if(typeof r!="object"||r===null||typeof t!="object"||t===null)return!1;if(r instanceof Map&&t instanceof Map){if(r.size!==t.size)return!1;for(const[e,i]of r)if(!Object.is(i,t.get(e)))return!1;return!0}if(r instanceof Set&&t instanceof Set){if(r.size!==t.size)return!1;for(const e of r)if(!t.has(e))return!1;return!0}const n=Object.keys(r);if(n.length!==Object.keys(t).length)return!1;for(const e of n)if(!Object.prototype.hasOwnProperty.call(t,e)||!Object.is(r[e],t[e]))return!1;return!0}const{useRef:f}=c;function u(r){const t=f();return n=>{const e=r(n);return s(t.current,e)?t.current:t.current=e}}}}}); |
@@ -39,4 +39,4 @@ System.register([], (function (exports) { | ||
} | ||
for (let i = 0; i < keysA.length; i++) { | ||
if (!Object.prototype.hasOwnProperty.call(objB, keysA[i]) || !Object.is(objA[keysA[i]], objB[keysA[i]])) { | ||
for (const keyA of keysA) { | ||
if (!Object.prototype.hasOwnProperty.call(objB, keyA) || !Object.is(objA[keyA], objB[keyA])) { | ||
return false; | ||
@@ -43,0 +43,0 @@ } |
@@ -1,1 +0,1 @@ | ||
System.register([],function(f){"use strict";return{execute:function(){f("shallow",i);function i(t,e){if(Object.is(t,e))return!0;if(typeof t!="object"||t===null||typeof e!="object"||e===null)return!1;if(t instanceof Map&&e instanceof Map){if(t.size!==e.size)return!1;for(const[n,o]of t)if(!Object.is(o,e.get(n)))return!1;return!0}if(t instanceof Set&&e instanceof Set){if(t.size!==e.size)return!1;for(const n of t)if(!e.has(n))return!1;return!0}const r=Object.keys(t);if(r.length!==Object.keys(e).length)return!1;for(let n=0;n<r.length;n++)if(!Object.prototype.hasOwnProperty.call(e,r[n])||!Object.is(t[r[n]],e[r[n]]))return!1;return!0}var s=f("default",(t,e)=>i(t,e))}}}); | ||
System.register([],function(n){"use strict";return{execute:function(){n("shallow",f);function f(t,r){if(Object.is(t,r))return!0;if(typeof t!="object"||t===null||typeof r!="object"||r===null)return!1;if(t instanceof Map&&r instanceof Map){if(t.size!==r.size)return!1;for(const[e,o]of t)if(!Object.is(o,r.get(e)))return!1;return!0}if(t instanceof Set&&r instanceof Set){if(t.size!==r.size)return!1;for(const e of t)if(!r.has(e))return!1;return!0}const i=Object.keys(t);if(i.length!==Object.keys(r).length)return!1;for(const e of i)if(!Object.prototype.hasOwnProperty.call(r,e)||!Object.is(t[e],r[e]))return!1;return!0}var s=n("default",(t,r)=>f(t,r))}}}); |
@@ -39,4 +39,4 @@ System.register([], (function (exports) { | ||
} | ||
for (let i = 0; i < keysA.length; i++) { | ||
if (!Object.prototype.hasOwnProperty.call(objB, keysA[i]) || !Object.is(objA[keysA[i]], objB[keysA[i]])) { | ||
for (const keyA of keysA) { | ||
if (!Object.prototype.hasOwnProperty.call(objB, keyA) || !Object.is(objA[keyA], objB[keyA])) { | ||
return false; | ||
@@ -43,0 +43,0 @@ } |
@@ -1,1 +0,1 @@ | ||
System.register([],function(i){"use strict";return{execute:function(){i("shallow",f);function f(t,e){if(Object.is(t,e))return!0;if(typeof t!="object"||t===null||typeof e!="object"||e===null)return!1;if(t instanceof Map&&e instanceof Map){if(t.size!==e.size)return!1;for(const[n,o]of t)if(!Object.is(o,e.get(n)))return!1;return!0}if(t instanceof Set&&e instanceof Set){if(t.size!==e.size)return!1;for(const n of t)if(!e.has(n))return!1;return!0}const r=Object.keys(t);if(r.length!==Object.keys(e).length)return!1;for(let n=0;n<r.length;n++)if(!Object.prototype.hasOwnProperty.call(e,r[n])||!Object.is(t[r[n]],e[r[n]]))return!1;return!0}}}}); | ||
System.register([],function(f){"use strict";return{execute:function(){f("shallow",i);function i(t,r){if(Object.is(t,r))return!0;if(typeof t!="object"||t===null||typeof r!="object"||r===null)return!1;if(t instanceof Map&&r instanceof Map){if(t.size!==r.size)return!1;for(const[e,o]of t)if(!Object.is(o,r.get(e)))return!1;return!0}if(t instanceof Set&&r instanceof Set){if(t.size!==r.size)return!1;for(const e of t)if(!r.has(e))return!1;return!0}const n=Object.keys(t);if(n.length!==Object.keys(r).length)return!1;for(const e of n)if(!Object.prototype.hasOwnProperty.call(r,e)||!Object.is(t[e],r[e]))return!1;return!0}}}}); |
@@ -80,3 +80,3 @@ import { StateCreator, StoreMutatorIdentifier } from '../vanilla'; | ||
*/ | ||
migrate?: (persistedState: unknown, version: number) => S | Promise<S>; | ||
migrate?: (persistedState: unknown, version: number) => PersistedState | Promise<PersistedState>; | ||
/** | ||
@@ -83,0 +83,0 @@ * A function to perform custom hydration merges when combining the stored state with the current one. |
@@ -80,3 +80,3 @@ import { StateCreator, StoreMutatorIdentifier } from '../vanilla'; | ||
*/ | ||
migrate?: (persistedState: unknown, version: number) => S | Promise<S>; | ||
migrate?: (persistedState: unknown, version: number) => PersistedState | Promise<PersistedState>; | ||
/** | ||
@@ -83,0 +83,0 @@ * A function to perform custom hydration merges when combining the stored state with the current one. |
@@ -72,4 +72,5 @@ (function (global, factory) { | ||
} | ||
for (var i = 0; i < keysA.length; i++) { | ||
if (!Object.prototype.hasOwnProperty.call(objB, keysA[i]) || !Object.is(objA[keysA[i]], objB[keysA[i]])) { | ||
for (var _i = 0, _keysA = keysA; _i < _keysA.length; _i++) { | ||
var keyA = _keysA[_i]; | ||
if (!Object.prototype.hasOwnProperty.call(objB, keyA) || !Object.is(objA[keyA], objB[keyA])) { | ||
return false; | ||
@@ -76,0 +77,0 @@ } |
@@ -1,1 +0,1 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react")):"function"==typeof define&&define.amd?define(["exports","react"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).zustandReactShallow={},e.React)}(this,(function(e,t){"use strict";function r(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function n(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return r(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?r(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var o=0;return function(){return o>=e.length?{done:!0}:{done:!1,value:e[o++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o=t.useRef;e.useShallow=function(e){var t=o();return function(r){var o=e(r);return function(e,t){if(Object.is(e,t))return!0;if("object"!=typeof e||null===e||"object"!=typeof t||null===t)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(var r,o=n(e);!(r=o()).done;){var i=r.value,a=i[0],u=i[1];if(!Object.is(u,t.get(a)))return!1}return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(var f,c=n(e);!(f=c()).done;){var l=f.value;if(!t.has(l))return!1}return!0}var s=Object.keys(e);if(s.length!==Object.keys(t).length)return!1;for(var y=0;y<s.length;y++)if(!Object.prototype.hasOwnProperty.call(t,s[y])||!Object.is(e[s[y]],t[s[y]]))return!1;return!0}(t.current,o)?t.current:t.current=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="undefined"!=typeof globalThis?globalThis:e||self).zustandReactShallow={},e.React)}(this,(function(e,t){"use strict";function r(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function n(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return r(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?r(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var o=0;return function(){return o>=e.length?{done:!0}:{done:!1,value:e[o++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o=t.useRef;e.useShallow=function(e){var t=o();return function(r){var o=e(r);return function(e,t){if(Object.is(e,t))return!0;if("object"!=typeof e||null===e||"object"!=typeof t||null===t)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(var r,o=n(e);!(r=o()).done;){var i=r.value,a=i[0],u=i[1];if(!Object.is(u,t.get(a)))return!1}return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(var f,c=n(e);!(f=c()).done;){var l=f.value;if(!t.has(l))return!1}return!0}var s=Object.keys(e);if(s.length!==Object.keys(t).length)return!1;for(var y=0,p=s;y<p.length;y++){var b=p[y];if(!Object.prototype.hasOwnProperty.call(t,b)||!Object.is(e[b],t[b]))return!1}return!0}(t.current,o)?t.current:t.current=o}}})); |
@@ -72,4 +72,5 @@ (function (global, factory) { | ||
} | ||
for (var i = 0; i < keysA.length; i++) { | ||
if (!Object.prototype.hasOwnProperty.call(objB, keysA[i]) || !Object.is(objA[keysA[i]], objB[keysA[i]])) { | ||
for (var _i = 0, _keysA = keysA; _i < _keysA.length; _i++) { | ||
var keyA = _keysA[_i]; | ||
if (!Object.prototype.hasOwnProperty.call(objB, keyA) || !Object.is(objA[keyA], objB[keyA])) { | ||
return false; | ||
@@ -76,0 +77,0 @@ } |
@@ -1,1 +0,1 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).zustandShallow={})}(this,(function(e){"use strict";function t(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function r(e,r){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,r){if(e){if("string"==typeof e)return t(e,r);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?t(e,r):void 0}}(e))||r&&e&&"number"==typeof e.length){n&&(e=n);var o=0;return function(){return o>=e.length?{done:!0}:{done:!1,value:e[o++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function n(e,t){if(Object.is(e,t))return!0;if("object"!=typeof e||null===e||"object"!=typeof t||null===t)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(var n,o=r(e);!(n=o()).done;){var i=n.value,a=i[0],f=i[1];if(!Object.is(f,t.get(a)))return!1}return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(var u,l=r(e);!(u=l()).done;){var s=u.value;if(!t.has(s))return!1}return!0}var c=Object.keys(e);if(c.length!==Object.keys(t).length)return!1;for(var d=0;d<c.length;d++)if(!Object.prototype.hasOwnProperty.call(t,c[d])||!Object.is(e[c[d]],t[c[d]]))return!1;return!0}e.default=function(e,t){return n(e,t)},e.shallow=n,Object.defineProperty(e,"__esModule",{value:!0})})); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).zustandShallow={})}(this,(function(e){"use strict";function t(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function r(e,r){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,r){if(e){if("string"==typeof e)return t(e,r);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?t(e,r):void 0}}(e))||r&&e&&"number"==typeof e.length){n&&(e=n);var o=0;return function(){return o>=e.length?{done:!0}:{done:!1,value:e[o++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function n(e,t){if(Object.is(e,t))return!0;if("object"!=typeof e||null===e||"object"!=typeof t||null===t)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(var n,o=r(e);!(n=o()).done;){var i=n.value,a=i[0],f=i[1];if(!Object.is(f,t.get(a)))return!1}return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(var u,l=r(e);!(u=l()).done;){var s=u.value;if(!t.has(s))return!1}return!0}var c=Object.keys(e);if(c.length!==Object.keys(t).length)return!1;for(var d=0,y=c;d<y.length;d++){var p=y[d];if(!Object.prototype.hasOwnProperty.call(t,p)||!Object.is(e[p],t[p]))return!1}return!0}e.default=function(e,t){return n(e,t)},e.shallow=n,Object.defineProperty(e,"__esModule",{value:!0})})); |
@@ -72,4 +72,5 @@ (function (global, factory) { | ||
} | ||
for (var i = 0; i < keysA.length; i++) { | ||
if (!Object.prototype.hasOwnProperty.call(objB, keysA[i]) || !Object.is(objA[keysA[i]], objB[keysA[i]])) { | ||
for (var _i = 0, _keysA = keysA; _i < _keysA.length; _i++) { | ||
var keyA = _keysA[_i]; | ||
if (!Object.prototype.hasOwnProperty.call(objB, keyA) || !Object.is(objA[keyA], objB[keyA])) { | ||
return false; | ||
@@ -76,0 +77,0 @@ } |
@@ -1,1 +0,1 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).zustandVanillaShallow={})}(this,(function(e){"use strict";function t(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function r(e,r){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,r){if(e){if("string"==typeof e)return t(e,r);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?t(e,r):void 0}}(e))||r&&e&&"number"==typeof e.length){n&&(e=n);var o=0;return function(){return o>=e.length?{done:!0}:{done:!1,value:e[o++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}e.shallow=function(e,t){if(Object.is(e,t))return!0;if("object"!=typeof e||null===e||"object"!=typeof t||null===t)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(var n,o=r(e);!(n=o()).done;){var i=n.value,a=i[0],f=i[1];if(!Object.is(f,t.get(a)))return!1}return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(var l,u=r(e);!(l=u()).done;){var s=l.value;if(!t.has(s))return!1}return!0}var c=Object.keys(e);if(c.length!==Object.keys(t).length)return!1;for(var y=0;y<c.length;y++)if(!Object.prototype.hasOwnProperty.call(t,c[y])||!Object.is(e[c[y]],t[c[y]]))return!1;return!0}})); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).zustandVanillaShallow={})}(this,(function(e){"use strict";function t(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function r(e,r){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,r){if(e){if("string"==typeof e)return t(e,r);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?t(e,r):void 0}}(e))||r&&e&&"number"==typeof e.length){n&&(e=n);var o=0;return function(){return o>=e.length?{done:!0}:{done:!1,value:e[o++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}e.shallow=function(e,t){if(Object.is(e,t))return!0;if("object"!=typeof e||null===e||"object"!=typeof t||null===t)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(var n,o=r(e);!(n=o()).done;){var i=n.value,a=i[0],f=i[1];if(!Object.is(f,t.get(a)))return!1}return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(var l,u=r(e);!(l=u()).done;){var s=l.value;if(!t.has(s))return!1}return!0}var c=Object.keys(e);if(c.length!==Object.keys(t).length)return!1;for(var y=0,p=c;y<p.length;y++){var b=p[y];if(!Object.prototype.hasOwnProperty.call(t,b)||!Object.is(e[b],t[b]))return!1}return!0}})); |
@@ -68,4 +68,5 @@ 'use strict'; | ||
} | ||
for (var i = 0; i < keysA.length; i++) { | ||
if (!Object.prototype.hasOwnProperty.call(objB, keysA[i]) || !Object.is(objA[keysA[i]], objB[keysA[i]])) { | ||
for (var _i = 0, _keysA = keysA; _i < _keysA.length; _i++) { | ||
var keyA = _keysA[_i]; | ||
if (!Object.prototype.hasOwnProperty.call(objB, keyA) || !Object.is(objA[keyA], objB[keyA])) { | ||
return false; | ||
@@ -72,0 +73,0 @@ } |
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
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
326873
7142