# micromatch [![NPM version](https://img.shields.io/npm/v/micromatch.svg?style=flat)](https://www.npmjs.com/package/micromatch) [![NPM monthly downloads](https://img.shields.io/npm/dm/micromatch.svg?style=flat)](https://npmjs.org/package/micromatch) [![NPM total downloads](https://img.shields.io/npm/dt/micromatch.svg?style=flat)](https://npmjs.org/package/micromatch) [![Tests](https://github.com/micromatch/micromatch/actions/workflows/test.yml/badge.svg)](https://github.com/micromatch/micromatch/actions/workflows/test.yml)
> Glob matching for javascript/node.js. A replacement and faster alternative to minimatch and multimatch.
Please consider following this project's author, [Jon Schlinkert](https://github.com/jonschlinkert), and consider starring the project to show your :heart: and support.
## Table of Contents
<details>
<summary><strong>Details</strong></summary>
- [Install](#install)
- [Quickstart](#quickstart)
- [Why use micromatch?](#why-use-micromatch)
* [Matching features](#matching-features)
- [Switching to micromatch](#switching-to-micromatch)
* [From minimatch](#from-minimatch)
* [From multimatch](#from-multimatch)
- [API](#api)
- [Options](#options)
- [Options Examples](#options-examples)
* [options.basename](#optionsbasename)
* [options.bash](#optionsbash)
* [options.expandRange](#optionsexpandrange)
* [options.format](#optionsformat)
* [options.ignore](#optionsignore)
* [options.matchBase](#optionsmatchbase)
* [options.noextglob](#optionsnoextglob)
* [options.nonegate](#optionsnonegate)
* [options.noglobstar](#optionsnoglobstar)
* [options.nonull](#optionsnonull)
* [options.nullglob](#optionsnullglob)
* [options.onIgnore](#optionsonignore)
* [options.onMatch](#optionsonmatch)
* [options.onResult](#optionsonresult)
* [options.posixSlashes](#optionsposixslashes)
* [options.unescape](#optionsunescape)
- [Extended globbing](#extended-globbing)
* [Extglobs](#extglobs)
* [Braces](#braces)
* [Regex character classes](#regex-character-classes)
* [Regex groups](#regex-groups)
* [POSIX bracket expressions](#posix-bracket-expressions)
- [Notes](#notes)
* [Bash 4.3 parity](#bash-43-parity)
* [Backslashes](#backslashes)
- [Benchmarks](#benchmarks)
* [Running benchmarks](#running-benchmarks)
* [Latest results](#latest-results)
- [Contributing](#contributing)
- [About](#about)
</details>
## Install
Install with [npm](https://www.npmjs.com/) (requires [Node.js](https://nodejs.org/en/) >=8.6):
```sh
$ npm install --save micromatch
```
## Quickstart
```js
const micromatch = require('micromatch');
// micromatch(list, patterns[, options]);
```
The [main export](#micromatch) takes a list of strings and one or more glob patterns:
```js
console.log(micromatch(['foo', 'bar', 'baz', 'qux'], ['f*', 'b*'])) //=> ['foo', 'bar', 'baz']
console.log(micromatch(['foo', 'bar', 'baz', 'qux'], ['*', '!b*'])) //=> ['foo', 'qux']
```
Use [.isMatch()](#ismatch) to for boolean matching:
```js
console.log(micromatch.isMatch('foo', 'f*')) //=> true
console.log(micromatch.isMatch('foo', ['b*', 'f*'])) //=> true
```
[Switching](#switching-to-micromatch) from minimatch and multimatch is easy!
<br>
## Why use micromatch?
> micromatch is a [replacement](#switching-to-micromatch) for minimatch and multimatch
* Supports all of the same matching features as [minimatch](https://github.com/isaacs/minimatch) and [multimatch](https://github.com/sindresorhus/multimatch)
* More complete support for the Bash 4.3 specification than minimatch and multimatch. Micromatch passes _all of the spec tests_ from bash, including some that bash still fails.
* **Fast & Performant** - Loads in about 5ms and performs [fast matches](#benchmarks).
* **Glob matching** - Using wildcards (`*` and `?`), globstars (`**`) for nested directories
* **[Advanced globbing](#extended-globbing)** - Supports [extglobs](#extglobs), [braces](#braces-1), and [POSIX brackets](#posix-bracket-expressions), and support for escaping special characters with `\` or quotes.
* **Accurate** - Covers more scenarios [than minimatch](https://github.com/yarnpkg/yarn/pull/3339)
* **Well tested** - More than 5,000 [test assertions](./test)
* **Windows support** - More reliable windows support than minimatch and multimatch.
* **[Safe](https://github.com/micromatch/braces#braces-is-safe)** - Micromatch is not subject to DoS with brace patterns like minimatch and multimatch.
### Matching features
* Support for multiple glob patterns (no need for wrappers like multimatch)
* Wildcards (`**`, `*.js`)
* Negation (`'!a/*.js'`, `'*!(b).js'`)
* [extglobs](#extglobs) (`+(x|y)`, `!(a|b)`)
* [POSIX character classes](#posix-bracket-expressions) (`[[:alpha:][:digit:]]`)
* [brace expansion](https://github.com/micromatch/braces) (`foo/{1..5}.md`, `bar/{a,b,c}.js`)
* regex character classes (`foo-[1-5].js`)
* regex logical "or" (`foo/(abc|xyz).js`)
You can mix and match these features to create whatever patterns you need!
## Switching to micromatch
_(There is one notable difference between micromatch and minimatch in regards to how backslashes are handled. See [the notes about backslashes](#backslashes) for more information.)_
### From minimatch
Use [micromatch.isMatch()](#ismatch) instead of `minimatch()`:
```js
console.log(micromatch.isMatch('foo', 'b*')); //=> false
```
Use [micromatch.match()](#match) instead of `minimatch.match()`:
```js
console.log(micromatch.match(['foo', 'bar'], 'b*')); //=> 'bar'
```
### From multimatch
Same signature:
```js
console.log(micromatch(['foo', 'bar', 'baz'], ['f*', '*z'])); //=> ['foo', 'baz']
```
## API
**Params**
* `list` **{String|Array<string>}**: List of strings to match.
* `patterns` **{String|Array<string>}**: One or more glob patterns to use for matching.
* `options` **{Object}**: See available [options](#options)
* `returns` **{Array}**: Returns an array of matches
**Example**
```js
const mm = require('micromatch');
// mm(list, patterns[, options]);
console.log(mm(['a.js', 'a.txt'], ['*.js']));
//=> [ 'a.js' ]
```
### [.matcher](index.js#L104)
Returns a matcher function from the given glob `pattern` and `options`. The returned function takes a string to match as its only argument and returns true if the string is a match.
**Params**
* `pattern` **{String}**: Glob pattern
* `options` **{Object}**
* `returns` **{Function}**: Returns a matcher function.
**Example**
```js
const mm = require('micromatch');
// mm.matcher(pattern[, options]);
const isMatch = mm.matcher('*.!(*a)');
console.log(isMatch('a.a')); //=> false
console.log(isMatch('a.b')); //=> true
```
### [.isMatch](index.js#L123)
Returns true if **any** of the given glob `patterns` match the specified `string`.
**Params**
* `str` **{String}**: The string to test.
* `patterns` **{String|Array}**: One or more glob patterns to use for matching.
* `[options]` **{Object}**: See available [options](#options).
* `returns` **{Boolean}**: Returns true if any patterns match `str`
**Example**
```js
const mm = require('micromatch');
// mm.isMatch(string, patterns[, options]);
console.log(mm.isMatch('a.a', ['b.*', '*.a'])); //=> true
console.log(mm.isMatch('a.a', 'b.*')); //=> false
```
### [.not](index.js#L148)
Returns a list of strings that _**do not match any**_ of the given `patterns`.
**Params**
* `list` **{Array}**: Array of strings to match.
* `patterns` **{String|Array}**: One or more glob pattern to use for matching.
* `options` **{Object}**: See available [options](#options) for changing how matches are performed
* `returns` **{Array}**: Returns an array of strings that **do not match** the given patterns.
**Example**
```js
const mm = require('micromatch');
// mm.not(list, patterns[, options]);
console.log(mm.not(['a.a', 'b.b', 'c.c'], '*.a'));
//=> ['b.b', 'c.c']
```
### [.contains](index.js#L188)
Returns true if the given `string` contains the given pattern. Similar to [.isMatch](#isMatch) but the pattern can match any part of the string.
没有合适的资源?快使用搜索试试~ 我知道了~
TypeScript实例之网页计算器
共2000个文件
js:1156个
md:445个
json:289个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
5星 · 超过95%的资源 1 下载量 46 浏览量
2024-02-05
15:07:41
上传
评论
收藏 15.07MB RAR 举报
温馨提示
使用ts开发网页计算器,实现自动计算,及界面的自动绘制,依赖库如下: 1. browserify 为网页浏览器提供模块加载环境。 2. lite-server 提供简易的web服务,自动将项目中的内容发布到web服务器中,启动时自动打开浏览器。js等文件有变动时,自动刷新浏览器界面。 3. tsify 自动编译ts文件为js文件。 # 编译 使用npm run build-cli指令进行命令行编译。使用npm run build-script指令进行配置文件编译,自动将项目中的ts文件编译到js中。 # 启动 使用npm start启动项目,启动后访问[http://localhost:8080](http://localhost:8080)即可访问到系统 # 说明 开发文档及视频等资料见博客:https://blog.csdn.net/m0_37631110/article/details/136040223
资源推荐
资源详情
资源评论
收起资源包目录
TypeScript实例之网页计算器 (2000个子文件)
core.min.css 29KB
pesticide-depth.css 14KB
pesticide.min.css 5KB
pesticide.css 5KB
main.css 2KB
map-file-comment-inline.css 1KB
main.css 623B
main.css 623B
main.css 623B
grid-overlay-vertical.css 359B
grid-overlay-horizontal.css 352B
map-file-comment.css 252B
map-file-comment-double-slash.css 249B
components.css 240B
main.css 72B
main.css 72B
main.css 69B
main.css 69B
main.css 43B
main.css 43B
main.css 42B
main.css 42B
core.css 38B
_custom.css 31B
main.css 30B
main.css 30B
main.css 30B
history.html 116KB
sync-options.html 112KB
plugins.html 110KB
network-throttle.html 107KB
remote-debug.html 107KB
server-info.html 106KB
help.html 104KB
server-info-snippet.html 102KB
components.html 28KB
preview.html 13KB
network-throttle.html 4KB
lists.html 4KB
overlay-grid.html 4KB
type.html 3KB
buttons.html 3KB
switches.html 3KB
help.content.html 3KB
help-content.html 3KB
index.html 2KB
button-bars.html 2KB
header.html 2KB
url-info.html 2KB
forms.html 2KB
plugins.html 1KB
panels.html 974B
connections.html 951B
sync-options.html 879B
history.directive.html 874B
compression.html 811B
overview.html 793B
no-cache.html 779B
remote-debug.html 768B
bs-switch.html 760B
history.html 679B
connections.directive.html 475B
footer.html 454B
index.html 409B
index.html 382B
network-throttle.directive.html 375B
index.html 356B
index.html 355B
index.html 353B
index.html 353B
snippet-info.html 352B
latency.html 332B
index.html 326B
index.html 320B
index.html 317B
index.html 292B
index.html 283B
index.html 271B
index.html 270B
index.html 269B
index.html 257B
index.html 254B
index.html 251B
index.html 249B
index.html 249B
index.html 247B
help.html 236B
index.html 235B
index.html 235B
heading.html 155B
index.html 138B
index.html 128B
footer.html 57B
header.html 43B
help.directive.html 0B
typescript.js 8.6MB
tsserver.js 8.14MB
tsc.js 5.56MB
typingsInstaller.js 1.67MB
rx.all.compat.js 433KB
共 2000 条
- 1
- 2
- 3
- 4
- 5
- 6
- 20
资源评论
- mmx_072024-03-18资源有一定的参考价值,与资源描述一致,很实用,能够借鉴的部分挺多的,值得下载。
军军君01
- 粉丝: 1w+
- 资源: 30
下载权益
C知道特权
VIP文章
课程特权
开通VIP
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功