ts-utils
  • Getting Started
  • Contributing
  • Testing
  • Functions
    • Array Methods
      • isArr
      • isArrEmpty
      • pushUniqueValue
      • pushOrUpdate
    • Date Methods
      • toNow
      • formatDate
      • fromNow
    • Number Methods
      • toFixed
      • parseNumber
      • parseFormat
      • addUnit
      • addSeparators
      • formatNumber
      • ensureNumber
      • numberEmptyState
    • Object Methods
      • parseJSON
      • deepClone
      • parseNumValues
      • removeEmptyKeys
      • sanitizeQuery
      • removeKeys
      • renameKey
      • renameKeys
      • sortByKeyLength
      • querylize
      • parseNumericObj
      • reserveKeys
      • hasKeysAndValues
    • String Methods
      • randomStr
      • toUpperCase
      • toLowerCase
      • toFullUrl
      • initials
      • generateUuid
Powered by GitBook
On this page
  • generateUuid()
  • Returns
  • Example
  • Usage
  • Notes

Was this helpful?

  1. Functions
  2. String Methods

generateUuid

generateUuid()

Generates a Universally Unique Identifier (UUID) in the standard format. This function creates a random UUID following the UUID version 4 format.

Returns

  • string: A randomly generated UUID in the standard format.

Example

typescript
import { generateUuid } from 'check-engineering/ts-utils';

const newUuid = generateUuid(); // => "550e8400-e29b-41d4-a716-446655440000"

Usage

typescript
import { generateUuid } from 'check-engineering/ts-utils';

const uniqueId = generateUuid(); // => "f47ac10b-58cc-4372-a567-0e02b2c3d479"

Notes

  • The generateUuid function creates a random UUID that conforms to the UUID version 4 format.

  • It ensures uniqueness by generating a random sequence of hexadecimal characters with specific formatting.

  • UUIDs are commonly used for uniquely identifying entities in various systems and applications.

Previousinitials

Last updated 11 months ago

Was this helpful?