Skip to content
This repository has been archived by the owner on Oct 20, 2023. It is now read-only.

Use `process` to set and get value from different file during runtime.

License

Notifications You must be signed in to change notification settings

jxmked/NPM-Environment-Variables

Repository files navigation

NPM-Environment-Variables

Use Map and process to set and get value from different file during runtime.

Using Map object to easily access global variables from different files

Installation

npm i --save env-res

Usage

JavaScript

// index.js
const env = require('env-res');
const global_config = require("./global-config.js");

console.log(env.get("foo")); // bar
// global-config.js
const env = require('env-res');

env.set("foo", "bar");

TypeScript

// index.ts
import env from 'env-res';
import global_config from './global-config.ts';

console.log(env.get("foo")); // bar
// global-config.ts
import env from 'env-res';

env.set("foo", "bar");

Written by Jovan De Guia

Socials