Module utils

Module utils 

Source

Functions§

get_file_stem
Extract the file stem (name without extension) from a path
is_prisma_reserved
Check if a string is a reserved word in Prisma
is_ts_reserved
Check if a string is a reserved word in TypeScript/JavaScript
path_to_type_name
Generate a type name from a path (e.g., [“user”, “address”] → “UserAddress”)
read_file
Read a file’s contents as a string
sanitize_identifier
Sanitize an identifier to be valid in most languages
to_camel_case
Convert a string to camelCase (e.g., “user_name” → “userName”)
to_pascal_case
Convert a string to PascalCase (e.g., “user_name” → “UserName”)
to_snake_case
Convert a string to snake_case (e.g., “UserName” → “user_name”)
write_file
Write content to a file, creating parent directories if needed