Prefix Matches
---

Find matching keys in a given object, for a given prefix string

**Warning**: experimental

## Installation

	npm i --save prefix-matches
	
then, in your scripts:

```js
const prefixMatches = require('prefix-matches')
```

## Example

```js
const prefixMatches = require('prefix-matches')

prefixMatches('w', {
	watch: 'watch things',
	build: 'build things'
}) // => ['watch things']

prefixMatches('w', {
	watch: {
		js: 'watch javascript',
		css: 'watch css'
	},
	build: 'build things'
}) // => [{js: 'watch javascript', css: 'watch css'}]

prefixMatches('w.j', {
	watch: {
		js: 'watch javascript',
		css: 'watch css'
	}
}) // => ['watch javascript']
```

## Why?

To attempt better prefixing support for the [package-scripts](https://github.com/kentcdodds/p-s) project.

## Tests

A basic test suite has been authored in [AVA](https://github.com/sindresorhus/ava), used for its terrifying speed. To run it:

	npm test
Prefix Matches
---

Find matching keys in a given object, for a given prefix string

**Warning**: experimental

## Installation

	npm i --save prefix-matches

then, in your scripts:

```js
const prefixMatches = require('prefix-matches')
```

## Example

```js
const prefixMatches = require('prefix-matches')

// Resolves simple cases
prefixMatches('w', {
	watch: 'watch things',
	build: 'build things'
}) // => ['watch things']

// Does not flatten result set
prefixMatches('w', {
	watch: {
		js: 'watch javascript',
		css: 'watch css'
	},
	build: 'build things'
}) // => [{js: 'watch javascript', css: 'watch css'}]

// Resolves nested prefixes
prefixMatches('w.j', {
	watch: {
		js: 'watch javascript',
		css: 'watch css'
	},
	write: {
		js: 'write javascript'
	}
}) // => ['watch javascript', 'write javascript']

// ... and so on
prefixMatches('b.f.j', {
	build: {
		frontend: {
			js: 'build javascript',
			css: 'build css'
		}
	}
}) // => ['build javascript']
```

## Why?

To attempt better prefixing support for the [package-scripts](https://github.com/kentcdodds/p-s) project.

## Tests

A basic test suite has been authored in [AVA](https://github.com/sindresorhus/ava), used for its terrifying speed. To run it:

	npm test

Tidy up readme Also brings in line with actual test specs used
Tidy up readme
Also brings in line with actual test specs used
