# @jkempema/configuration

> configuration

Latest version **1.0.5** (published 2017-10-22) · MIT license · 0 weekly downloads

## Install

```sh
npm install @jkempema/configuration
pnpm add @jkempema/configuration
yarn add @jkempema/configuration
bun add @jkempema/configuration
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.5 |
| Published | 2017-10-22 |
| First published | 2017-10-14 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | jkempema |

## Links

- npm: https://www.npmjs.com/package/@jkempema/configuration
- Repository: https://github.com/jamie-kempema/configuration
- Homepage: https://github.com/jamie-kempema/configuration#readme
- Issues: https://github.com/jamie-kempema/configuration/issues
- npm.io page: https://npm.io/package/@jkempema/configuration

## Dependencies (1)

- [@jkempema/messaging](https://npm.io/package/@jkempema/messaging.md) ^1.0.4

## Recent versions

- 1.0.5 (latest) — 2017-10-22
- 1.0.4 — 2017-10-22
- 1.0.3 — 2017-10-22
- 1.0.2 — 2017-10-14
- 1.0.1 — 2017-10-14

## README

# configuration

Library to provide a consistent way of getting and setting configuration values.

## Usage

Load Values

```
import Configuration from 'configuration'

const config = new Configuration();

config.load( {
    something: 'some value',
    somethingElse: "some other value"
} );

const something = config.get( 'something' );
const somethingElse = config.get( 'somethingElse' );
```

Set & Get Values

```
import Configuration from 'configuration'

const config = new Configuration();

config.set( 'something', 'some value' );

const something = config.get( 'something' );

const somethingElse = config.get( 'somethingElse', 'default value' );
```

Listen for Changes
```
import Configuration from 'configuration'

const config = new Configuration();

const removeEventListener = config.addEventListener( 'change', ( key ) => {
    console.log( `config key ${ key } changed to ${ config.get( key ) }` ); 
} );

config.set( 'something', 'some value' );

removeEventListener();
```

## Global Configuration

The Configuration class has a global property to provide a means where configuration settings can accessed across libraries.

```
import Configuration from 'configuration'

const globalConfig = Configuration.global;

const something = globalConfig.getValue( 'something' );
```

---
_Source: https://npm.io/package/@jkempema/configuration · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
