Convert a tilde path to an absolute path: ~/dev → /Users/sindresorhus/dev
- Types
- ESM
- License
- MIT
- Deps
- 0
- Install Size
- 4 kB
- Vulns
- 0
- Published
$
npm install untildify$
pnpm add untildify$
yarn add untildify$
bun add untildify$
deno add npm:untildify$
vlt install untildify$
vp add untildifyuntildify
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
~usernameto the home directory when username matches the current user - Returns path unchanged if username doesn't match the current user
Related
See tildify for the inverse.