Socket
Socket
Sign inDemoInstall

is-valid-path

Package Overview
Dependencies
3
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

is-valid-path

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


Version published
Maintainers
1
Weekly downloads
1,124,858
decreased by-8.15%

Weekly downloads

Readme

Source

is-valid-path NPM version

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

Install with npm

npm i is-valid-path --save

Usage

var isValid = require('is-valid-path');

/**
 * Valid
 */

isValid('abc.js');
//=> 'true'
isValid('abc/def/ghi.js');
//=> 'true'
isValid('foo.js');
//=> 'true'

/**
 * Invalid
 */

isValid();
//=> 'valse'
isValid(null);
//=> 'valse'
isValid('!foo.js');
//=> 'false'
isValid('*.js');
//=> 'false'
isValid('**/abc.js');
//=> 'false'
isValid('abc/*.js');
//=> 'false'
isValid('abc/(aaa|bbb).js');
//=> 'false'
isValid('abc/[a-z].js');
//=> 'false'
isValid('abc/{a,b}.js');
//=> 'false'
isValid('abc/?.js');
//=> '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:

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.

Keywords

FAQs

Last updated on 06 May 2015

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc