0.1.7 • Published 4 years ago

map-env-node v0.1.7

Weekly downloads
9
License
MIT
Repository
github
Last release
4 years ago

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

FunctionDescriptionParamReturn
keyExistsMethod to check is exists the environment variable{string} key - variable nameboolean
get< T >Method to get the value from environment variable{string} key - variable nameT