validate() javascript interface proposal

failing tests as some bugs discovered