30 lines
653 B
TypeScript
30 lines
653 B
TypeScript
export const replaceSpacesToEmptyLines = <T = unknown>(object: T): T => {
|
|
if (Array.isArray(object)) {
|
|
return object.map(replaceSpacesToEmptyLines) as T;
|
|
}
|
|
|
|
if (!object || typeof object !== "object") {
|
|
return object;
|
|
}
|
|
|
|
const result: Record<string, unknown> = {};
|
|
|
|
for (const [key, value] of Object.entries(object)) {
|
|
if (typeof value === "string") {
|
|
result[key] = value.replace("squiz.pena.digital", "storage.yandexcloud.net");
|
|
|
|
continue;
|
|
}
|
|
|
|
if (typeof value === "object") {
|
|
result[key] = replaceSpacesToEmptyLines(value);
|
|
|
|
continue;
|
|
}
|
|
|
|
result[key] = value;
|
|
}
|
|
|
|
return result as T;
|
|
};
|