# parser-utils [![NPM version](https://badge.fury.io/js/parser-utils.svg)](http://badge.fury.io/js/parser-utils)


> Utilies for parser-cache and compatible parsers.

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

```bash
npm i parser-utils --save-dev
```

## Usage

```js
var utils = require('parser-utils');
```

## API
### [.fileKeys](index.js#L83)

* `returns` **{Array}**: Array of keys.  

Get the array of keys expected on normalized `file` objects.

### [.diffKeys](index.js#L105)

Get an array of keys that should not be on the root of a normalized `file` object.

* `obj` **{Object}**: The object to inspect.    
* `props` **{Array}**: Array of properties to concat to the output.    
* `returns` **{Array}**: Array of keys  

**Example:**

```js
var utils = require('parser-utils');
var file = {a: 'a', b: 'b', path: 'a/b/c.md'};
console.log(utils.diffKeys(file));
//=> ['a', 'b']
```

### [.siftKeys](index.js#L126)

* `obj` **{Object}**: The object to normalize.    
* `props` **{Array}**: Any additional properties to include.    
* `returns` **{Object}**: Normalized object.  

Normalize the properties on the given `obj`.

### [.mergeData](index.js#L155)

* `obj` **{Object}**: Object with data objects to merge.    
* `locals` **{Object}**: Optional object of data that should "win" over other data.    
* `merge` **{Function}**: Function to use for merging data.    
* `returns` **{Object}**: Object with a single `data` property.  

Return an object composed only of `data` properties. If a `locals` object
is supplied, properties in that object will override any properties on the
`data` object. If a `locals` object is defined, and/or if the `locals` object
has a nested `locals` property, both will be merged with the `data` property
on the returned object.

### [.flattenObject](index.js#L178)

Merge nested properties into the root of the given object. Nested properties occur when, for instance, and options object - intended as `locals`, is also passed with an actual `locals` property.

* `obj` **{Object}**: The object to flatten.    
* `key` **{String}**: The property to merge onto the root of the object.    
* `merge` **{Function}**: Function to use for merging data.    
* `returns` **{Object}**: Object with `locals` merged into the root.  

**Note** that this will only merge properties one level deep.

## 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 September 01, 2014._