Welcome to mirror list, hosted at ThFree Co, Russian Federation.

index.js « is-relative « node_modules - github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: ffc760a82a5dabf074505a70cc4f296c3099211b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
'use strict';

/**
 * ```js
 * var isRelative = require('is-relative');
 * isRelative('README.md');
 * //=> true
 * ```
 *
 * @name isRelative
 * @param {String} `filepath` Path to test.
 * @return {Boolean}
 * @api public
 */

module.exports = function isRelative(filepath) {
  if (typeof filepath !== 'string') {
    throw new Error('isRelative expects a string.');
  }
  return !/^([a-z]+:)?[\\\/]/i.test(filepath);
};