Socket
Socket
Sign inDemoInstall

@arcsine/glob

Package Overview
Dependencies
0
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @arcsine/glob

Lightweight Globbing Package


Version published
Weekly downloads
1
decreased by-50%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

@arcsine/glob

A light-weight, simple globbing library that shares an API with picomatch.

The code, when compressed is about 1.1kb. Additionally, the source is small and is fairly straightforward to read through.

Primary differences are limited support for vague regex patterns that picomatch supports, as well as limited support for group negation. Consequently, there are also many edge cases that this library does not take into consideration (as of yet), and should be used for fairly standard globbing usages.

Primary features:

  • * matches any characters except for /
  • ? matches zero or one characters
  • . matches one character
  • ** matches zero or more folder depths
  • {a,b} matches a or b
  • @(a|b) matches a or b, one time
  • +(a|b) matches a or b, one or more times
  • ?(a|b) matches a or b, zero or one times
  • *(a|b) matches a or b, zero or more times
  • [ab] matches a or b, once
  • [a-z] matches a through z, once
  • [!ab] or [^ab] matches anything other than a or b, once

In addition to simple character class, support, there is also support for POSIX character classes:

  • [[:alnum:]] alpha-numeric values
  • [[:alpha:]] alpha values
  • [[:ascii:]] ascii values
  • [[:blank:]] simple whitespace
  • [[:cntrl:]] control characters
  • [[:digit:]] numbers
  • [[:lower:]] lower case letters
  • [[:print:]] printable characters
  • [[:punct:]] punctuation
  • [[:space:]] whitespace characters
  • [[:upper:]] upper case characters
  • [[:word:]] alpha-numeric as well as _
  • [[:xdigit:]] hexidecimal characters

Usage

const {isMatch} = require('@arcsine/glob');
isMatch('folder/level/two/ab', '**/+([ab])') === true

FAQs

Last updated on 16 Aug 2020

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