1.0.1 • Published 9 months ago

@jaybeeuu/conv v1.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
9 months ago

Conv

A utility for loading a typesafe env.

Usage

Conv reads a .env file, in the current working directory, using dotenv. Then validates the variables you expect to find in it.

import { conv } from "@jaybeeuu/conv";

interface Environment {
  SECRET_KEY: string;
  URL: string;
  USE_COMPRESSION?: string;
}

const env: Environment = conv(
  "SECRET_KEY",
  { name: "URL", default: "https://dev.your-domain.com" },
  { name: "USE_COMPRESSION", optional: true },
); // ✅

If the environment doesn't match expectations then an exception will be thrown.

1.0.1

9 months ago

1.0.0

12 months ago

0.0.1

1 year ago

0.0.0

1 year ago