• Returns the default value if the given text is empty, or the text self if it is not empty

    Parameters

    • Optionaltext: null | string

      the text to check

    • OptionaldefaultValue: null | string

      the default value placeholder

    Returns string | undefined | null

    the default value if the given text is empty, or the text self if it is not empty

    defaultIfEmpty(undefined, 'foobar');    // 'foobar'