@hedhog/utils
Version:
<p align="center"> <img src="https://avatars.githubusercontent.com/u/177489127?s=200&v=4" alt="Hedhog Avatar" /> </p>
17 lines • 620 B
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.getWithLocale = void 0;
const getWithLocale = (localeCode, tableLocaleName, data) => {
const locale = [...data[tableLocaleName]];
delete data[tableLocaleName];
const newData = Object.assign(Object.assign({}, data), { locale });
const current = locale.find((l) => l.locale.code === localeCode);
for (const key in current) {
if (key !== 'locale') {
newData[key] = current[key];
}
}
return newData;
};
exports.getWithLocale = getWithLocale;
//# sourceMappingURL=getWithLocale.js.map
;