summaryrefslogtreecommitdiff
path: root/deps/npm/node_modules/is-absolute/index.js
blob: 9df4d5c2406a978eea52b0630badfea22e3cac95 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
/*!
 * is-absolute <https://github.com/jonschlinkert/is-absolute>
 *
 * Copyright (c) 2014-2015, Jon Schlinkert.
 * Licensed under the MIT License.
 */

'use strict';

var isRelative = require('is-relative');

module.exports = function isAbsolute(filepath) {
  if ('/' === filepath[0]) {
    return true;
  }
  if (':' === filepath[1] && '\\' === filepath[2]) {
    return true;
  }
  // Microsoft Azure absolute filepath
  if ('\\\\' == filepath.substring(0, 2)) {
    return true;
  }
  if (!isRelative(filepath)) {
    return true;
  }
};