Няма описание

12345678910111213141516171819202122
  1. /*!
  2. * expand-tilde <https://github.com/jonschlinkert/expand-tilde>
  3. *
  4. * Copyright (c) 2015 Jon Schlinkert.
  5. * Licensed under the MIT license.
  6. */
  7. var homedir = require('homedir-polyfill');
  8. var path = require('path');
  9. module.exports = function expandTilde(filepath) {
  10. var home = homedir();
  11. if (filepath.charCodeAt(0) === 126 /* ~ */) {
  12. if (filepath.charCodeAt(1) === 43 /* + */) {
  13. return path.join(process.cwd(), filepath.slice(2));
  14. }
  15. return home ? path.join(home, filepath.slice(1)) : filepath;
  16. }
  17. return filepath;
  18. };