IF Commons GitHub

path

Written to: 1 requirement: 1 proved, 0 partly, 0 failing, 0 with no test recorded. 0001-system FR-003

Paths, on node:path (commons 0001-system FR-003): the platform's own rules, and posix and win32 for the other's, with file: URLs both ways. Taken from Stolos's src/archon/core/path.ts, which already used node:path; it replaces @std/path.

import { basename, join } from "./path.ts";
basename(join("a", "b", "c.txt")); // "c.txt"

Source: commons/system/src/path.ts

10 of 34 exports are imported by a test of the run. A test that imports an export may not call it or check what it returns.

pathnamespace
namespace path
path.joinconstno test imports it
const join: (...paths: string[]) => string

Path segments joined and normalized.

path.dirnameconstno test imports it
const dirname: (path: string) => string

The folder a path is in.

path.basenameconstno test imports it
const basename: (path: string, suffix?: string | undefined) => string

The last segment of a path, without suffix where it ends with it.

path.extnameconstno test imports it
const extname: (path: string) => string

The extension of the last segment, with its dot (.ts), or "".

path.relativeconstno test imports it
const relative: (from: string, to: string) => string

The path from one to the other.

path.resolveconstno test imports it
const resolve: (...paths: string[]) => string

An absolute path, the segments taken from the right until one is absolute, against the working folder.

path.normalizeconstno test imports it
const normalize: (path: string) => string

A path with . and .. and repeated separators resolved.

path.isAbsoluteconstno test imports it
const isAbsolute: (path: string) => boolean

Whether a path is absolute.

path.parseconstno test imports it
const parse: (path: string) => ParsedPath

A path's root, folder, base, name and extension.

path.formatconstno test imports it
const format: (parts: FormatInputPathObject) => string

A path made from its parts.

path.sepconstno test imports it
const sep: string

This platform's separator between segments: /, or \ on Windows.

path.delimiterconstno test imports it
const delimiter: string

This platform's separator between paths in PATH: :, or ; on Windows.

path.posixconstno test imports it
const posix: typeof path

The POSIX rules, on any platform.

path.win32constno test imports it
const win32: typeof path

The Windows rules, on any platform.

path.fromFileUrlfunctionno test imports it
function fromFileUrl(url: string | URL): string

A file: URL as a path.

path.toFileUrlfunctionno test imports it
function toFileUrl(path: string): URL

A path as a file: URL.

path.toPosixfunctionno test imports it
function toPosix(path: string): string

A path with / between its segments whatever the platform, as archives and URLs write them.

joinconst
const join: (...paths: string[]) => string

Path segments joined and normalized.

Imported by 72 tests of the run (72 passed, 0 failed): the library's results

dirnameconst
const dirname: (path: string) => string

The folder a path is in.

Imported by 16 tests of the run (16 passed, 0 failed): the library's results

basenameconst
const basename: (path: string, suffix?: string | undefined) => string

The last segment of a path, without suffix where it ends with it.

Imported by 23 tests of the run (23 passed, 0 failed): the library's results

extnameconstno test imports it
const extname: (path: string) => string

The extension of the last segment, with its dot (.ts), or "".

relativeconstno test imports it
const relative: (from: string, to: string) => string

The path from one to the other.

resolveconst
const resolve: (...paths: string[]) => string

An absolute path, the segments taken from the right until one is absolute, against the working folder.

Imported by 7 tests of the run (7 passed, 0 failed): the library's results

normalizeconstno test imports it
const normalize: (path: string) => string

A path with . and .. and repeated separators resolved.

isAbsoluteconstno test imports it
const isAbsolute: (path: string) => boolean

Whether a path is absolute.

parseconstno test imports it
const parse: (path: string) => ParsedPath

A path's root, folder, base, name and extension.

formatconstno test imports it
const format: (parts: FormatInputPathObject) => string

A path made from its parts.

sepconstno test imports it
const sep: string

This platform's separator between segments: /, or \ on Windows.

delimiterconst
const delimiter: string

This platform's separator between paths in PATH: :, or ; on Windows.

Imported by 9 tests of the run (9 passed, 0 failed): the library's results

posixconst
const posix: typeof path

The POSIX rules, on any platform.

Imported by 9 tests of the run (9 passed, 0 failed): the library's results

win32const
const win32: typeof path

The Windows rules, on any platform.

Imported by 9 tests of the run (9 passed, 0 failed): the library's results

fromFileUrlfunction
function fromFileUrl(url: string | URL): string

A file: URL as a path.

Imported by 13 tests of the run (13 passed, 0 failed): the library's results

toFileUrlfunction
function toFileUrl(path: string): URL

A path as a file: URL.

Imported by 21 tests of the run (21 passed, 0 failed): the library's results

toPosixfunction
function toPosix(path: string): string

A path with / between its segments whatever the platform, as archives and URLs write them.

Imported by 9 tests of the run (9 passed, 0 failed): the library's results

Titles, headings, exports, tables, columns and requirements. Esc closes.