You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1234567891011121314151617181920
  1. 'use strict';
  2. function posix(path) {
  3. return path.charAt(0) === '/';
  4. }
  5. function win32(path) {
  6. // https://github.com/nodejs/node/blob/b3fcc245fb25539909ef1d5eaa01dbf92e168633/lib/path.js#L56
  7. var splitDeviceRe = /^([a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?([\\\/])?([\s\S]*?)$/;
  8. var result = splitDeviceRe.exec(path);
  9. var device = result[1] || '';
  10. var isUnc = Boolean(device && device.charAt(1) !== ':');
  11. // UNC paths are always absolute
  12. return Boolean(result[2] || isUnc);
  13. }
  14. module.exports = process.platform === 'win32' ? win32 : posix;
  15. module.exports.posix = posix;
  16. module.exports.win32 = win32;