@antora/expand-path-helper
A node module that exports a helper function to expand a path to an absolute path, first resolving leading shortcuts such as tilde (~
) and tilde plus (~+
).
Developed for use in Antora.
Install
$ npm i @antora/expand-path-helper
or
$ yarn add @antora/expand-path-helper
Usage
*nix
const expandPath = require('@antora/expand-path-helper')
expandPath('/absolute/path')
expandPath('foo/bar')
expandPath('~/foo/bar')
expandPath('~+/foo/bar')
Windows
const expandPath = require('@antora/expand-path-helper')
expandPath('C:\\absolute\\path')
expandPath('foo\\bar')
expandPath('~\\foo\\bar')
expandPath('~+\\foo\\bar')
On Windows, the input path may contain forward slashes, but the expanded path will always have backslashes.
Copyright and License
Copyright (C) 2018 OpenDevise Inc. and the Antora Project.
Use of this software is granted under the terms of the Mozilla Public License Version 2.0 (MPL-2.0).