Skip to main content
Using Deno in production at your company? Earn free Deno merch.
Give us feedback
Module

std/path/extname.ts

The Deno Standard Library
Go to Latest
File
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.// This module is browser compatible.
import { isWindows } from "./_os.ts";import { extname as posixExtname } from "./posix/extname.ts";import { extname as windowsExtname } from "./windows/extname.ts";/** * Return the extension of the `path` with leading period. * @param path with extension * @returns extension (ex. for `file.ts` returns `.ts`) */export function extname(path: string): string { return isWindows ? windowsExtname(path) : posixExtname(path);}