package.initializers.utils.utils.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":"utils.js","names":["i18n","getter","key","t","concat","replaceNullValuesWithGetter","inputObject","parentKey","arguments","length","undefined","result","_i","_Object$entries","Object","entries","_Object$entries$_i","_slicedToArray","value","transKey","defineProperty","get","_typeof"],"sources":["../../../src/initializers/utils/utils.js"],"sourcesContent":["import i18n from \"i18next\";\n\nconst getter = key => () => i18n.t(`taxonomyDefaultLabels.${key}`);\n\nexport const replaceNullValuesWithGetter = (inputObject, parentKey = \"\") => {\n const result = {};\n\n for (const [key, value] of Object.entries(inputObject)) {\n const transKey = parentKey ? `${parentKey}.${key}` : key;\n\n if (value === null) {\n Object.defineProperty(result, key, {\n get: getter(transKey),\n });\n } else if (typeof value === \"object\") {\n result[key] = replaceNullValuesWithGetter(value, transKey);\n } else {\n result[key] = value;\n }\n }\n\n return result;\n};\n"],"mappings":";;AAAA,OAAOA,IAAI,MAAM,SAAS;AAE1B,IAAMC,MAAM,GAAG,SAATA,MAAMA,CAAGC,GAAG;EAAA,OAAI;IAAA,OAAMF,IAAI,CAACG,CAAC,0BAAAC,MAAA,CAA0BF,GAAG,EAAG;EAAA;AAAA;AAElE,OAAO,IAAMG,2BAA2B,GAAG,SAA9BA,2BAA2BA,CAAIC,WAAW,EAAqB;EAAA,IAAnBC,SAAS,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,EAAE;EACrE,IAAMG,MAAM,GAAG,CAAC,CAAC;EAEjB,SAAAC,EAAA,MAAAC,eAAA,GAA2BC,MAAM,CAACC,OAAO,CAACT,WAAW,CAAC,EAAAM,EAAA,GAAAC,eAAA,CAAAJ,MAAA,EAAAG,EAAA,IAAE;IAAnD,IAAAI,kBAAA,GAAAC,cAAA,CA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