Function transformAndEnsureRegExpArray

  • Transforms a string or an array of strings into an array of regular expressions.

    This function accepts a value that may be a single string, an array of strings, or undefined. It then:

    • Converts each string into a RegExp object.
    • Ensures that the result is always an array of RegExp objects.

    Parameters

    • stringMaybeArray: undefined | string | string[]

      The value to be transformed, which can be a single string, an array of strings, or undefined.

    Returns RegExp[]

    An array of RegExp objects. If the input is undefined, an empty array is returned.