env-smart
Version:
Zero-dependency library for loading .env files. Supports default values and type definitions.
17 lines (16 loc) • 610 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.config = void 0;
/* eslint-disable @typescript-eslint/no-explicit-any */
const load_1 = require("./load");
/**
* Return structured, typed configuration information from both the process ENV and a .env file
* Takes in a transform function that populates a configuration type
*/
function config(transform, options) {
// Load the contents of the `.env` file and the process env
const env = (0, load_1.load)(options);
// Transform the env into the config type
return transform(env);
}
exports.config = config;