Files
release-action/node_modules/untildify/index.js
Nick Cipollo 238505795d
Some checks failed
Test / check_pr (push) Has been cancelled
Prepare 1.8.9 release
2021-09-12 18:09:12 -04: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;
};