dotfiles/vscode/.vscode/extensions/matangover.mypy-0.3.1/node_modules/untildify/index.js
Errol Sancaktar 5f8db31398 alacritty
2024-07-15 17:06:13 -06:00

13 lines
331 B
JavaScript

'use strict';
const os = require('os');
const homeDirectory = os.homedir();
module.exports = pathWithTilde => {
if (typeof pathWithTilde !== 'string') {
throw new TypeError(`Expected a string, got ${typeof pathWithTilde}`);
}
return homeDirectory ? pathWithTilde.replace(/^~(?=$|\/|\\)/, homeDirectory) : pathWithTilde;
};