import { extname } from "https://deno.land/std@0.202.0/url/extname.ts";
Return 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 "https://deno.land/std@0.202.0/url/extname.ts";
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
url: string | URL
with extension