kaven-basic - v6.0.0
    Preparing search index...

    Function GenerateYearMonthId

    • 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.

      Parameters

      • randomLength: number = 4

        The length of the random numeric string to append after the year and month. Defaults to 4.

      • OptionalvalidFunc: (id: string) => Promise<boolean>

        An optional asynchronous function that takes the generated ID as input and returns a boolean indicating its validity.

      Returns Promise<string>

      A promise that resolves to a unique identifier string in the format YYYYMM####, where #### is a random number of the specified length.

      4.0.0

      2021-12-11