版博士V2.0程序
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.
 
 
 
 

22 linhas
424 B

  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. };