plasma

Load data from globs or files or directly from objects.

  • plasma

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
plasma
2230.9.19 years ago10 years agoMinified + gzip package size for plasma in KB

Readme

plasma NPM version Build Status
Load data from globs or files or directly from objects.

Install with npm
$ npm i plasma --save

Usage

Plasma

Create an instance of Plasma, optionally passing an object of data to initialize with.
Params
  • data {Object}

Example
var Plasma = require('plasma');
var plasma = new Plasma();

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

.dataLoader

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
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

Contributing

Pull requests and stars are always welcome. For bugs and feature requests, please create an issue

Running tests

Install dev dependencies:
$ npm i -d && npm test

Author

Jon Schlinkert

License

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

This file was generated by verb-cli
on June 01, 2015.