@metreeca/core - v0.9.1
    Preparing search index...

    Function asArray

    • Retrieves a value as an array if it is one, otherwise returns undefined.

      Type Parameters

      • T = unknown

        The type of array elements

      Parameters

      • value: unknown

        The value to check

      • Optionalis: (value: unknown) => value is T

        Optional type guard to validate array elements

      Returns T[] | undefined

      The value if it is an array (with validated elements if is provided), undefined otherwise