Sorci.js
    Preparing search index...

    Function createId

    • Creates a unique identifier. If an ID is provided, it returns that ID; otherwise, it generates a new ULID (Universally Unique Lexicographically Sortable Identifier).

      Parameters

      • Optionalid: string

        Optional existing ID to return. If not provided, a new ULID will be generated.

      Returns string

      The provided ID or a newly generated ULID.

      const newId = createId(); // Returns a new ULID, e.g., "01ARZ3NDEKTSV4RRFFQ69G5FAV"
      const existingId = createId("custom-id"); // Returns "custom-id"