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

0.0.2 • Public • Published

yup-schema-env

Parse environment variables with jquense/yup.

Installation

pnpm add yup-schema-env

Usage

import { object, number, string } from 'yup'
import { parseEnvironment } from 'yup-schema-env'

const schema = object().shape({
    port: number().default(3000),
    api_key: string(),
})

const env = process.env

const config = parseEnvironment(env, schema)
console.dir(config)

/yup-schema-env/

    Package Sidebar

    Install

    npm i yup-schema-env

    Weekly Downloads

    0

    Version

    0.0.2

    License

    ISC

    Unpacked Size

    3.63 kB

    Total Files

    5

    Last publish

    Collaborators

    • carlos-menezes