UNPKG

yt-dlx

Version:

Effortless Audio-Video Downloader And Streamer!

21 lines 1.12 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = sanitizeRenderer; // Suggestion: Add JSDoc comments to the function, explaining its purpose, parameters, and return value. Also, consider defining specific interfaces for the different types of renderers to improve type safety and code readability. The function recursively calls itself, so it could potentially lead to a stack overflow error if the renderer object is too deeply nested. Consider adding a check to prevent this. function sanitizeRenderer(renderer) { if (!renderer) return null; const result = { type: renderer.type }; for (const key in renderer) { if (key === "type") continue; if (Array.isArray(renderer[key])) result[key] = renderer[key].map((item) => (typeof item === "object" ? sanitizeRenderer(item) : item)); else if (typeof renderer[key] === "object") result[key] = sanitizeRenderer(renderer[key]); else result[key] = renderer[key]; } return result; } //# sourceMappingURL=sanitizeRenderer.js.map