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
A unique id
Generated using TypeDoc
Generates a unique id
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