Function allExtensions

  • Returns all the extensions known to be associated with the media type type, or undefined if no extensions are found.

    Extensions are returned without a leading ..

    Parameters

    • type: string

      The media type to get the extensions for.

    Returns string[] | undefined

    The extensions for the given media type, or undefined if no extensions are found.

    import { allExtensions } from "@std/media-types/all-extensions";
    import { assertEquals } from "@std/assert";

    assertEquals(allExtensions("application/json"), ["json", "map"]);
    assertEquals(allExtensions("text/html; charset=UTF-8"), ["html", "htm", "shtml"]);
    assertEquals(allExtensions("application/foo"), undefined);