版博士V2.0程序
Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.
 
 
 
 

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