Flexible JavaScript object validator