项目作者: jonschlinkert

项目描述 :
Returns true if a windows file path does not contain any invalid characters.
高级语言: JavaScript
项目地址: git://github.com/jonschlinkert/is-valid-path.git
创建时间: 2015-05-06T10:58:04Z
项目社区:https://github.com/jonschlinkert/is-valid-path

开源协议:MIT License

下载


is-valid-path NPM version

Returns true if a file path does not contain any invalid characters.

Install with npm

  1. npm i is-valid-path --save

Usage

  1. var isValid = require('is-valid-path');
  2. /**
  3. * Valid
  4. */
  5. isValid('abc.js');
  6. //=> 'true'
  7. isValid('abc/def/ghi.js');
  8. //=> 'true'
  9. isValid('foo.js');
  10. //=> 'true'
  11. /**
  12. * Invalid
  13. */
  14. isValid();
  15. //=> 'valse'
  16. isValid(null);
  17. //=> 'valse'
  18. isValid('!foo.js');
  19. //=> 'false'
  20. isValid('*.js');
  21. //=> 'false'
  22. isValid('**/abc.js');
  23. //=> 'false'
  24. isValid('abc/*.js');
  25. //=> 'false'
  26. isValid('abc/(aaa|bbb).js');
  27. //=> 'false'
  28. isValid('abc/[a-z].js');
  29. //=> 'false'
  30. isValid('abc/{a,b}.js');
  31. //=> 'false'
  32. isValid('abc/?.js');
  33. //=> 'false'
  • is-glob: Returns true if the given string looks like a glob pattern.
  • is-invalid-path: Returns true if a file path has invalid characters.
  • is-git-url: Regex to validate that a URL is a git url.
  • micromatch: Glob matching for javascript/node.js. A drop-in replacement and faster alternative to minimatch and multimatch. Just… more
  • parse-glob: Parse a glob pattern into an object of tokens.

Run tests

Install dev dependencies:

  1. npm i -d && npm test

Contributing

Pull requests and stars are always welcome. For bugs and feature requests, please create an issue

Author

Jon Schlinkert

License

Copyright (c) 2015 Jon Schlinkert
Released under the MIT license.


This file was generated by verb-cli on May 06, 2015.