Skip to content

Latest commit

 

History

History
83 lines (66 loc) · 2.36 KB

File metadata and controls

83 lines (66 loc) · 2.36 KB

Overview

path.mjs provides functions for FS paths. Features:

  • Various common operations such as path joining, relativity, getting dirname / filename / extension, and more.
  • Only string operations, no IO.
  • OS-agnostic.
    • Supports Windows volumes.
    • Always normalizes \ to /.
  • Tiny, no external dependencies.
  • Can be customized via subclassing.

Known limitations:

  • Insufficient documentation.
  • Immature. Tests may be incomplete.
  • Performance has not been optimized.

TOC

Usage

Using a specific implementation:

import * as pt from 'https://cdn.jsdelivr.net/npm/@mitranim/js@0.1.85/path.mjs'

console.log(pt.join(`one`, `two`, `three.four`))
// 'one/two/three.four'

console.log(pt.dir(`one/two/three.four`))
// 'one/two'

console.log(pt.name(`one/two/three.four`))
// 'three.four'

console.log(pt.stem(`one/two/three.four`))
// 'three'

API

Undocumented

The following APIs are exported but undocumented. Check path.mjs.