I have an object declared like this:
my.namespace.FEATURES = {
FIRST_FEATURE = "first feature",
SECOND_FEATURE = "second feature"
};
I use my.namespace.my.object
to keep track of what kinds of features are available/implemented in my code. Every newly released version will have a modified set of features. A third-party using my minimized code will want to know what they can do in the version they have, so I supply the following function, which is exported, so that they know what they can do.
my.namespace.hasFeature = function(feature) {
for(var prop in my.namespace.FEATURES) {
if(my.namespace.FEATURES[prop] == feature) {
return true;
}
}
return false;
}
The problem is that the properties are getting renamed when I run Closure Compiler.
My question is: what's the best way to keep those properties preserved? I know I can export the property, but it feels kind of dirty for some reason. Is there a Closure best practice to preserve the properties of an object?