dummy-typescript-api
This module contains generic utility functions useful for various operations.
Utilities include formatting currencies, manipulating strings, generating identifiers, and validating inputs.
formatCurrency(
amount
,currencyCode
):string
Defined in: utilities.ts:17
Formats a number as currency with a given currency code. Utilizes the Intl.NumberFormat API to handle locale-specific currency formatting.
Parameter | Type | Description |
---|---|---|
amount |
number |
The numeric value to be formatted. |
currencyCode |
string |
The ISO currency code (e.g., USD, EUR) to specify the currency. |
string
The formatted currency string in the format "$1,234.56".
generateUniqueId():
string
Defined in: utilities.ts:41
Converts a string to title case, making the first character of each word uppercase. Effective for formatting titles or names in a readable format.
string
The string transformed to title case.
isValidEmail(
boolean
Defined in: utilities.ts:65
Function to check if a value is a valid email address.
Parameter | Type | Description |
---|---|---|
email |
string |
The email address to be validated. |
boolean
True if the email address is valid, false otherwise.
shuffleArray<
T
>(array
):T
[]
Defined in: utilities.ts:75
Function to shuffle an array.
Type Parameter |
---|
T |
Parameter | Type | Description |
---|---|---|
array |
T [] |
The array to be shuffled. |
T
[]
The shuffled array.
toTitleCase(
input
):string
Defined in: utilities.ts:29
Function to convert a string to title case.
Parameter | Type | Description |
---|---|---|
input |
string |
The input string. |
string
The input string in title case.
truncateString(
input
,maxLength
):string
Defined in: utilities.ts:53
Function to truncate a string to a specified length.
Parameter | Type | Description |
---|---|---|
input |
string |
The input string. |
maxLength |
number |
The maximum length of the truncated string. |
string
The truncated string.