source: imaps-frontend/node_modules/path-is-absolute/index.js@ d565449

main
Last change on this file since d565449 was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago

Update repo after prototype presentation

  • Property mode set to 100644
File size: 611 bytes
Line 
1'use strict';
2
3function posix(path) {
4 return path.charAt(0) === '/';
5}
6
7function win32(path) {
8 // https://github.com/nodejs/node/blob/b3fcc245fb25539909ef1d5eaa01dbf92e168633/lib/path.js#L56
9 var splitDeviceRe = /^([a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?([\\\/])?([\s\S]*?)$/;
10 var result = splitDeviceRe.exec(path);
11 var device = result[1] || '';
12 var isUnc = Boolean(device && device.charAt(1) !== ':');
13
14 // UNC paths are always absolute
15 return Boolean(result[2] || isUnc);
16}
17
18module.exports = process.platform === 'win32' ? win32 : posix;
19module.exports.posix = posix;
20module.exports.win32 = win32;
Note: See TracBrowser for help on using the repository browser.