New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

clean-config

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

clean-config

Load config files in a simple & clean way.

  • 2.2.0
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
2
Maintainers
1
Weekly downloads
 
Created
Source

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:

{
  "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:

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);

Keywords

FAQs

Package last updated on 19 Aug 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc