@particle/untildify

3.0.2 • Public • Published

@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

Dependents (2)

Package Sidebar

Install

npm i @particle/untildify

Weekly Downloads

0

Version

3.0.2

License

UNLICENSED

Unpacked Size

3.91 kB

Total Files

4

Last publish

Collaborators

  • jackson-particle
  • mike.grundy.npm
  • mohitparticle
  • eugene_particle
  • kmok23
  • karlag
  • cole-abbeduto-particle
  • pedrosordo
  • guohui
  • sbrust
  • particlebot
  • no1089
  • carlos.hdez
  • keeramis5
  • monkbroc
  • suda
  • mstan
  • sergeuz
  • debbie23
  • avtolstoy
  • mlauer
  • wraithan
  • azenk
  • bwalach
  • parteberseth
  • rickkas7
  • mrlambchop_particle
  • hugo.montero
  • mphsi