Options
All
  • Public
  • Public/Protected
  • All
Menu

External module "unique-id"

Index

Functions

Functions

uniqueId

  • uniqueId(): number
  • uniqueId(prefix: string): string
  • Starts a new counter for every unique prefix and if a prefix is given, returns the id by prefixing it, otherwise returns the id as number


    Example usage:

    import { uniqueId } from "@thalesrc/js-utils";
    
    uniqueId(); // 0
    uniqueId(); // 1
    uniqueId("some-str"); // "some-str-0";
    uniqueId("some-str"); // "some-str-1";
    uniqueId(); // 3

    Returns number

    A unique id

  • Parameters

    • prefix: string

    Returns string

Generated using TypeDoc