Skip to content

Instantly share code, notes, and snippets.

@Allwin12
Created July 4, 2020 15:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Allwin12/4a23c28b0d5d374cbff3d25f684f060f to your computer and use it in GitHub Desktop.
Save Allwin12/4a23c28b0d5d374cbff3d25f684f060f to your computer and use it in GitHub Desktop.
import js2xml
jscode = """function factorial(n) {
if (n === 0) {
return 1;
}
return n * factorial(n - 1);
}"""
parsed = js2xml.parse(jscode)
print(parsed.xpath("//funcdecl/@name"))
# ['factorial']
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment