# wildcard-compare

> not only compare('1.3.1', '=1.%.1') => true

Latest version **1.0.1** (published 2016-12-17) · ISC license · 0 weekly downloads

## Install

```sh
npm install wildcard-compare
pnpm add wildcard-compare
yarn add wildcard-compare
bun add wildcard-compare
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2016-12-17 |
| First published | 2016-12-16 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | redhu |
| Maintainers | redhu |
| Keywords | wildcard-compare, string, calculation, 通配符, 比较 |

## Links

- npm: https://www.npmjs.com/package/wildcard-compare
- Repository: https://github.com/redhu/wildcard-compare
- Issues: https://github.com/redhu/wildcard-compare/issues
- npm.io page: https://npm.io/package/wildcard-compare

## Alternatives

- [@mce/gif](https://npm.io/package/@mce/gif.md) — 2.6K weekly downloads
- [cleanse](https://npm.io/package/cleanse.md) — 173 weekly downloads
- [str](https://npm.io/package/str.md) — 127 weekly downloads
- [naming](https://npm.io/package/naming.md) — 95 weekly downloads
- [tap-telco-api](https://npm.io/package/tap-telco-api.md) — 19 weekly downloads

## Recent versions

- 1.0.1 (latest) — 2016-12-17
- 1.0.0 — 2016-12-16

## README

## install
npm install wildcard-compare

## test
npm test

## api
```
compare(string, wildcard, memoize = false)
```

## eg
```
compare('', '') => true
compare('abc', '') => false
compare('abc', '+abc') => true
compare('abcd', '+abc') => false
compare('abc', '+abcd') => false
compare('abc', '=abc') => true
compare('abc', '=abcd') => false
compare('abcd', '=abc') => false
compare('abc', '<>abc') => false
compare('abc', '<>abcd') => true
compare('abc', '-abc') => false
compare('abc', '-abcd') => true
compare('abc', '>abc') => false
compare('2', '>1') => true
compare('2', '>1.1') => true
compare('abc', '>=abc') => true
compare('2', '>=1') => true
compare('abc', '<abc') => false
compare('abc', '<abcd') => true
compare('1', '<2') => true
compare('abc', '<=abc') => true
compare('abc', '<=abcd') => true
compare('1.3.1', '=1.%.1') => true
compare('1.3.1', '=%1.3') => false
compare('1.3.1', '-1.%.1') => false
compare('1.3.12', '+1.3.1%') => true
compare('1.1', '/1.*1/') => true
compare('1.1', '/2\.1/') => false
compare('abc', '=abcd,>bcd;=bcd;=abcd;/abcd/;=ab%;') => true
compare('abc', '=abcd;=bcd;=abcd;/a.*c/;=ab%d;') => true
compare 300000 times, used cache cost 130ms, and not used cache cost 1445ms.
```

### item rules
```
{
    +%s : equal
    =%s : equal
    -%s : not equal
    <>%s : not equal
    >%s : greater than
    >=%s ： greater than or equal
    <%s : less than
    <=%s : less than or equal
    % : like
    /%s/ : regular
}
```

### group rules
```
{
    , : and
    ; : or
}
```
"and" has highter weight then "or"

### example
1. greate than 4.0 and less than or equals 6.0 or like 8.*
```
>4.0,<=6.0;8.%
```

2. equals wps or equals et
```
=wps;=et
```

3. first letter can't be capital
```
/^[^A-Z].*/
```

---
_Source: https://npm.io/package/wildcard-compare · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
