TitleCase
Functions
Section titled “Functions”- Number(number) ⇒
string Formats a number to a string with thousand separators.
- TitleCase(str) ⇒
string Formats a string to title case.
- SentenceCase(str) ⇒
string Formats a string to sentence case.
- CamelCase(str) ⇒
string Formats a string to camel case.
- KebabCase(str) ⇒
string Formats a string to kebab case.
- SnakeCase(str) ⇒
string Formats a string to snake case.
- DateFor(date, [order]) ⇒
string Formats a date as a string with a customizable order of day, month and year.
Number(number) ⇒ string
Section titled “Number(number) ⇒ string”Formats a number to a string with thousand separators.
Kind: global function
Returns: string - The formatted string.
| Param | Type | Description |
|---|---|---|
| number | number | The number to format. |
Example
console.log(formats.Number(10000))TitleCase(str) ⇒ string
Section titled “TitleCase(str) ⇒ string”Formats a string to title case.
Kind: global function
Returns: string - The formatted string.
| Param | Type | Description |
|---|---|---|
| str | string | The string to format. console.log(formats.TitleCase(“Example of text”)) |
SentenceCase(str) ⇒ string
Section titled “SentenceCase(str) ⇒ string”Formats a string to sentence case.
Kind: global function
Returns: string - The formatted string.
| Param | Type | Description |
|---|---|---|
| str | string | The string to format. console.log(formats.SentenceCase(“Example Of Text”)) |
CamelCase(str) ⇒ string
Section titled “CamelCase(str) ⇒ string”Formats a string to camel case.
Kind: global function
Returns: string - The formatted string.
| Param | Type | Description |
|---|---|---|
| str | string | The string to format. console.log(formats.CamelCase(“Example of text”)) |
KebabCase(str) ⇒ string
Section titled “KebabCase(str) ⇒ string”Formats a string to kebab case.
Kind: global function
Returns: string - The formatted string.
| Param | Type | Description |
|---|---|---|
| str | string | The string to format. console.log(formats.KebabCase(“Example of text”)) |
SnakeCase(str) ⇒ string
Section titled “SnakeCase(str) ⇒ string”Formats a string to snake case.
Kind: global function
Returns: string - The formatted string.
| Param | Type | Description |
|---|---|---|
| str | string | The string to format. console.log(formats.SnakeCase(“Example of text”)) |
DateFor(date, [order]) ⇒ string
Section titled “DateFor(date, [order]) ⇒ string”Formats a date as a string with a customizable order of day, month and year.
Kind: global function
Returns: string - A string representation of the date.
| Param | Type | Default | Description |
|---|---|---|---|
| date | Date | The date to format. | |
| [order] | string | ”"dmy"“ | The order in which to display the day, month and year. Can be “dmy”, “mdy”, “ymd”, “ydm”, “myd” or “dym”. |
Example
console.log(formats.DateFor(new Date(), "dmy"))console.log(formats.DateFor(new Date(), "mdy"))console.log(formats.DateFor(new Date(), "ymd"))console.log(formats.DateFor(new Date(), "ydm"))console.log(formats.DateFor(new Date(), "myd"))console.log(formats.DateFor(new Date(), "dym"))