| Leo Repp | 58b9f11 | 2021-11-22 11:57:47 +0100 | [diff] [blame^] | 1 | 'use strict'; |
| 2 | |||||
| 3 | var isUncPath = require('is-unc-path'); | ||||
| 4 | |||||
| 5 | module.exports = function isRelative(filepath) { | ||||
| 6 | if (typeof filepath !== 'string') { | ||||
| 7 | throw new TypeError('expected filepath to be a string'); | ||||
| 8 | } | ||||
| 9 | |||||
| 10 | // Windows UNC paths are always considered to be absolute. | ||||
| 11 | return !isUncPath(filepath) && !/^([a-z]:)?[\\\/]/i.test(filepath); | ||||
| 12 | }; | ||||