UNPKG

@translated/lara

Version:

Official Lara SDK for JavaScript and Node.js

19 lines (18 loc) 613 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const toSnakeCase = (content) => { if (typeof content === "string") return content; if (Array.isArray(content)) return content.map(toSnakeCase); if (typeof content === "object" && content !== null) { const result = {}; for (const [key, value] of Object.entries(content)) { const snakeKey = key.replace(/([A-Z])/g, "_$1").toLowerCase(); result[snakeKey] = toSnakeCase(value); } return result; } return content; }; exports.default = toSnakeCase;