Initial commit
[yaffs-website] / node_modules / path-root / index.js
1 /*!
2  * path-root <https://github.com/jonschlinkert/path-root>
3  *
4  * Copyright (c) 2016, Jon Schlinkert.
5  * Licensed under the MIT License.
6  */
7
8 'use strict';
9
10 var pathRootRegex = require('path-root-regex');
11
12 module.exports = function(filepath) {
13   if (typeof filepath !== 'string') {
14     throw new TypeError('expected a string');
15   }
16
17   var match = pathRootRegex().exec(filepath);
18   if (match) {
19     return match[0];
20   }
21 };