Skip to content

Commit

Permalink
Allow turning strings into camelCase
Browse files Browse the repository at this point in the history
  • Loading branch information
FinlayDaG33k committed Aug 20, 2023
1 parent 4770d00 commit 4c4e347
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions utility/inflector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,16 @@ export class Inflector {
.replaceAll(' ', '');
}

/**
* Turn a string into camelCase
*
* @param input
* @param delimiter Optional delimiter by which to split the string
*/
public static camelize(input: string, delimiter: string = '_'): string {
return this.lcfirst(this.pascalize(input, delimiter));
}

/**
* Return the input lower_case_delimited_string as "A Human Readable String".
* (Underscores are replaced by spaces and capitalized following words.)
Expand Down

0 comments on commit 4c4e347

Please sign in to comment.