Function getConversionTarget

  • For a media type converter that can generate the given types, this function tries to find the type that best matches the given preferences.

    This function combines several other conversion utility functions to determine what output a converter should generate: it cleans the preferences with cleanPreferences to support empty preferences and to prevent the accidental generation of internal types, after which the best match gets found based on the weights.

    Parameters

    Returns string | undefined

    The best match. Undefined if there is no match.