Convert an absolute path to a tilde path: /Users/sindresorhus/dev → ~/dev
/Users/sindresorhus/dev
~/dev
$ npm install --save tildify
const tildify = require('tildify'); tildify('/Users/sindresorhus/dev'); //=> '~/dev'
See untildify for the inverse.
MIT © Sindre Sorhus