# deglob

> Take a list of glob patterns and return an array of file locations, respecting `.gitignore` and allowing for ignore patterns via `package.json`.

Latest version **4.0.1** (published 2019-08-23) · ISC license · 0 weekly downloads

## Install

```sh
npm install deglob
pnpm add deglob
yarn add deglob
bun add deglob
```

## Health

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

Positive: has types package; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 4.0.1 |
| Published | 2019-08-23 |
| First published | 2015-07-10 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | separate (@types/deglob) |
| Module format | CommonJS |
| Dependencies | 6 |
| Unpacked size | 7.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 40 |
| Author | Dan Flettre |
| Maintainers | dcousens, dcposch, feross, flet, jprichardson, mafintosh, othiym23 |
| Keywords | cli, command, deglob, files, glob, unglob, gitignore, ignore, file |

## Links

- npm: https://www.npmjs.com/package/deglob
- Repository: https://github.com/flet/deglob
- Issues: https://github.com/flet/deglob/issues
- npm.io page: https://npm.io/package/deglob

## Dependencies (6)

- [glob](https://npm.io/package/glob.md) ^7.0.5
- [uniq](https://npm.io/package/uniq.md) ^1.0.1
- [ignore](https://npm.io/package/ignore.md) ^5.0.0
- [find-root](https://npm.io/package/find-root.md) ^1.0.0
- [pkg-config](https://npm.io/package/pkg-config.md) ^1.1.0
- [run-parallel](https://npm.io/package/run-parallel.md) ^1.1.2

## Alternatives

- [@salesforce/cli](https://npm.io/package/@salesforce/cli.md) — 389.7K weekly downloads
- [@mintlify/cli](https://npm.io/package/@mintlify/cli.md) — 208.9K weekly downloads
- [@grafana/e2e-selectors](https://npm.io/package/@grafana/e2e-selectors.md) — 128.7K weekly downloads
- [mintlify](https://npm.io/package/mintlify.md) — 112.0K weekly downloads
- [@intlayer/cli](https://npm.io/package/@intlayer/cli.md) — 22.8K weekly downloads

## Recent versions

- 4.0.1 (latest) — 2019-08-23
- 4.0.0 — 2019-07-29
- 3.1.0 — 2018-08-29
- 3.0.0 — 2018-08-03
- 2.1.1 — 2018-06-09
- 2.1.0 — 2016-11-22
- 2.0.0 — 2016-08-19
- 1.1.2 — 2016-08-19
- 1.1.1 — 2016-03-09
- 1.1.0 — 2016-02-04
- 1.0.2 — 2015-11-17
- 1.0.1 — 2015-07-13
- 1.0.0 — 2015-07-10

## README

# deglob [![travis][travis-image]][travis-url] [![npm][npm-image]][npm-url] [![downloads][downloads-image]][downloads-url] [![javascript style guide][standard-image]][standard-url]

[travis-image]: https://img.shields.io/travis/standard/deglob/master.svg
[travis-url]: https://travis-ci.org/standard/deglob
[npm-image]: https://img.shields.io/npm/v/deglob.svg
[npm-url]: https://npmjs.org/package/deglob
[downloads-image]: https://img.shields.io/npm/dm/deglob.svg
[downloads-url]: https://npmjs.org/package/deglob
[standard-image]: https://img.shields.io/badge/code_style-standard-brightgreen.svg
[standard-url]: https://standardjs.com

Take a list of glob patterns and return an array of file locations, respecting `.gitignore` and allowing for ignore patterns via `package.json`.

Giant swaths of this code were extracted from [standard](https://standardjs.com). It seems useful outside of that tool, so I've attempted to extract it! :)

## Install

```
npm install --save deglob
```

## Usage

```js
var deglob = require('deglob')

deglob(['**/*.js'], function(err, files) {
  files.forEach(function(file) {
    console.log('found file ' + file)
  })
})

// pass in some options to customize!

var path = require('path')
var opts = {
  cwd: path.join(__dirname, 'someDir'),
  useGitIgnore: false,
  usePackageJson: false
}

deglob(['**/*.js'], opts, function(err, files) {
  files.forEach(function(file) {
    console.log('found file ' + file)
  })
})
```

## Ignoring files in package.json
`deglob` will look for a `package.json` file by default and use any ignore patterns defined.

To define patterns in package.json add somthing like this:
```js
"config": {
  "ignore": ['**/*.bad']
}
```
If you do not fancy the `config` key, provide a different one using the `configKey` option.


## Options
Option         | Default       | Description
-------------- | --------      | -------
useGitIgnore   | true          | Turn on/off allowing ignore patterns via `.gitignore`
usePackageJson | true          | Turn on/off allowing ignore patterns via `package.json` config.
configKey      | 'config'      | This is the parent key in `package.json` to look for the `ignore` attribute.
gitIgnoreFile  | '.gitignore'  | Name of the `.gitignore` file look for (probably best to leave it default)
ignore         | []            | List of additional ignore patterns to use
cwd            | process.cwd() | This is the working directory to start the deglobbing

## Contributing

Contributions welcome! Please read the [contributing guidelines](CONTRIBUTING.md) first.

## License

[ISC](LICENSE.md)

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