1.0.0 • Published 4 years ago

yup-config v1.0.0

Weekly downloads
4
License
MIT
Repository
github
Last release
4 years ago

yup-config

Validate configuration objects using yup.

Usage

import * as Config from 'yup-config';

const ConfigSchema = {
  http: Config.object({
    port: Config.number().integer().default(3000),
  }),
};

// load & validate directly from a file
const config = Config.loadConfig('path/to-config.json', ConfigSchema);

// validate from an object
Config.getConfig({ http: { port: 3000 } }, ConfigSchema);