make javascript parsing api more flexible