Identify anonymous js functs so we can unit test.

This code was heavily influenced/designed by nejucomo.