JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 793546
  • Score
    100M100P100Q181347F
  • License ISC

Match two glob-like patterns

Package Exports

  • wildcard-match

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (wildcard-match) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

wildcard-match

A function that matches two glob-like patterns with each other. It has an advantage over other similar libraries in that it allows both samples to have wildcards.

Installation

npm install --save wildcard-match

Usage

const match = require('wildcard-match')

match('one/**', 'one/two/three') // true
match('.', ['one', '**', 'four'], 'one.two.three.four') // true
match('one.two', 'one.two.*') // false because * matches exactly one segment

Patterns can be either strings or arrays, and can have the following wildcards:

  • * for exactly one segment
  • ** for any number of segments (including zero)

If at least one of the samples is a string, a delimiter can be provided as the first argument. If the delimiter is not specified, / is used.

License

ISC