/**
 * Convert a snake_case string to camelCase.
 * @example "account_id" -> "accountId", "created_at" -> "createdAt"
 */
export function snakeToCamelString(s) {
    return s.replace(/_([a-z])/g, (_, c) => c.toUpperCase());
}
/**
 * Recursively convert an object's keys from snake_case to camelCase.
 * Arrays and nested objects are traversed; primitives, Date, and RegExp are returned as-is.
 */
export function snakeToCamelObjectDeep(obj) {
    if (obj === undefined || obj === null) {
        return obj;
    }
    if (typeof obj !== "object") {
        return obj;
    }
    if (obj instanceof RegExp || obj instanceof Date) {
        return obj;
    }
    if (Array.isArray(obj)) {
        return obj.map(snakeToCamelObjectDeep);
    }
    return Object.fromEntries(Object.entries(obj).map(([key, value]) => [
        snakeToCamelString(key),
        typeof value === "object" && value !== null && !Array.isArray(value)
            ? snakeToCamelObjectDeep(value)
            : Array.isArray(value)
                ? value.map(snakeToCamelObjectDeep)
                : value,
    ]));
}
//# sourceMappingURL=snake-to-camel.js.map