Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/ayonli_jsext/esm/path/index.js>extname

A JavaScript extension package for building strong and modern applications.
Latest
function extname
import { extname } from "https://deno.land/x/ayonli_jsext@v0.9.72/esm/path/index.js";

Returns the extension of the path with leading period.

Examples

Example 1

import { extname } from "@ayonli/jsext/path";

console.log(extname("/foo/bar.txt")); // ".txt"
console.log(extname("c:\\foo\\bar.txt")); // ".txt"
console.log(extname("file:///foo/bar.txt")); // ".txt"
console.log(extname("http://example.com/foo/bar.txt")); // ".txt"
console.log(extname("http://example.com/foo/bar.txt?foo=bar#baz")); // ".txt"