This release is 47 versions behind 1.1.4 — the latest version of @std/path. Jump to latest
Works with
•JSR Score94%•This package works with Cloudflare Workers, Deno, Browsers


Downloads120,551/wk
•Published2 years ago (0.199.0)
Utilities for working with file system paths
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license. // This module is browser compatible. import { isWindows } from "jsr:/@std/internal@^0.199.0/os"; import { posixBasename, windowsBasename } from "./_basename.ts"; /** * Return the last portion of a `path`. * Trailing directory separators are ignored, and optional suffix is removed. * * @param path - path to extract the name from. * @param [suffix] - suffix to remove from extracted name. */ export function basename(path: string, suffix = ""): string { return isWindows ? windowsBasename(path, suffix) : posixBasename(path, suffix); }