0.1.7 • Published 4 years ago
map-env-node v0.1.7
Installation
Install via NPM:
npm install map_env_node
Usage
.env (file)
API_CREDENTIAL={"projectId":1, "privateKey":"R1FT2S8D6S11H2SAA4HD"}
TypeScript
import { MapEnv } from "map-env-node";
interface Credential {
projectId: string;
privateKey: string;
}
let credential = MapEnv.get<Credential>("API_CREDENTIAL");
console.log(credential.projectId);
Result: 1;
Functionality
Function | Description | Param | Return |
---|---|---|---|
keyExists | Method to check is exists the environment variable | {string} key - variable name | boolean |
get< T > | Method to get the value from environment variable | {string} key - variable name | T |