1.0.1 • Published 4 years ago

minimal-yaml-config v1.0.1

Weekly downloads
-
License
ISC
Repository
-
Last release
4 years ago

Minimal YAML Config

Basically the title, a very minimal (9 lines of code, 1 dependency) package for loading a YAML config file. Really nothing special, just wanted to make a drop in replacement for 'dotenv' for my projects that supported some more convenient data types like lists and dictionary.

Installation

Install with npm.

npm install minimal-yaml-config

Usage

Basic usage:

# config.yml
property: propertyValue
dictionary:
  key: dictionaryValue
list:
  - listValue
const config = require('minimal-yaml-config');
console.log(config.property); // propertyValue
console.log(config.dictionary.key); // dictionaryValue
console.log(config.list[0]); // listValue

If you want to name the config something different:

# custom.yml
custom: customValue
const config = require('minimal-yaml-config').load('custom.yml');
console.log(config.custom); // customValue

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

License

MIT