AmericanAirlines / simple-env

An intuitive, strongly typed, and scalable way to retrieve environment variables.
https://www.npmjs.com/package/@americanairlines/simple-env
MIT License
11 stars 9 forks source link

Add support for helper methods #2

Open SpencerKaiser opened 3 years ago

SpencerKaiser commented 3 years ago

Pre-requisites:

Feature Description

We should add support for helper methods. Here's @johnkahn's suggestion:

import setEnv, { key } from '../..';
const env = setEnv({
  nodeEnv: key('NODE_ENV').required().asString(),
  optional: key('PORT').default(3000).asPortNumber(),
});