denoland / denoland/std

Allow passing array of globs to `expandGlob`/`expandGlobSync`

Open
#3,465 0 comments 2 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
3.6k
Forks
681
PR merge metrics
No merged PRs in 30d

Description

**Is your feature request related to a problem? Please describe.**

I'm creating an API which will take in an `include` and `exclude` array of files. Wanted to mirror APIs like the one typically used in [tsconfig](https://www.typescriptlang.org/tsconfig#include). Currently I have to run an `expandGlob` for every member of my `include` array.

`expandGlob` already allows an `exclude` option which takes in an array, so it seems a bit odd to me that is not the case for the input `glob` itself.

**Describe the solution you'd like**

Ideally, I'd like to simply pass an array of globs into `expandGlob`. Something like this:

```typescript
expandGlob(glob: string | string[] | URL, options: ExpandGlobOptions)
```

**Describe alternatives you've considered**

- **Add `include` into options** - This doesn't seem correct though, since `glob` is essentially `include`, but with one item.
- **Create a new separate function specifically for glob arrays** - Open to this if it will completely change the mechanism, but it seems less than ideal to me

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.