New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

letsconfig

Package Overview
Dependencies
Maintainers
0
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

letsconfig

Class for working with a configuration file

latest
Source
npmnpm
Version
1.0.3
Version published
Maintainers
0
Created
Source

letsConfig

letsConfig is a class for working with a configuration file.

Table of Contents

letsConfig

  • The letsConfig class allows you to automate work with the application configuration file.

  • The index.js bundle works well in Node.js. It is used by default when you require('letsconfig') in Node.js.

Getting started

Node.js

Install letsconfig using npm:

npm install letsconfig

And import it as a CommonJS module:

const letsConfig = require('letsconfig');

Examples

Here are some examples of how to use letsConfig.

Constructor

The constructor method takes the following optional parameters:

  • options - an object with arbitrary data. Keys and values ​​will be assigned to the class during the initialization process. By default, it takes the value of an empty object: options = {}. If a configuration file with a JSON structure is read, the keys from this file will have priority for assigning variables.

  • dir - a string specifying the absolute path to the directory containing the configuration file. Example: /home/username/sites/somedomain/.

  • fileName - a string specifying the name of the configuration file with the json extension.

let config = new letsConfig({
		host: 'localhost',
		port: 8000
	},
	'/home/username/sites/somedomain/',
	'configuration.json');
console.log(config.host);
console.log(config.port);

// or

let conf = new letsConfig();
console.log(conf);

writeConfigFile

The writeConfigFile function writes the current class data to a JSON configuration file.

config.writeConfigFile();

License

GNU Lesser General Public License (3.0 or any later version). Please take a look at the LICENSE file for more information.

Keywords

class

FAQs

Package last updated on 11 Nov 2024

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