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

composable-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

composable-config

Composable app configuration with reading, conversion, validation and type support built-in.

latest
Source
npmnpm
Version
0.2.0
Version published
Weekly downloads
5
400%
Maintainers
1
Weekly downloads
 
Created
Source

Composable Config

Composable app configuration with loading, conversion, validation and type support built-in.

  • API Reference
  • IO Types
  • Loaders
  • Common Patterns
  • TypeScript

Quick Start

npm i composable-config
import { createConfig, buildConfig } from 'composable-config';
import * as ct from 'composable-config/io';
import envLoader from 'composable-config/loaders/env';

const dbConfig = createConfig({
  tableName: ct.string,
});

const serverConfig = createConfig({
  host: {
    _: ct.string,
    default: '127.0.0.1',
  },
  port: {
    _: ct.Port,
    default: 8080,
    env: 'SERVER_PORT',
  },
});

const appConfig = createConfig({
  server: serverConfig,
  db: dbConfig,
});

const config = buildConfig({
  config: appConfig,
  loaders: [envLoader()],
  defaults: {
    db: {
      tableName: 'xyz',
    },
  },
});

assert(process.env['SERVER_PORT']).equals('1234');

assert(config).equals({
  db: {
    tableName: 'xyz',
  },
  server: {
    host: '127.0.0.1',
    port: 1234,
  },
});

FAQs

Package last updated on 15 Oct 2018

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