Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | 227x 89x 179x 73x 3x 72x 106x 106x | import { isLocalizationObject } from "../utils";
export function normalizeLocalization(data: any): any {
if (Array.isArray(data)) {
return data.map((item) => normalizeLocalization(item));
} else if (Object(data) === data) {
if (isLocalizationObject(data)) {
return Object.entries(data).map(([lang, text]) => ({ lang, text }));
} else {
return Object.fromEntries(
Object.entries(data).map(([key, value]) => [
key,
normalizeLocalization(value),
]),
);
}
} else {
return data;
}
}
|