Skip to main content
Module

std/path/extname.ts

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);}