# @humanwhocodes/gitignore-to-minimatch

> Utility to convert gitignore patterns to minimatch patterns

Latest version **1.0.2** (published 2022-03-08) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install @humanwhocodes/gitignore-to-minimatch
pnpm add @humanwhocodes/gitignore-to-minimatch
yarn add @humanwhocodes/gitignore-to-minimatch
bun add @humanwhocodes/gitignore-to-minimatch
```

## Health

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

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.2 |
| Published | 2022-03-08 |
| First published | 2022-01-21 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 18.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 12 |
| Author | Nicholas C. Zaks |
| Maintainers | nzakas |
| Keywords | gitignore, minimatch, glob |

## Links

- npm: https://www.npmjs.com/package/@humanwhocodes/gitignore-to-minimatch
- Repository: https://github.com/humanwhocodes/gitignore-to-minimatch
- Homepage: https://github.com/humanwhocodes/gitignore-to-minimatch#readme
- Issues: https://github.com/humanwhocodes/gitignore-to-minimatch/issues
- Funding: https://github.com/sponsors/nzakas
- npm.io page: https://npm.io/package/@humanwhocodes/gitignore-to-minimatch

## Recent versions

- 1.0.2 (latest) — 2022-03-08
- 1.0.1 — 2022-02-18
- 1.0.0 — 2022-01-21

## README

# Gitignore to Minimatch Utility

by [Nicholas C. Zakas](https://humanwhocodes.com)

If you find this useful, please consider supporting my work with a [donation](https://humanwhocodes.com/donate).

## Description

A function that converts a [gitignore](https://git-scm.com/docs/gitignore#_pattern_format) pattern into a [minimatch](https://github.com/isaacs/minimatch) pattern. There are subtle differences between these two formats, and depending on the utilities you're using, you may need one or the other.

## Usage

### Node.js

Install using [npm][npm] or [yarn][yarn]:

```
npm install @humanwhocodes/gitignore-to-minimatch --save

# or

yarn add @humanwhocodes/gitignore-to-minimatch
```

Import into your Node.js project:

```js
// CommonJS
const { gitignoreToMinimatch } = require("@humanwhocodes/gitignore-to-minimatch");

// ESM
import { gitignoreToMinimatch } from "@humanwhocodes/gitignore-to-minimatch";
```

### Deno

Import into your Deno project:

```js
import { gitignoreToMinimatch } from "https://cdn.skypack.dev/@humanwhocodes/gitignore-to-minimatch?dts";
```

### Browser

It's recommended to import the minified version to save bandwidth:

```js
import { gitignoreToMinimatch } from "https://cdn.skypack.dev/@humanwhocodes/gitignore-to-minimatch?min";
```

However, you can also import the unminified version for debugging purposes:

```js
import { gitignoreToMinimatch } from "https://cdn.skypack.dev/@humanwhocodes/gitignore-to-minimatch";
```

## API

After importing, call `gitignoreToMinimatch` with a string argument, like this:

```js
const minimatchPattern = gitignoreToMinimatch("foo");
console.log(minimatchPattern);      // "**/foo"
```

## Developer Setup

1. Fork the repository
2. Clone your fork
3. Run `npm install` to setup dependencies
4. Run `npm test` to run tests

## License

Apache 2.0

[npm]: https://npmjs.com/
[yarn]: https://yarnpkg.com/

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