package.react-utils.withImmutableActions.withImmutableActions.js.map Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of neeto-commons-frontend Show documentation
Show all versions of neeto-commons-frontend Show documentation
A package encapsulating common code across neeto projects including initializers, utility functions, common components and hooks and so on.
{"version":3,"file":"withImmutableActions.js","names":["isEmpty","keys","setWithoutModifyingActions","set","partial","previous","overwrittenActions","filter","key","Error","concat","join","withImmutableActions","config","get","api"],"sources":["../../../src/react-utils/withImmutableActions/withImmutableActions.js"],"sourcesContent":["import { isEmpty, keys } from \"ramda\";\n\nconst setWithoutModifyingActions = set => partial =>\n set(previous => {\n if (typeof partial === \"function\") partial = partial(previous);\n\n const overwrittenActions = keys(partial).filter(\n key =>\n typeof previous?.[key] === \"function\" && partial[key] !== previous[key]\n );\n if (!isEmpty(overwrittenActions)) {\n throw new Error(\n `Actions should not be modified. Touched action(s): ${overwrittenActions.join(\n \", \"\n )}`\n );\n }\n\n return partial;\n }, false);\n\nconst withImmutableActions = config => (set, get, api) =>\n config(setWithoutModifyingActions(set), get, api);\n\nexport default withImmutableActions;\n"],"mappings":"AAAA,SAASA,OAAO,EAAEC,IAAI,QAAQ,OAAO;AAErC,IAAMC,0BAA0B,GAAG,SAA7BA,0BAA0BA,CAAGC,GAAG;EAAA,OAAI,UAAAC,OAAO;IAAA,OAC/CD,GAAG,CAAC,UAAAE,QAAQ,EAAI;MACd,IAAI,OAAOD,OAAO,KAAK,UAAU,EAAEA,OAAO,GAAGA,OAAO,CAACC,QAAQ,CAAC;MAE9D,IAAMC,kBAAkB,GAAGL,IAAI,CAACG,OAAO,CAAC,CAACG,MAAM,CAC7C,UAAAC,GAAG;QAAA,OACD,QAAOH,QAAQ,aAARA,QAAQ,uBAARA,QAAQ,CAAGG,GAAG,CAAC,MAAK,UAAU,IAAIJ,OAAO,CAACI,GAAG,CAAC,KAAKH,QAAQ,CAACG,GAAG,CAAC;MAAA,CAC3E,CAAC;MACD,IAAI,CAACR,OAAO,CAACM,kBAAkB,CAAC,EAAE;QAChC,MAAM,IAAIG,KAAK,uDAAAC,MAAA,CACyCJ,kBAAkB,CAACK,IAAI,CAC3E,IACF,CAAC,CACH,CAAC;MACH;MAEA,OAAOP,OAAO;IAChB,CAAC,EAAE,KAAK,CAAC;EAAA;AAAA;AAEX,IAAMQ,oBAAoB,GAAG,SAAvBA,oBAAoBA,CAAGC,MAAM;EAAA,OAAI,UAACV,GAAG,EAAEW,GAAG,EAAEC,GAAG;IAAA,OACnDF,MAAM,CAACX,0BAA0B,CAACC,GAAG,CAAC,EAAEW,GAAG,EAAEC,GAAG,CAAC;EAAA;AAAA;AAEnD,eAAeH,oBAAoB","ignoreList":[]}