@nexssp/const
Constants in JavaScript (global, objects)
Installation
npm i @nexssp/const
nConst("MYCONST", "VALUE EVERYWERE");
MYCONST = 1;
Usage
Let say you have some kind of config file.
const { nConst } = require("@nexssp/const");
nConst("MYCONST", "some value", process);
nConst("MYCONST2", "OLD CONSTANT VALUE");
const myConfig = {};
nConst("MyObjectCONST", "My old object const", myConfig);
module.exports = { myConfig };
All below will display error like:
const { myConfig } = require("./config");
process.MYCONST = 369;
myConfig.MyObjectCONST = 999999;
MYCONST2 = 333366669999;
myObject.MYCONST = "New value1";
MYCONST2 = "SOMETHING else";