All Projects → jonschlinkert → is-match

jonschlinkert / is-match

Licence: MIT license
Create a matching function from a glob pattern, regex, string, array or function.

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to is-match

html-comment-regex
Regular expression for matching HTML comments
Stars: ✭ 15 (-25%)
Mutual labels:  test, match
glob-fs
file globbing for node.js. speedy and powerful alternative to node-glob. This library is experimental and does not work on windows!
Stars: ✭ 54 (+170%)
Mutual labels:  match, glob-pattern
MathLib
The Math Algorithm
Stars: ✭ 38 (+90%)
Mutual labels:  test
angular-cli-skeleton
angular-cli skeleton to quickly start a new project with advanced features and best practices. All features are described in README.md.
Stars: ✭ 32 (+60%)
Mutual labels:  test
alexa-skill-test-framework
Framework for easy offline black-box testing of Alexa skills.
Stars: ✭ 64 (+220%)
Mutual labels:  test
TorXakis
A tool for Model Based Testing
Stars: ✭ 40 (+100%)
Mutual labels:  test
python-pytest-harvest
Store data created during your `pytest` tests execution, and retrieve it at the end of the session, e.g. for applicative benchmarking purposes.
Stars: ✭ 44 (+120%)
Mutual labels:  test
jest-expect-contain-deep
Assert deeply nested values in Jest
Stars: ✭ 68 (+240%)
Mutual labels:  test
VisualTAF
ExlJS - Super easy to use, Excel and JS driven tool, encapsulating best practices in test automation development.
Stars: ✭ 21 (+5%)
Mutual labels:  test
botium-cli
Botium CLI - The Selenium for Chatbots
Stars: ✭ 27 (+35%)
Mutual labels:  test
AtoumBundle
This bundle provides a simple integration of atoum into Symfony 2.
Stars: ✭ 44 (+120%)
Mutual labels:  test
logunit
A Java library for unit-testing logging.
Stars: ✭ 40 (+100%)
Mutual labels:  test
titef
🌠 A tiny, lightning-fast, zero-dependecies JavaScript test framework 🌠
Stars: ✭ 19 (-5%)
Mutual labels:  test
jest-serializer-html-string
A better Jest snapshot serializer for plain html strings
Stars: ✭ 17 (-15%)
Mutual labels:  test
UnitySettings
Runtime debugging menu (like setting on Android) for Unity.
Stars: ✭ 26 (+30%)
Mutual labels:  test
mix under
Execute mix tasks under Elixir umbrella applications
Stars: ✭ 19 (-5%)
Mutual labels:  test
Testables
Make private properties testable
Stars: ✭ 40 (+100%)
Mutual labels:  test
google-pubsub-emulator
Google PubSub Emulator wrapper to nodejs
Stars: ✭ 28 (+40%)
Mutual labels:  test
laika
Log, test, intercept and modify Apollo Client's operations
Stars: ✭ 99 (+395%)
Mutual labels:  test
kunkka-match
高性能撮合引擎
Stars: ✭ 50 (+150%)
Mutual labels:  match

is-match NPM version NPM monthly downloads NPM total downloads Linux Build Status

Create a matching function from a glob pattern, regex, string, array, object or function.

Install

Install with npm:

$ npm install --save is-match

Heads up!

See the release history to learn about breaking changes in the v1.0.0 release.

Usage

var isMatch = require('is-match');

Create matchers:

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

Release history

v1.0.0

Potentially breaking changes

  • prior to 1.0, when an array of globs was passed, isMatch() would return true if any of the globs matched. As of 1.0, isMatch() only returns true when all globs match.
  • now does number comparisons. there are several ways to compare numbers, I'm open to a discussion or changes if necessary.

About

Related projects

  • has-glob: Returns true if an array has a glob pattern. | homepage
  • is-glob: Returns true if the given string looks like a glob pattern or an extglob pattern… more | homepage
  • micromatch: Glob matching for javascript/node.js. A drop-in replacement and faster alternative to minimatch and multimatch. | homepage

Contributing

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

Contributors

Commits Contributor
23 jonschlinkert
8 tunnckoCore

Building docs

(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 tests

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

Author

Jon Schlinkert

License

Copyright © 2017, Jon Schlinkert. Released under the MIT License.


This file was generated by verb-generate-readme, v0.6.0, on June 17, 2017.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].