Socket
Socket
Sign inDemoInstall

is-glob

Package Overview
Dependencies
0
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    is-glob

Returns `true` if the given string looks like a glob pattern.


Version published
Weekly downloads
59M
decreased by-1.05%
Maintainers
1
Install size
4.78 kB
Created
Weekly downloads
 

Package description

What is is-glob?

The is-glob npm package is used to determine if a string is a glob pattern. A glob pattern is a string that defines a pattern for matching file names, typically used for file searching and manipulation. The package provides a simple API to check if a string contains characters that make it a valid glob pattern.

What are is-glob's main functionalities?

Check if a string is a glob pattern

This feature allows you to check if a given string is a glob pattern. It returns true if the string contains special characters like '*', '?', or '[...]' that are used in glob patterns, and false otherwise.

const isGlob = require('is-glob');

console.log(isGlob('*.js')); // true
console.log(isGlob('hello.txt')); // false

Check if an array contains a glob pattern

This feature checks if any element in an array is a glob pattern. It returns true if at least one element is a glob pattern, and false if none are.

const isGlob = require('is-glob');

console.log(isGlob(['css', '*.js'])); // true
console.log(isGlob(['css', 'js'])); // false

Other packages similar to is-glob

Readme

Source

is-glob NPM version Build Status

Returns true if the given string looks like a glob pattern.

Install with npm

npm i is-glob --save

Usage

var isGlob = require('is-glob');

isGlob('foo.js');
//=> 'false'
isGlob('!foo.js');
//=> 'true'
isGlob('*.js');
//=> 'true'
isGlob('**/abc.js');
//=> 'true'
isGlob('abc/*.js');
//=> 'true'
isGlob('abc/(aaa|bbb).js');
//=> 'true'
isGlob('abc/[a-z].js');
//=> 'true'
isGlob('abc/{a,b}.js');
//=> 'true'
isGlob('abc/?.js');
//=> 'true'
isGlob('abc.js');
//=> 'false'
isGlob('abc/def/ghi.js');
//=> 'false'
  • 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