You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

index.js 424B

123456789101112131415161718192021
  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. 'use strict';
  8. var pathRootRegex = require('path-root-regex');
  9. module.exports = function(filepath) {
  10. if (typeof filepath !== 'string') {
  11. throw new TypeError('expected a string');
  12. }
  13. var match = pathRootRegex().exec(filepath);
  14. if (match) {
  15. return match[0];
  16. }
  17. };