# flatten-hash ![travis build status](https://travis-ci.org/AndreasPizsa/flatten-hash.svg?style=flat-squared) ![NPM version](http://img.shields.io/npm/dm/flatten-hash.svg?style=flat-squared)


> Flatten nested objects to a single level in dot notation

## Usage
Use dot notation to flatten nested objects.

```javascript
var flattenHash = require('flatten-hash');
var nested = {foo: {bar: {baz: {bang: 'fez'} } }, a: 'b'};
console.log(var flat=flattenHash(nested));
```

flattens to:

```javascript
{ 'foo.bar.baz.bang' : 'fez', a:'b'}
```

which you can then refer to as

```javascript
console.log(flat['foo.bar.baz.bang']);
```

#### Limitations
Currently does not work with `Array`s and `RegExp` objects; will throw an error.

#### See also

[expand-hash](https://github.com/doowb/expand-hash) - Expand hash keys into an object with the given values.

[flat](https://github.com/hughsk/flat) - Flatten/unflatten nested Javascript objects


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

```bash
npm i flatten-hash --save-dev
```

## Contribute
All contributions are welcome! _Stars and tweets_ are always a great way to show your support! But we can definitely use some help with:

* [documentation](./docs)
* [writing unit tests](./test)
* [addressing issues](https://github.com/AndeasPizsa/flatten-hash/issues)

Please read [contributing guide](CONTRIBUTING.md) for more info!


# License
![license](http://img.shields.io/npm/l/flatten-hash.svg?style=flat-squared)

Copyright (c) 2014 Andreas Pizsa, contributors.  

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