untildify

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

MIT 11 个版本
安装
npm install untildify
yarn add untildify
pnpm add untildify
bun add untildify
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.

版本列表
6.0.0 2025-09-09
5.0.0 2023-06-11
4.0.0 2019-04-29
3.0.3 2018-05-19
3.0.2 2016-05-07
3.0.1 2016-04-30
3.0.0 2016-04-27
2.1.0 2015-06-13
2.0.0 2015-02-02
1.0.0 2014-08-03
0.1.0 2014-04-19