index.js 343 B

123456789101112
  1. 'use strict';
  2. var isUncPath = require('is-unc-path');
  3. module.exports = function isRelative(filepath) {
  4. if (typeof filepath !== 'string') {
  5. throw new TypeError('expected filepath to be a string');
  6. }
  7. // Windows UNC paths are always considered to be absolute.
  8. return !isUncPath(filepath) && !/^([a-z]:)?[\\\/]/i.test(filepath);
  9. };