I have an object that looks like below. Basically it contains properties that call a method. What I would like to be able to do is, instead of having DEVELOPER twice (Once for the property name and once for the parameter value), I'd like to get the current property of what was called in order to get this.
Also I don't want to pass in 'DEVELOPER' as a parameter in the initial call because I want intellisense to pick it up.
return {
DEVELOPER: function ()
{
return getEmailRecipients("DEVELOPER")
}
}
//it get's called like this.
emailGroups.DEVELOPER();
Essentially I'd like to do something like
return {
DEVELOPER: function ()
{
return getEmailRecipients({this.currentPropName}) //Which would equal DEVELOPER.
}
}
If there is a better way to do this, I am all ears.
Thanks in advance!