Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

configjs-loader

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

configjs-loader

A simple script that loads json files into a config object for use in an app.

  • 1.0.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Version License Author

ConfigJS Loader

A simple config loader, that loads JSON files and returns an object of the loaded files and their contents.

Installation

It's a simple NPM package, so just run a normal NPM installation

npm i configjs-loader

Usage

See the test script below for example usage. All you need to supply as an argument is the directory that contains the config files. The script will attempt to recurse over that directory, finding all JSON files, and attempting to parse them. Returns a promise that must be awaited, which then returns the object of the configs loaded.

Configuration files are loaded into an object based on their filename. For example, if you have 2 config files, one.json and two.json, their properties will be loaded into {}.one and {}.two, respectively.

'use strict';
const configLoader = require("configjs-loader");
const path = require("path");

(async ()=>{
  const conf = await configLoader(path.join(__dirname, "configs"));
  console.log(conf);
})();

Keywords

FAQs

Package last updated on 09 Oct 2019

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