plasma
Load data from globs or files or directly from objects.
Last updated 10 years ago by jonschlinkert .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ npm install plasma 
SYNC missed versions from official npm registry.

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

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

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.

Current Tags

  • 0.9.1                                ...           latest (10 years ago)

26 Versions

  • 0.9.1                                ...           10 years ago
  • 0.9.0                                ...           10 years ago
  • 0.8.4                                ...           10 years ago
  • 0.8.3                                ...           10 years ago
  • 0.8.2                                ...           10 years ago
  • 0.8.1                                ...           10 years ago
  • 0.8.0                                ...           10 years ago
  • 0.7.1                                ...           10 years ago
  • 0.7.0                                ...           10 years ago
  • 0.6.1                                ...           10 years ago
  • 0.6.0                                ...           10 years ago
  • 0.5.0                                ...           10 years ago
  • 0.4.0                                ...           11 years ago
  • 0.3.2                                ...           11 years ago
  • 0.3.1                                ...           11 years ago
  • 0.3.0                                ...           11 years ago
  • 0.2.7                                ...           11 years ago
  • 0.2.6                                ...           11 years ago
  • 0.2.5                                ...           11 years ago
  • 0.2.4                                ...           11 years ago
  • 0.2.3                                ...           11 years ago
  • 0.2.2                                ...           11 years ago
  • 0.2.1                                ...           11 years ago
  • 0.2.0                                ...           11 years ago
  • 0.1.1                                ...           11 years ago
  • 0.1.0                                ...           11 years ago
Maintainers (1)
Downloads
Total 2
Today 1
This Week 1
This Month 1
Last Day 0
Last Week 0
Last Month 0
Dependencies (8)
Dev Dependencies (2)

© 2010 - cnpmjs.org x YWFE | Home | YWFE