pnpm
Version:
A fast implementation of npm install
19 lines • 549 B
JavaScript
;
const osHomedir = require('os-homedir');
const path = require('path');
function expandTilde(filepath) {
const home = getHomedir();
if (filepath.indexOf('~/') !== 0) {
return filepath;
}
return path.resolve(home, filepath.substr(2));
}
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = expandTilde;
function getHomedir() {
const home = osHomedir();
if (!home)
throw new Error('Could not find the homedir');
return home;
}
//# sourceMappingURL=expandTilde.js.map