https://github.com/arlac77/matching-iterator
glob style matching on iterables
https://github.com/arlac77/matching-iterator
Last synced: about 1 year ago
JSON representation
glob style matching on iterables
- Host: GitHub
- URL: https://github.com/arlac77/matching-iterator
- Owner: arlac77
- License: 0bsd
- Created: 2020-05-30T23:16:53.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2025-03-19T00:27:56.000Z (about 1 year ago)
- Last Synced: 2025-03-25T06:01:39.321Z (about 1 year ago)
- Language: JavaScript
- Size: 1.75 MB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://www.npmjs.com/package/matching-iterator)
[](https://spdx.org/licenses/0BSD.html)
[](https://typescriptlang.org)
[](https://bundlejs.com/?q=matching-iterator)
[](https://npmjs.org/package/matching-iterator)
[](https://github.com/arlac77/matching-iterator/issues)
[](https://actions-badge.atrox.dev/arlac77/matching-iterator/goto)
[](https://github.com/prettier/prettier)
[](http://commitizen.github.io/cz-cli/)
[](https://snyk.io/test/github/arlac77/matching-iterator)
[](https://coveralls.io/github/arlac77/matching-iterator)
# matching-iterator
glob style matching on iterables
# usage
```js
import { matcher } from "matching-iterator";
for await (const r of matcher([
{ name: "a" },{ name: "b" }], "a*", { name: "name" })) {
console.log(r);
}
```
# API
### Table of Contents
* [matcher](#matcher)
* [Parameters](#parameters)
* [asyncMatcher](#asyncmatcher)
* [Parameters](#parameters-1)
* [compile](#compile)
* [Parameters](#parameters-2)
## matcher
Match entries against glob pattern.
### Parameters
* `entries` **Iterable<([string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String) | [Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object))>** input
* `patterns` **([Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)<[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)> | [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String) | [undefined](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/undefined))** filter to apply
* `options` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** (optional, default `{}`)
* `options.name` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** name of the name attribute
* `options.caseSensitive` **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)?** defaults to true
Returns **Iterable<([string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String) | [Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object))>** filtered entries
## asyncMatcher
Match entries against glob pattern.
### Parameters
* `entries` **Iterable<([string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String) | [Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object))>** input
* `patterns` **([Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)<[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)> | [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String) | [undefined](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/undefined))** filter to apply
* `options` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** (optional, default `{}`)
* `options.name` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** name of the name attribute
* `options.caseSensitive` **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)?** defaults to true
Returns **AsyncGenerator<([string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String) | [Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object))>** filtered entries
## compile
* **See**:
### Parameters
* `patterns` **([Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)<[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)> | [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String))**
* `options` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)**
Returns **any** globs copiled into regex
# install
With [npm](http://npmjs.org) do:
```shell
npm install matching-iterator
```
# license
BSD-2-Clause