1. is-valid-path
Returns true if a file path does not contain any invalid characters.
is-valid-path
Package: is-valid-path
Created by: jonschlinkert
Last modified: Sun, 19 Jun 2022 02:52:59 GMT
Version: 0.1.1
License: MIT
Downloads: 4,795,484
Repository: https://github.com/jonschlinkert/is-valid-path

Install

npm install is-valid-path
yarn add is-valid-path

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.

Dependencies

RELATED POST

10 Must-Know Windows Shortcuts That Will Save You Time

10 Must-Know Windows Shortcuts That Will Save You Time

Arrays vs Linked Lists: Which is Better for Memory Management in Data Structures?

Arrays vs Linked Lists: Which is Better for Memory Management in Data Structures?

Navigating AWS Networking: Essential Hacks for Smooth Operation

Navigating AWS Networking: Essential Hacks for Smooth Operation

Achieving Stunning Visuals with Unity's Global Illumination

Achieving Stunning Visuals with Unity's Global Illumination

Nim's Hidden Gems: Lesser-known Features for Writing Efficient Code

Nim's Hidden Gems: Lesser-known Features for Writing Efficient Code