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

@unifig/validation-presenter-table

Package Overview
Dependencies
Maintainers
1
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@unifig/validation-presenter-table

Table validation presenter for unifig

  • 0.12.2-dev.6
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
827
decreased by-56.68%
Maintainers
1
Weekly downloads
 
Created
Source

Table validation presenter for Unifig

Transforms configuration validation errors into clear table.

Table of contents

Installation

npm i @unifig/validation-presenter-table
# or
yarn add @unifig/validation-presenter-table

Quick Start

// main.ts
import { Config, PlainConfigAdapter } from '@unifig/core';
import { toTable } from '@unifig/validation-presenter-table';

async function bootstrap() {
  const validationError = await Config.register({
    templates: [StorageOptions, NetworkOptions],
    adapter: new PlainConfigAdapter({}),
  });
  if (validationError) {
    console.error(toTable(validationError));
    process.exit(1);
  }
}

bootstrap();

Example output

┌──────────────────┬─────────────┬─────────────┬───────────────┬────────────────────┐
│ Template         │ Property    │ Source      │ Current Value │ Failed constraints │
├──────────────────┼─────────────┼─────────────┼───────────────┼────────────────────┤
│                  │ port        │ PORT        │ not-a-port    │ isInt              │
│                  ├─────────────┼─────────────┼───────────────┼────────────────────┤
│ StorageOptions   │ db.url      │ DB_URL      │ undefined     │ isString           │
│                  ├─────────────┼─────────────┼───────────────┼────────────────────┤
│                  │ db.password │ DB_PASSWORD │ undefined     │ isString           │
├──────────────────┼─────────────┼─────────────┼───────────────┼────────────────────┤
│ NetworkOptions   │ ipRange     │ IP_RANGE    │ undefined     │ isDefined          │
└──────────────────┴─────────────┴─────────────┴───────────────┴────────────────────┘

Source column presents where property value was taken from.

Example: from env variables in case of Env Adapter.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Keywords

FAQs

Package last updated on 05 Feb 2023

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