Detalhes do pacote

replace-homedir

gulpjs5.7mMIT2.0.0

Replace user home in a string with another string. Useful for tildifying a path.

path, homedir, tilde, replace

readme (leia-me)

replace-homedir

NPM version Downloads Build Status Coveralls Status

Replace user home in a string with another string. Useful for tildifying a path.

Usage

var replaceHomedir = require('replace-homedir');

var shortPath = replaceHomedir('/Users/phated/myProject', '~');
// shortPath === '~/myProject'

API

replaceHomedir(path, replacement)

Takes a string path as the first argument and a string or function replacement as the second argument. If the path is absolute and begins with the User's homedir, the homedir portion of the path is replaced with replacement using String#replace.

If path is not a string, the function will throw.

License

MIT

changelog (log de mudanças)

Changelog

2.0.0 (2022-01-31)

⚠ BREAKING CHANGES

  • Normalize repository, dropping node <10.13 support (#2)

Features

  • Remove all dependencies and only rely on node APIs (0a27bc1)

Miscellaneous Chores

  • Normalize repository, dropping node <10.13 support (#2) (0a27bc1)