Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
jc3213 authored Nov 3, 2024
1 parent cf807d7 commit fc76881
Showing 1 changed file with 8 additions and 36 deletions.
44 changes: 8 additions & 36 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,40 +15,12 @@

## Syntax
```javascript
let matchPattern = new MatchPattern();
let pA = MatchPattern(url);
let pB = MatchPattern(host);
```

## Method
- [add](#add)
- add new [match pattern](#match-pattern)
- [remove](#remove)
- remove exist [match pattern](#match-pattern)
- [match](#match)
- match `url` with match patterns

### add
```javascript
matchPattern.add('*.google.com');
```
- add `*.google.com` to match patterns

### remove
```javascript
matchPattern.remove('*.github.com');
```
- remove `*.github.com` from match patterns
- if `*.github.com` is not in match patterns, do nothing

### match
```javascript
matchPattern.match('https://www.bing.com/'); // false
```
- match `https://www.bing.com/` with match patterns
- returns `false`, if not match pattern is added

## Match Pattern
| Target Hostname | Valid Match Pattern |
| - | - |
| www.university.org.eu | www.university.org.eu <br> \*.university.org.eu <br> \*.org.eu |
| doc.university.org.eu | doc.university.org.eu <br> doc.university.* <br> doc.university* |
| user.university.org.eu | *.user.university.org.eu <br> \*.university.org.eu <br> \*university.org.eu |
- url
- `string`
- `https://example.com/pathname`
- host
- `string`
- `example.com`

0 comments on commit fc76881

Please sign in to comment.