src/stones/cases

Source   Edit  

Types

Case = enum
  Default = "DEFAULT", Camel = "CAMEL", Kebab = "KEBAB", Lower = "LOWER",
  Pascal = "PASCAL", Snake = "SNAKE", Upper = "UPPER"
Supported case types. Source   Edit  
UnsupportedCharacterError = object of ValueError
Source   Edit  

Procs

proc allCases(s: string; c: Case = Default; acronyms: HashSet[string] = acronyms): Table[
    Case, string] {....raises: [UnsupportedCharacterError, Exception], tags: [],
                    forbids: [].}
Get a Table[Case, string] of all the difference cases from s. Source   Edit  
proc camelCase(s: string; acronyms: HashSet[string] = acronyms): string {.
    ...deprecated: "Use `toCamelCase()` instead.", raises: [], tags: [],
    forbids: [].}
Deprecated: Use `toCamelCase()` instead.
toCamelCase() Source   Edit  
proc currentCase(s: string): Case {....raises: [UnsupportedCharacterError],
                                    tags: [], forbids: [].}
Guess the current case format of the string (not tested for edge cases). Returns Default if its not able to properly determine its case. Source   Edit  
proc format(c: Case; s: string; acronyms: HashSet[string] = acronyms): string {.
    ...raises: [UnsupportedCharacterError], tags: [], forbids: [].}
Convert s into the specified Case c based on the best guess of the current Case Source   Edit  
proc fromCamelCase(s: string; acronyms: HashSet[string] = acronyms): string {.
    ...raises: [], tags: [], forbids: [].}
Converts camelCase string to snake_case. Source   Edit  
proc fromKebabCase(s: string): string {....raises: [], tags: [], forbids: [].}
Converts kebab-case string to snake_case. Source   Edit  
proc fromPascalCase(s: string; acronyms: HashSet[string] = acronyms): string {.
    ...raises: [], tags: [], forbids: [].}
Converts PascalCase string to snake_case. Source   Edit  
proc fromUpperCase(s: string): string {....raises: [], tags: [], forbids: [].}
Converts UPPER_CASE string to snake_case. Source   Edit  
proc kebabCase(s: string): string {....deprecated: "Use `toKebabCase()` instead.",
                                    raises: [], tags: [], forbids: [].}
Deprecated: Use `toKebabCase()` instead.
toKebabCase() Source   Edit  
proc lowerCase(s: string): string {....deprecated: "Use `toLowerCase()` instead.",
                                    raises: [], tags: [], forbids: [].}
Deprecated: Use `toLowerCase()` instead.
toLowerCase() Source   Edit  
proc pascalCase(s: string; acronyms: HashSet[string] = acronyms): string {.
    ...deprecated: "Use `toPascalCase()` instead.", raises: [], tags: [],
    forbids: [].}
Deprecated: Use `toPascalCase()` instead.
toPascalCase() Source   Edit  
proc setAcronyms(configAcronyms: HashSet[string]): void {....raises: [], tags: [],
    forbids: [].}
Setter for acronyms to always apply ALLCAPS. Source   Edit  
proc toCamelCase(s: string; acronyms: HashSet[string] = acronyms): string {.
    ...raises: [], tags: [], forbids: [].}
Converts snake_case string to camelCase. Source   Edit  
proc toKebabCase(s: string): string {....raises: [], tags: [], forbids: [].}
Converts snake_case string to kebab-case. Source   Edit  
proc toLowerCase(s: string): string {....raises: [], tags: [], forbids: [].}
Converts snake_case string to lowercase. Source   Edit  
proc toPascalCase(s: string; acronyms: HashSet[string] = acronyms): string {.
    ...raises: [], tags: [], forbids: [].}
Converts snake_case string to PascalCase. Source   Edit  
proc toUpperCase(s: string): string {....raises: [], tags: [], forbids: [].}
Converts snake_case string to UPPER_CASE. Source   Edit  
proc upperCase(s: string): string {....deprecated: "Use `toUpperCase()` instead.",
                                    raises: [], tags: [], forbids: [].}
Deprecated: Use `toUpperCase()` instead.
toUpperCase() Source   Edit