# @open-tech-world/es-glob

> A glob pattern matching library.

Latest version **0.8.1** (published 2021-08-11) · MIT license · 0 weekly downloads

## Install

```sh
npm install @open-tech-world/es-glob
pnpm add @open-tech-world/es-glob
yarn add @open-tech-world/es-glob
bun add @open-tech-world/es-glob
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.8.1 |
| Published | 2021-08-11 |
| First published | 2021-07-23 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | ^12.22.0 \|\| ^14.17.0 \|\| >=16.0.0 |
| Dependencies | 0 |
| Unpacked size | 13.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Thanga Ganapathy |
| Maintainers | ganapathy |
| Keywords | glob, pattern, match, matching, lib, library |

## Links

- npm: https://www.npmjs.com/package/@open-tech-world/es-glob
- Repository: https://github.com/open-tech-world/es-glob
- Homepage: https://github.com/open-tech-world/es-glob#readme
- Issues: https://github.com/open-tech-world/es-glob/issues
- npm.io page: https://npm.io/package/@open-tech-world/es-glob

## Alternatives

- [@cantoo/pdf-lib](https://npm.io/package/@cantoo/pdf-lib.md) — 297.9K weekly downloads
- [datatables.net-buttons](https://npm.io/package/datatables.net-buttons.md) — 200.1K weekly downloads
- [@ckeditor/ckeditor5-export-pdf](https://npm.io/package/@ckeditor/ckeditor5-export-pdf.md) — 167.0K weekly downloads
- [scanbot-web-sdk](https://npm.io/package/scanbot-web-sdk.md) — 15.0K weekly downloads
- [@syncfusion/ej2-angular-pdfviewer](https://npm.io/package/@syncfusion/ej2-angular-pdfviewer.md) — 8.8K weekly downloads

## Recent versions

- 0.8.1 (latest) — 2021-08-11
- 0.7.0 — 2021-07-30
- 0.6.0 — 2021-07-30
- 0.5.0 — 2021-07-29
- 0.4.0 — 2021-07-27
- 0.3.0 — 2021-07-25
- 0.2.0 — 2021-07-25
- 0.1.1 — 2021-07-23
- 0.1.0 — 2021-07-23

## README

<div align="center">

# @open-tech-world/es-glob
[![Build](https://github.com/open-tech-world/es-glob/actions/workflows/build.yml/badge.svg)](https://github.com/open-tech-world/es-glob/actions/workflows/build.yml) [![CodeFactor](https://www.codefactor.io/repository/github/open-tech-world/es-glob/badge)](https://www.codefactor.io/repository/github/open-tech-world/es-glob)
</div>

> A [glob](https://en.wikipedia.org/wiki/Glob_(programming)) pattern matching library.

## Supported glob patterns

#### Basic

✔️ `*` (Wildcard)

✔️ `**` (Globstar)

✔️ `?` (Wildcard)

✔️ `[…]` (Brackets)

✔️ `\\` (Escape Special Characters)

✔️ `!` (Negation)

#### Braces

🚧 `{,}` (Brace Matching)

#### Extended glob

❌ `?(pattern-list)`

❌ `*(pattern-list)`

❌ `+(pattern-list)`

❌ `@(pattern-list)`

❌ `!(pattern-list)`

#### POSIX Character classes

❌ `[:class:]`

#### Others

❌ Regular expression

✔️ `(|)` Logical OR Group

## Installation

Using npm

```shell
npm install @open-tech-world/es-glob
```

Using Yarn

```shell
yarn add @open-tech-world/es-glob
```

## Usage

```ts
import { matchGlob } from '@open-tech-world/es-glob';

matchGlob(str: string, pattern: string): boolean;
```

## Examples

```ts
matchGlob('/a.json', '/*.json') // true

matchGlob('a/b/.x/c/d', '**/.x/**') // true

matchGlob('abc', 'ab?') // true

matchGlob('b', '[a-c]') // true

matchGlob('a', '[!a-c]') // false

matchGlob('b', '[^a-c]') // false

matchGlob('*.txt', '\\*.txt') // true

matchGlob('node_modules', '!node_modules') // false

matchGlob('a', '(a|b)') // true

matchGlob('config.js', '*.(js|json)') // true

matchGlob('tsconfig.json', '*.(js|json)') // true

matchGlob('index.ts', '*.(js|jsx|tsx)') // false
```

#### matchPathGlob

It matches a path in a glob pattern.

```ts
import { matchPathGlob } from '@open-tech-world/es-glob';

matchPathGlob('a', 'a/*') // true
matchPathGlob('a/b', 'a/*') // true
matchPathGlob('a/b/c', 'a/*') // false
```

## References

https://www.gnu.org/software/bash/manual/html_node/Pattern-Matching.html

https://en.wikipedia.org/wiki/Glob_(programming)

## License

Copyright (c) 2021, [Thanga Ganapathy](https://thanga-ganapathy.github.io) ([MIT License](./LICENSE)).

---
_Source: https://npm.io/package/@open-tech-world/es-glob · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
