# plasma [![NPM version](https://badge.fury.io/js/plasma.svg)](http://badge.fury.io/js/plasma)  [![Build Status](https://travis-ci.org/jonschlinkert/plasma.svg)](https://travis-ci.org/jonschlinkert/plasma)

> Load data from globs or files or directly from objects.

Install with [npm](https://www.npmjs.com/)

```sh
$ npm i plasma --save
```

## Usage

### [Plasma](index.js#L43)

Create an instance of `Plasma`, optionally passing an object of `data` to initialize with.

**Params**

* `data` **{Object}**

**Example**

```js
var Plasma = require('plasma');
var plasma = new Plasma();

// load some data
plasma.load(['*.json', 'data/*.yml']);
plasma.load({a: 'b', c: 'd'});
```

### [.dataLoader](index.js#L87)

Register a data loader for reading data. _(Note that as of 0.9.0, plasma no longer reads YAML files by default)_.

**Params**

* `ext` **{String}**: The file extension to match to the loader.
* `fn` **{Function}**: The loader function.

**Example**

```js
var fs = require('fs');
var yaml = require('js-yaml');

plasma.dataLoader('yml', function(fp) {
  var str = fs.readFileSync(fp, 'utf8');
  return yaml.safeLoad(str);
});

plasma.load('foo.yml');
```

## Related projects

* [config-cache](https://github.com/jonschlinkert/config-cache): General purpose JavaScript object storage methods.
* [cache-base](https://github.com/jonschlinkert/cache-base): Generic object cache for node.js/javascript projects.
* [map-cache](https://github.com/jonschlinkert/map-cache): Basic cache object for storing key-value pairs.
* [option-cache](https://github.com/jonschlinkert/option-cache): Simple API for managing options in JavaScript applications.
* [plasma-cache](https://github.com/jonschlinkert/plasma-cache): Object cache for [Plasma].

## Contributing

Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/plasma/issues/new)

## Running tests

Install dev dependencies:

```sh
$ npm i -d && npm test
```

## Author

**Jon Schlinkert**

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

## License

Copyright © 2014-2015 Jon Schlinkert
Released under the MIT license.

***

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