@io-arc/path-build

Convert an array to a relative or absolute path.

Usage#

$ npm i @io-arc/path-build
index.ts
import PathBuild from '@io-arc/path-build'
const dist = PathBuild.relative(['abc', 'def'])
// -> 'abc/def'
const ab = PathBuild.absolute(['abc', 'def'])
// -> '/Users/xxxx/xxxx/abc/def'

Methods#

No New instance.
This class is static function.

PathBuild.relative(dir)#

Return: string

Create path join.
Near as path.join in node.js.

Parameters

paramstypedefaultdescription
dirstring[]-Array of directory names to be converted

PathBuild.absolute(dir)#

Return: string

Create an absolute path from root.
Near as path.resolve in node.js.

Parameters

paramstypedefaultdescription
dirstring[]-Array of directory names to be converted