automated tool to identify unused js functions?

automated tool to identify unused js functions?

Hello - I've been asked to remove all unused js functions from an application.  What's the easiest way to do this?
 
It seems like it would be pretty easy for an automated program to do this. For example, a regex to find each function xxx() in  the code base and then perform a text search for xxx references.
 
Are you aware of any existing automated tools that do this?