Détail du package

@particle/untildify

particlebot18UNLICENSED3.0.2

Expand the ~ shortcut at the start of a path into the current user's $HOME directory

readme

@particle/untildify

Expand the ~ shortcut at the start of a path into the current user's $HOME directory

Installation

npm install @particle/untildify --save

API

@particle/untildify


module.exports(pathStr) ⇒ string

Expand ~ at the start of a path to an absolute path to the user's $HOME directory

Kind: Exported function
Returns: string - An absolute path to a location within the user's $HOME directory or the original path if ~ character is not found

Param Type Description
pathStr string Path string to operate on

Example

const pathToBashRc = untildify('~/.bashrc');
console.log(pathToBashRc); // -> '/Users/me/.bashrc'

NOTE: Unfortunately, docs have a nasty habit of falling out of date. When in doubt, check usage in tests