Javascript object validation.