The RKelly library will parse JavaScript and return a parse tree.
Aaron Patterson
gem "rkelly", "~> 1.0.7"