This library allows you to create constants by just defining the key in the constant.
The library will create the values same as the constant. This library also supports
creation of multi-level constants. This work has been inspired from
bloody-keymirror and mirrorkey
$ npm install keymirrorplusvar keyMirrorPlus = require("keymirrorplus")keyMirrorPlus(object) > mirroredObjectIt takes an object or an array of strings and creates a new object having original object's keys and value would be the same as the key
Following are couple use cases for KeyMirrorPlus
var constants = keyMirrorPlus({
GET_DATA : null,
RECEIVED_DATA : null
});
console.log(constants.GET_DATA); // "GET_DATA"var constants ={
FOO : "FOO",
BAR : "BAR",
BAZ : "BAZ",
XYZ: {
ABC : "ABC",
JKL: "JKL"
}
};
console.log(constants.XYZ); // {"ABC":"ABC", "JKL":"JKL"}
console.log(constants.XYZ.ABC); // "ABC"Inspiration from: