allExtensions

import { allExtensions } from "jsr:@ende/media-types";

function

function allExtensions(type: string): string[] | undefined

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 ..

type: string

The media type to get the extensions for.

Returns

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

Example: Usage

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

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

Source