Security News
Node.js EOL Versions CVE Dubbed the "Worst CVE of the Year" by Security Experts
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Create a matching function from a glob pattern, regex, string, array, object or function.
Create a matching function from a glob pattern, regex, string, array, object or function.
Install with npm:
$ npm install --save is-match
See the release history to learn about breaking changes in the v1.0.0 release.
var isMatch = require('is-match');
from a string:
var isMatch = matcher('a')
isMatch('a');
//=> true
isMatch('b');
//=> false
from a glob pattern:
var isMatch = matcher('*')
isMatch('a'); //=> true
var isMatch = matcher('!b')
isMatch('a'); //=> true
var isMatch = matcher('!b')
isMatch('b'); //=> false
from an array of glob patterns:
var isMatch = matcher(['b'])
isMatch('a'); //=> false
var isMatch = matcher(['b', 'a'])
isMatch('a'); //=> true
var isMatch = matcher(['b', 'c', '*'])
isMatch('a'); //=> true
from a regex:
var isMatch = matcher(/a/);
isMatch('a');
//=> true
isMatch('b');
//=> false
from a function:
var isMatch = matcher(function (val) {
return val === 'a';
});
isMatch('a');
//=> true
isMatch('b');
//=> false
from an object:
var isMatch = matcher({a: 'b'});
isMatch({a: 'b'}); //=> true
isMatch({a: 'b', c: 'd'}); //=> false
isMatch({e: 'f', c: 'd'}); //=> false
Potentially breaking changes
isMatch()
would return true if any of the globs matched. As of 1.0, isMatch()
only returns true when all globs match.true
if an array has a glob pattern. | homepagetrue
if the given string looks like a glob pattern or an extglob pattern… more | homepagePull requests and stars are always welcome. For bugs and feature requests, please create an issue.
Commits | Contributor |
---|---|
23 | jonschlinkert |
8 | tunnckoCore |
(This project's readme.md is generated by verb, please don't edit the readme directly. Any changes to the readme must be made in the .verb.md readme template.)
To generate the readme, run the following command:
$ npm install -g verbose/verb#dev verb-generate-readme && verb
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:
$ npm install && npm test
Jon Schlinkert
Copyright © 2017, Jon Schlinkert. Released under the MIT License.
This file was generated by verb-generate-readme, v0.6.0, on June 17, 2017.
FAQs
Create a matching function from a glob pattern, regex, string, array, object or function.
The npm package is-match receives a total of 2,020 weekly downloads. As such, is-match popularity was classified as popular.
We found that is-match demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
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.
Security News
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.