Utils

Utility functions and helpers for forms, dates, strings, passwords, and more.

Counters

Name
Description
getStackCounterContent
Returns the counter content for a stack display based on the number of items, counter type, and item limit.

Data

Name
Description
convertToSelectOptions
Converts an array of objects into SelectOption[] by mapping specified keys or transformation functions.
delay
Creates a promise that resolves after a specified delay in milliseconds.
getPaginatedData
Returns a paginated subset of an array.

Dates

Name
Description
formatLocalizedDate
Formats a date string (YYYY-MM-DD or ISO 8601) into a localized full date.
formatLocalizedDateTime
Formats a date (ISO string or timestamp) into a localized full date with optional time.

Encoding

Name
Description
encodeSvgToDataURI
Encodes an SVG string to a Data URI.

Errors

Name
Description
getEnvErrorMessage
Returns an error message depending on the environment.

Events

Name
Description
copyToClipboard
Copies text to the clipboard.

Form filters

Name
Description
filterAlphabetic
Filters out non-alphabetic characters from a given string.

Form validation

Name
Description
validateArrayField
Validates whether a given array field is not empty.
validateBooleanField
Validates whether a given boolean field is true.
validateDateRange
Validates whether a given date range is valid.
validateEmail
Validates whether a given value is a valid email address.
validateField
Validates whether a given value is present (not null, undefined, or empty string).
validatePasswordMatch
Validates that two password values match.
validateUrl
Validates whether a given value is a valid URL.

Numbers

Name
Description
formatNumberWithThousands
Formats a number into a string with thousands separators using Intl locale rules.

Passwords

Name
Description
evaluateSecurePasswordConditions
Evaluates secure password conditions.
generateSecurePassword
Generates a secure password that meets specified security requirements.
isSecurePassword
Checks if all secure password conditions are fulfilled.

Ratings

Name
Description
getRatingIndicator
Returns an array of MDI icon names representing a indicator rating.

Strings

Name
Description
convertStringIntoSlugFormat
Converts a string into a URL-friendly slug format.
getCreditCardLastFourNumbers
Extracts the last four digits from a given credit card number.
getFullName
Returns the full name of a user by combining first and last names.
getInitials
Extracts initials from a full name string.
lowercaseFirstLetter
Converts the first letter of a string to lowercase while keeping the rest unchanged.
trimText
Trims leading and trailing whitespace from a string.
uppercaseFirstLetter
Converts the first letter of a string to uppercase while keeping the rest unchanged.

Users

Name
Description
generateUsername
Generates a unique username based on the user's first name and last names.
getUserDisplayName
Generates a display name using the first name and only the first last name.