Skip to content

Instantly share code, notes, and snippets.

@julesfern
Created May 26, 2011 09:46
Show Gist options
  • Save julesfern/992851 to your computer and use it in GitHub Desktop.
Save julesfern/992851 to your computer and use it in GitHub Desktop.
parse machine tags
function parseMachineTags(tagStr, namespace) {
var tags = tagStr.split("\0");
var attrs = {};
for(var i in tags) {
var tag = tags[i];
if(tag.indexOf(namespace+":") == 0 && tag.indexOf("=") > namespace.length+2) {
var tagPair = tag.split("=");
attrs[tagPair[0]] = tagPair[1];
}
}
return attrs;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment