mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-09-22 05:40:48 +02:00
Update helpers.expandTildePath to handle receiving an os object without homedir, address minor @ts-check confusion in same file.
This commit is contained in:
parent
95466e29be
commit
5b0588f378
3 changed files with 6 additions and 5 deletions
|
@ -1126,7 +1126,7 @@ module.exports.getNextChildToken = getNextChildToken;
|
|||
* @returns {string} Absolute path (or original path).
|
||||
*/
|
||||
function expandTildePath(file, os) {
|
||||
const homedir = os && os.homedir();
|
||||
const homedir = os && os.homedir && os.homedir();
|
||||
return homedir ? file.replace(/^~($|\/|\\)/, `${homedir}$1`) : file;
|
||||
}
|
||||
module.exports.expandTildePath = expandTildePath;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue