Skip to content

About

The library maps the environment variables to the typescript object.

Resources

Stars

1 star

Watchers

2 watching

Forks

Repository files navigation

map-env-node

The library maps the environment variables to the typescript object.

      NPM         MIT  

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

About

The library maps the environment variables to the typescript object.

Resources

Stars

1 star

Watchers

2 watching

Forks

Releases

Packages

Contributors

Languages