Common js library for validation