My situation involves a standard revealing module pattern where I only want to expose a specific subset of my config settings publicly, rather than exposing all of them. However, my current approach is not functioning as expected and I am wondering if there might be a workaround or if I am overlooking something.
var rmp = function(){
var config = {
someValue = "I like p&j sandwiches",
anotherVal = {
a: 'somevalue'
}
}
var func1 = function(){
// do some stuff
}
return {
func1: func1,
config.someValue: someValue // <-- doesn't work
config[someValue] : someValue // <-- doesn't work
config : config // <-- works
}
}
It seems that the properties of the hash are not accessible as individual entities. While creating a function that returns the value would solve the issue, I would prefer to avoid adding another function for this purpose.
var showme = function(){
return config.someValue;
}
return {
func1: func1,
showme: showme
}