simple way to validate object in javasciprt