Socket
Socket
Sign inDemoInstall

@allohamora/config-manager

Package Overview
Dependencies
0
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @allohamora/config-manager

config manager


Version published
Maintainers
1
Install size
46.8 kB
Created

Changelog

Source

0.9.0 (2023-09-12)

Features

  • add option imports (8154a93)
  • add sourcemap (c751701)
  • add support for numeric objects (d44c80a)

Readme

Source

Config-Manager

npm build test release

This package contains managers and utils for creating configs in a type-safe and stylish way.

Requirements

{
  "node": ">=18.14.0",
  "npm": ">=9.3.1"
}

Install

npm i @allohamora/config-manager

Usage

import { ConfigManager, EnvManager } from '@allohamora/config-manager';

const env = new EnvManager();
const config = new ConfigManager({
  getConfig: () => ({
    auth: {
      email: env.pick('AUTH_EMAIL').default('example@example.com').value(), // string
      password: env.get('AUTH_PASSWORD'), // string | undefined,
    },
  }),
});

config.getOrThrow('auth'); // { email: string, password?: string }
config.get('auth.email'); // string
config.get('auth.password'); // string | undefined
config.getOrThrow('auth.password'); // string or the validation error

Keywords

FAQs

Last updated on 12 Sep 2023

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc