Package Exports
- replace-homedir
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (replace-homedir) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
replace-homedir
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