yup-config
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

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);

Readme

Keywords

none

Package Sidebar

Install

npm i yup-config

Weekly Downloads

1

Version

1.0.0

License

MIT

Unpacked Size

2.59 kB

Total Files

6

Last publish

Collaborators

  • mattinsler