Last active
August 29, 2015 14:06
-
-
Save anthonyserious/827efbbbae8c151c9ccf to your computer and use it in GitHub Desktop.
Converts standard JMX MBean names to JavaScript objects, where MBean names are of the form 'domain:key1=value1,key2=value2,...'
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function mbeanToObject (mbean) { | |
var obj = {}; | |
var a = mbean.split(":"); | |
obj.domain = a[0]; | |
obj.properties = []; | |
a[1].split(",").forEach(function(propPair) { | |
var pair = propPair.split("="); | |
obj.properties[pair[0]] = pair[1]; | |
}); | |
return obj; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Example: