index.js 249 Bytes Edit Raw Blame History 1 2 3 4 5 6 7 8 9 'use strict'; var path = require('path'); var osHomedir = require('os-homedir'); var home = osHomedir(); module.exports = function (str) { str = path.normalize(str) + path.sep; return str.replace(home + path.sep, '~' + path.sep).slice(0, -1); };