UNPKG

pibb

Version:

Private Institutional Bulletin Board - I2I Platform for Private Transactions

13 lines (9 loc) 331 B
'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; };