UNPKG

react-redux

Version:

Official React bindings for Redux

1 lines • 2.77 kB
{"version":3,"names":[],"sources":["../src/utils/shallowEqual.ts","../src/index-rsc.ts"],"sourcesContent":["function is(x: unknown, y: unknown) {\n if (x === y) {\n return x !== 0 || y !== 0 || 1 / x === 1 / y\n } else {\n return x !== x && y !== y\n }\n}\n\nexport default function shallowEqual(objA: any, objB: any) {\n if (is(objA, objB)) return true\n\n if (\n typeof objA !== 'object' ||\n objA === null ||\n typeof objB !== 'object' ||\n objB === null\n ) {\n return false\n }\n\n const keysA = Object.keys(objA)\n const keysB = Object.keys(objB)\n\n if (keysA.length !== keysB.length) return false\n\n for (let i = 0; i < keysA.length; i++) {\n if (\n !Object.prototype.hasOwnProperty.call(objB, keysA[i]) ||\n !is(objA[keysA[i]], objB[keysA[i]])\n ) {\n return false\n }\n }\n\n return true\n}\n","import type * as normal from './index'\nimport type * as rsc from './index-rsc'\n\n// checks to make sure we didn't forgot to replicate any exports\n\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nconst _check: typeof normal = {} as typeof rsc\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nconst _check2: typeof rsc = {} as typeof normal\n\n// -------------------------------------------------------------------------------------\n\nconst throwNotSupportedError = ((\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n ...args: any[]\n): any => {\n throw new Error(\n 'This function is not supported in React Server Components. Please only use this export in a Client Component.',\n )\n}) as any\n\nexport {\n throwNotSupportedError as Provider,\n throwNotSupportedError as batch,\n throwNotSupportedError as connect,\n throwNotSupportedError as legacy_connect,\n throwNotSupportedError as createDispatchHook,\n throwNotSupportedError as createSelectorHook,\n throwNotSupportedError as createStoreHook,\n throwNotSupportedError as useDispatch,\n throwNotSupportedError as useSelector,\n throwNotSupportedError as useStore,\n}\nexport const ReactReduxContext = {} as any\nexport { default as shallowEqual } from './utils/shallowEqual'\n"],"mappings":";AAAA,SAAS,GAAG,GAAY,GAAY;CAClC,IAAI,MAAM,GACR,OAAO,MAAM,KAAK,MAAM,KAAK,IAAI,MAAM,IAAI;MAE3C,OAAO,MAAM,KAAK,MAAM;AAE5B;AAEA,SAAwB,aAAa,MAAW,MAAW;CACzD,IAAI,GAAG,MAAM,IAAI,GAAG,OAAO;CAE3B,IACE,OAAO,SAAS,YAChB,SAAS,QACT,OAAO,SAAS,YAChB,SAAS,MAET,OAAO;CAGT,MAAM,QAAQ,OAAO,KAAK,IAAI;CAC9B,MAAM,QAAQ,OAAO,KAAK,IAAI;CAE9B,IAAI,MAAM,WAAW,MAAM,QAAQ,OAAO;CAE1C,KAAK,IAAI,IAAI,GAAG,IAAI,MAAM,QAAQ,KAChC,IACE,CAAC,OAAO,UAAU,eAAe,KAAK,MAAM,MAAM,EAAE,KACpD,CAAC,GAAG,KAAK,MAAM,KAAK,KAAK,MAAM,GAAG,GAElC,OAAO;CAIX,OAAO;AACT;;;ACvBA,MAAM,2BAEJ,GAAG,SACK;CACR,MAAM,IAAI,MACR,+GACF;AACF;AAcA,MAAa,oBAAoB,CAAC"}