README
Adds file formats supported by require(). Will always return a JSON representation.
Supported file types are: json
, yaml
, csv
, xml
, ini
.
Install
npm install better-require
Example
require('better-require')('json');
var config = require('./config.json');
console.log(config);
Enable support for mutliple file types:
require('better-require')('json yaml xml');
// we can now require .xml, .yaml and .xml files!
var config = require('./config.yaml');
console.log(config);