0.9.0 • Published 8 months ago

@allohamora/config-manager v0.9.0

Weekly downloads
-
License
MIT
Repository
github
Last release
8 months ago

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
0.9.0

8 months ago

0.8.1

8 months ago

0.8.0

8 months ago

0.8.2

8 months ago

0.7.0

9 months ago

0.5.0

1 year ago

0.5.2

1 year ago

0.6.0

1 year ago

0.3.0

1 year ago

0.2.1

1 year ago

0.2.0

1 year ago

0.4.0

1 year ago

0.2.2

1 year ago

0.1.2

1 year ago

0.1.1

1 year ago

0.1.0

1 year ago

0.0.1

1 year ago