The length of the random numeric string to append after the year and month. Defaults to 4.
Optional
validFunc: (id: string) => Promise<boolean>An optional asynchronous function that takes the generated ID as input and returns a boolean indicating its validity.
A promise that resolves to a unique identifier string in the format YYYYMM####
, where ####
is a random number of the specified length.
Generates a unique identifier string consisting of the current year and month, followed by a random numeric string of specified length. Optionally, a validation function can be provided to ensure the generated ID meets custom criteria.