1.2.0 • Published 6 years ago

@soulmaneller-dev/config-loader v1.2.0

Weekly downloads
10
License
MIT
Repository
gitlab
Last release
6 years ago

pipeline status npm

This module will helps you for generating and loading your configuration file. It will merge default configuration and configuration from file. It uses method get from lodash for getting config data

How to use

Installation

Required nodejs version 8 or later

npm i @soulmaneller-dev/config-loader

Usage

configLoader( default_config [, options ] );

default_config (Object)

Default configuration object

options (Object)

The options also able to be set by environment variable

const configLoader = require( '@soulmaneller-dev/config-loader' );
const DEFAULT_CONFIG = {
    foo: 'bar',
    address: {
        street: 'road'
    }
};

const config = configLoader( DEFAULT_CONFIG );

config( 'foo' );
// -> 'bar'

config( 'address.street' );
// -> 'road'

config( 'name' );
// -> undefined

config( 'name', 'John' );
// -> 'John'
1.2.0

6 years ago

1.1.1

7 years ago

1.1.0

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago