Socket
Socket
Sign inDemoInstall

wildcard

Package Overview
Dependencies
0
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    wildcard

Wildcard matching tools


Version published
Maintainers
1
Install size
8.83 kB
Created

Readme

Source

wildcard

Very simple wildcard matching, which is designed to provide the same functionality that is found in the eve eventing library.

Build Status

It works with strings:

wildcard('foo.*', 'foo.bar'); // true
wildcard('foo.*', 'foo'); // true

Arrays:

var testdata = [
    'a.b.c',
    'a.b',
    'a',
    'a.b.d'
];

wildcard('a.b.*', testdata); // ['a.b.c', 'a.b', 'a.b.d']

Objects (matching against keys):

var testdata = {
    'a.b.c' : {},
    'a.b'   : {},
    'a'     : {},
    'a.b.d' : {}
};

wildcard('a.*.c', testdata); // { 'a.b.c': {} }

While the library works in Node, if you are are looking for file-based wildcard matching then you should have a look at:

https://github.com/isaacs/node-glob

FAQs

Last updated on 29 Oct 2012

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