pub fn sanitize_identifier(id: &str) -> StringExpand description
Sanitize an identifier to be a valid TypeScript/JavaScript identifier
Removes or replaces invalid characters:
- Preserves content inside parentheses and converts to camelCase: “(csv)” -> “Csv”
- Replaces slashes with “Or”: “/” -> “Or”
- Removes other invalid characters: spaces, special chars
- Ensures it starts with a letter or underscore
Examples:
- “getDownloadExport(csv)” -> “getDownloadExportCsv”
- “getUser/organizationSettings” -> “getUserOrOrganizationSettings”
- “postSolveRoutes(aliasOf/routes/plan)” -> “postSolveRoutesAliasOfOrRoutesOrPlan”