function extname
extname(url: string | URL): stringReturn the extension of the URL with leading period. The extension is
sourced from the path portion of the URL. If there is no extension,
an empty string is returned.
Examples
Example 1
Example 1
import { extname } from "@std/url/extname"; console.log(extname("https://deno.land/std/path/mod.ts")); // ".ts" console.log(extname("https://deno.land/std/path/mod")); // "" console.log(extname("https://deno.land/std/path/mod.ts?a=b")); // ".ts" console.log(extname("https://deno.land/")); // ""
Parameters
Return Type
extension (e.g. for url ending with index.html returns .html)