Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

untildify

sindresorhus55.7mMIT6.0.0TypeScript support: included

Convert a tilde path to an absolute path: ~/dev/Users/sindresorhus/dev

tilde, expansion, expand, untildify, path, home, directory, user, shell, bash

readme

untildify

Convert a tilde path to an absolute path: ~/dev/Users/sindresorhus/dev

Install

npm install untildify

Usage

import untildify from 'untildify';

untildify('~/dev');
//=> '/Users/sindresorhus/dev'

// Assuming the current user is 'sindresorhus'
untildify('~sindresorhus/dev');
//=> '/Users/sindresorhus/dev'

Features

  • Expands ~ to the current user's home directory
  • Expands ~username to the home directory when username matches the current user
  • Returns path unchanged if username doesn't match the current user

See tildify for the inverse.