map-env-node
TypeScript icon, indicating that this package has built-in type declarations

0.1.7 • Public • Published

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

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 0.1.7
    3
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 0.1.7
    3
  • 0.1.6
    0
  • 0.1.5
    0
  • 0.1.4
    0

Package Sidebar

Install

npm i map-env-node

Weekly Downloads

3

Version

0.1.7

License

MIT

Unpacked Size

5.12 kB

Total Files

5

Last publish

Collaborators

  • moirocar
  • fabiano.asj
  • souphsantos
  • lindsaycerqueira