Skip to content

Commit

Permalink
add docs for MatchUnvalidated, PathMatchUnvalidated
Browse files Browse the repository at this point in the history
  • Loading branch information
bmatcuk committed Oct 11, 2024
1 parent 2832f67 commit da152ef
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,19 @@ Note: users should _not_ count on the returned error,
`doublestar.ErrBadPattern`, being equal to `path.ErrBadPattern`.


### MatchUnvalidated

```go
func MatchUnvalidated(pattern, name string) bool
```

MatchUnvalidated can provide a small performance improvement if you don't care
about whether or not the pattern is valid (perhaps because you already ran
`ValidatePattern`). Note that there's really only one case where this
performance improvement is realized: when pattern matching reaches the end of
`name` before reaching the end of `pattern`, such as `Match("a/b/c", "a")`.


### PathMatch

```go
Expand All @@ -105,6 +118,20 @@ that both `pattern` and `name` are using the system's path separator. If you
can't be sure of that, use `filepath.ToSlash()` on both `pattern` and `name`,
and then use the `Match()` function instead.


### PathMatchUnvalidated

```go
func PathMatchUnvalidated(pattern, name string) bool
```

PathMatchUnvalidated can provide a small performance improvement if you don't
care about whether or not the pattern is valid (perhaps because you already ran
`ValidatePattern`). Note that there's really only one case where this
performance improvement is realized: when pattern matching reaches the end of
`name` before reaching the end of `pattern`, such as `Match("a/b/c", "a")`.


### GlobOption

Options that may be passed to `Glob`, `GlobWalk`, or `FilepathGlob`. Any number
Expand Down

0 comments on commit da152ef

Please sign in to comment.