# matchkeys

> Utility for returning a list of arrays that contain matching keywords. Useful for filtering package.json files.

Latest version **0.2.2** (published 2014-06-21) · 0 weekly downloads

## Install

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

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.2 |
| Published | 2014-06-21 |
| First published | 2013-09-22 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >= 0.8.0 |
| Dependencies | 2 |
| Known vulnerabilities | 0 (+5 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 3 |
| Author | Jon Schlinkert |
| Maintainers | jonschlinkert |
| Keywords | filepath, filter, key, keys, keyword, keywords, match, module, node, npm, package, package.json, paths, pattern, pkg, require, resolve, resolved |

## Links

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

## Dependencies (2)

- [lodash](https://npm.io/package/lodash.md) ~2.4.1
- [multimatch](https://npm.io/package/multimatch.md) ^0.3.0

## Alternatives

- [base64url](https://npm.io/package/base64url.md) — 6.1M weekly downloads
- [get-installed-path](https://npm.io/package/get-installed-path.md) — 502.9K weekly downloads
- [@uppy/url](https://npm.io/package/@uppy/url.md) — 185.8K weekly downloads
- [@d3fc/d3fc-shape](https://npm.io/package/@d3fc/d3fc-shape.md) — 16.2K weekly downloads
- [localizer](https://npm.io/package/localizer.md) — 226 weekly downloads

## Recent versions

- 0.2.2 (latest) — 2014-06-21
- 0.2.1 — 2014-06-21
- 0.2.0 — 2014-06-15
- 0.1.3 — 2013-10-05
- 0.1.2 — 2013-09-28
- 0.1.1 — 2013-09-23
- 0.1.0 — 2013-09-22

## README

# matchkeys [![NPM version](https://badge.fury.io/js/matchkeys.png)](http://badge.fury.io/js/matchkeys)

> Utility for returning a list of arrays that contain matching keywords. Useful for filtering package.json files.

## Install
Install with [npm](npmjs.org):

```bash
npm i matchkeys --save-dev
```

## Usage

```js
var matchkeys = require('matchkeys');
```

### matchkeys ( array, patterns, property )

Return an array of objects that contain arrays with matching strings. `patterns` may
be glob patterns, strings, or an array of glob patterns or strings.

**Example:**:

```js
var arr = [
  {name: 'a', keywords: ['apple', 'orange', 'grape']},
  {name: 'b', keywords: ['banana', 'orange', 'pineapple']},
  {name: 'c', keywords: ['watermelon', 'strawberry', 'kiwi']},
  {name: 'd', keywords: ['watermelon', 'blah']},
  {name: 'e', keywords: ['watermelon', 'blah', 'lodash']},
];
console.log(matchkeys(arr, 'apple'));
//=> [{name: 'a', keywords: ['apple', 'orange', 'grape']}]

console.log(matchkeys(arr, 'o*'));
//=>
// [
//   {name: 'a', keywords: ['apple', 'orange', 'grape']},
//   {name: 'b', keywords: ['banana', 'orange', 'pineapple']}
// ]
```

**Params:**

* `array` {Object|Array}:  
* `patterns` {String|Array}: The glob patterns or strings to use for matching. 
* `prop` {String}: Optionally pass the name of the property to search. 
* `return` {Array} Array of objects with matching strings. 


### matchkeys.filter ( array, patterns )

Wrapper around [multimatch](https://github.com/sindresorhus/multimatch). Returns
an array of matching strings, from an array or arrays of strings.

**Example:**

```js
var keywords = [
  ['apple', 'orange', 'grape'],
  ['banana', 'orange', 'pineapple'],
  ['watermelon', 'strawberry', 'kiwi'],
  ['watermelon', 'blah'],
  ['watermelon', 'blah', 'lodash'],
];

console.log(matchkeys.filter(keywords, '{p,b}*'));
//=> ['banana', 'pineapple', 'blah']
```

**Params:**

* `array` {Array}: Can be an array or an _array of arrays_. 
* `pattern` {Array|String}: The glob pattern to use. 
* `return` {Array}

## Author

**Jon Schlinkert**
 
+ [github/jonschlinkert](https://github.com/jonschlinkert)
+ [twitter/jonschlinkert](http://twitter.com/jonschlinkert) 

## License
Copyright (c) 2014 Jon Schlinkert, contributors.  
Released under the MIT license

***

_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on June 20, 2014._

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