# clean-config

> Load config files in a simple & clean way.

Latest version **2.2.0** (published 2020-08-19) · 0 weekly downloads

## Install

```sh
npm install clean-config
pnpm add clean-config
yarn add clean-config
bun add clean-config
```

## 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 | 2.2.0 |
| Published | 2020-08-19 |
| First published | 2020-06-25 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 13.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | wv-coder |
| Maintainers | wv-coder |
| Keywords | clean, config, configuration, load, save |

## Links

- npm: https://www.npmjs.com/package/clean-config
- npm.io page: https://npm.io/package/clean-config

## Alternatives

- [jsforce](https://npm.io/package/jsforce.md) — 851.2K weekly downloads
- [react-native-qrcode-svg](https://npm.io/package/react-native-qrcode-svg.md) — 693.5K weekly downloads
- [@salesforce/plugin-data](https://npm.io/package/@salesforce/plugin-data.md) — 394.9K weekly downloads
- [@backstage/plugin-search-common](https://npm.io/package/@backstage/plugin-search-common.md) — 308.5K weekly downloads
- [@chain-registry/types](https://npm.io/package/@chain-registry/types.md) — 38.4K weekly downloads

## Recent versions

- 2.2.0 (latest) — 2020-08-19
- 2.1.0 — 2020-08-18
- 2.0.2 — 2020-08-18
- 1.0.1 — 2020-06-25

## README

# `clean-config`

A quick package to load config files in a simple & clean way.


## Versions

+   **2.2.0**, _2020-08-19, AMV_ :  Hacked out new MagicMap features, but didn’t doc it yet.
+   **2.1.0**, _2020-08-18, AMV_ :  Added KEY swaps, but didn’t doc it yet.
+   **2.0.2**, _2020-08-17, AMV_ :  Changed to brackets for keys, and fixed comments to longer clash with URLs.
+   **1.0.1**, _2020-06-24, AMV_ :  First publish.


## Usage

Here’s an example of a config file’s syntax:
```
// This is a comment line.
[SomeKey1]     Here is a value to assign to SomeKey.
[AnotherKey2]  Here's a value to assign to a different key.
```

Loading that file in using `clean-config` returns:
```json
{
  "SomeKey1": "Here is a value to assign to SomeKey.",
  "AnotherKey2": "Here's a value to assign to a different key."
}
```

And here’s how to use the package:
```javascript
const cleanConfig = require('clean-config');

// Basic transforms between Text and ConfigObject:
const cfg = cleanConfig.fromText('[key1]Aaa\n[key2]Bbb');
const txt = cleanConfig.toText(cfg);

// FS helpers:
const cfg = cleanConfig.readSync('/some/path/mycfgfile.txt');
const cfg = cleanConfig('/some/path/mycfgfile.txt'); // short syntax
cleanConfig.writeSync('/some/path/mycfgfile.txt', cfg);
```

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