General purpose JavaScript validation library