版博士V2.0程序
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.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. # is-unc-path [![NPM version](https://img.shields.io/npm/v/is-unc-path.svg?style=flat)](https://www.npmjs.com/package/is-unc-path) [![NPM monthly downloads](https://img.shields.io/npm/dm/is-unc-path.svg?style=flat)](https://npmjs.org/package/is-unc-path) [![NPM total downloads](https://img.shields.io/npm/dt/is-unc-path.svg?style=flat)](https://npmjs.org/package/is-unc-path) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/is-unc-path.svg?style=flat&label=Travis)](https://travis-ci.org/jonschlinkert/is-unc-path)
  2. > Returns true if a filepath is a windows UNC file path.
  3. ## Install
  4. Install with [npm](https://www.npmjs.com/):
  5. ```sh
  6. $ npm install --save is-unc-path
  7. ```
  8. ## Usage
  9. ```js
  10. var isUncPath = require('is-unc-path');
  11. ```
  12. **true**
  13. Returns true for windows UNC paths:
  14. ```js
  15. isUncPath('\\/foo/bar');
  16. isUncPath('\\\\foo/bar');
  17. isUncPath('\\\\foo\\admin$');
  18. isUncPath('\\\\foo\\admin$\\system32');
  19. isUncPath('\\\\foo\\temp');
  20. isUncPath('\\\\/foo/bar');
  21. isUncPath('\\\\\\/foo/bar');
  22. ```
  23. **false**
  24. Returns false for non-UNC paths:
  25. ```js
  26. isUncPath('/foo/bar');
  27. isUncPath('/');
  28. isUncPath('/foo');
  29. isUncPath('/foo/');
  30. isUncPath('c:');
  31. isUncPath('c:.');
  32. isUncPath('c:./');
  33. isUncPath('c:./file');
  34. isUncPath('c:/');
  35. isUncPath('c:/file');
  36. ```
  37. **Customization**
  38. Use `.source` to use the regex as a component of another regex:
  39. ```js
  40. var myRegex = new RegExp(isUncPath.source + 'foo');
  41. ```
  42. **[Rules for UNC paths](http://resources.esri.com/help/9.3/ArcGISDesktop/com/Gp_ToolRef/sharing_tools_and_toolboxes/pathnames_explained_colon_absolute_relative_unc_and_url.htm)**
  43. * The computer name is always preceded by a double backward-slash (`\\`).
  44. * UNC paths cannot contain a drive letter (such as `D:`)
  45. ## Release history
  46. ### v1.0.0 - 2017-07-12
  47. **Changes**
  48. * now throws a `TypeError` if value is not a string
  49. ## About
  50. ### Related projects
  51. * [is-absolute](https://www.npmjs.com/package/is-absolute): Polyfill for node.js `path.isAbolute`. Returns true if a file path is absolute. | [homepage](https://github.com/jonschlinkert/is-absolute "Polyfill for node.js `path.isAbolute`. Returns true if a file path is absolute.")
  52. * [is-glob](https://www.npmjs.com/package/is-glob): Returns `true` if the given string looks like a glob pattern or an extglob pattern… [more](https://github.com/jonschlinkert/is-glob) | [homepage](https://github.com/jonschlinkert/is-glob "Returns `true` if the given string looks like a glob pattern or an extglob pattern. This makes it easy to create code that only uses external modules like node-glob when necessary, resulting in much faster code execution and initialization time, and a bet")
  53. * [is-relative](https://www.npmjs.com/package/is-relative): Returns `true` if the path appears to be relative. | [homepage](https://github.com/jonschlinkert/is-relative "Returns `true` if the path appears to be relative.")
  54. ### Contributing
  55. Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).
  56. ### Building docs
  57. _(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_
  58. To generate the readme, run the following command:
  59. ```sh
  60. $ npm install -g verbose/verb#dev verb-generate-readme && verb
  61. ```
  62. ### Running tests
  63. Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command:
  64. ```sh
  65. $ npm install && npm test
  66. ```
  67. ### Author
  68. **Jon Schlinkert**
  69. * [github/jonschlinkert](https://github.com/jonschlinkert)
  70. * [twitter/jonschlinkert](https://twitter.com/jonschlinkert)
  71. ### License
  72. Copyright © 2017, [Jon Schlinkert](https://github.com/jonschlinkert).
  73. Released under the [MIT License](LICENSE).
  74. ***
  75. _This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.6.0, on July 13, 2017._