package.cjs.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":["_i18next","_interopRequireDefault","require","getter","key","i18n","t","concat","replaceNullValuesWithGetter","inputObject","parentKey","arguments","length","undefined","result","_i","_Object$entries","Object","entries","_Object$entries$_i","_slicedToArray2","value","transKey","defineProperty","get","_typeof2","exports"],"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,IAAAA,QAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAMC,MAAM,GAAG,SAATA,MAAMA,CAAGC,GAAG;EAAA,OAAI;IAAA,OAAMC,mBAAI,CAACC,CAAC,0BAAAC,MAAA,CAA0BH,GAAG,EAAG;EAAA;AAAA;AAE3D,IAAMI,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,EAAA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