move isValidRecord to common.js, better api for formatter