Created
June 2, 2019 14:25
-
-
Save adamgen/71f95a29f28041aed28925b4c855e8f7 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
getAtts = (elem) => { | |
const attrs = {}; | |
Object.values(elem.attributes).forEach(attr => { | |
attrs[attr.name] = attr.value; | |
}); | |
return attrs | |
} | |
atts = getAtts($0); | |
d3Str = ''; | |
d3Str += `.append('${$0.tagName}')\n` | |
Object.entries(atts).forEach((touple)=>{ | |
key = touple[0]; | |
value = touple[1]; | |
d3Str += `.attr('${key}', '${value}')\n`; | |
}); | |
copy(d3Str); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment