Confa
Simple environment-dependent config tool. Make your own env-based config easy.
Using
npm i confa
const Confa = ;const confa = ; confa; // valueconfa;// default_value confa; // { key: 'value', another_key: 'default_value' }confa; // { key: 'value', another_key: 'dev_value' }confa; // { key: 'value', another_key: 'rc_value' }confa; // { key: 'value', another_key: 'default_value' }
Confa([environment])
Return new confa tool with predefined environment (not required)
environment affects on the returned result of .add method
.add(key, value, [extension])
Just add any value (number, string, boolean, object) to a key
.add(key, value, [extension])
extension allows you to return the dependent value
Returns value that depends on predefined environment in Confa or default value
const confa = ;confa; // prod_value
.make([env])
Returns the specific {key: value} object basing on the environment or state
.make() -> default values
.make('special') -> special values
Make JSON config great again