Files
release-action/node_modules/untildify/index.js
Nick Cipollo 10c84d509b
Some checks failed
Test / check_pr (push) Has been cancelled
Prepare release 1.8.8
2021-08-06 14:45:16 -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;
};