JS validations using Object Map