Data validation and formatting utilities used by Hutson marketing team.
npm install @hutsoninc/data-scrubber
const {
scrubEmail,
scrubHutsonBranch,
scrubPhone,
scrubState,
scrubZip
} = require('@hutsoninc/data-scrubber');
scrubEmail('hello@me@mail.com');
// => ''
scrubHutsonBranch('hopkinsville');
// => 'Hopkinsville, KY'
scrubHutsonBranch(1);
// => 'Mayfield, KY'
scrubPhone('(123) 456-7890');
// => '1234567890'
scrubState('kentucky');
// => 'KY'
scrubZip('12345-6789');
// => '12345'
Each method will validate and format the input, returning an empty string for invalid inputs or the formatted value otherwise.
Converts input to lowercase string and returns it.
Converts city name or store number to a formatted string.
Removes formatting (hyphens, parentheses, and spaces), returning a 10-digit phone number string.
Converts state names and abbreviations of any case to an all caps abbreviation string.
Removes +4 part from zip codes and returns 5-digit zip code string.
MIT © Hutson Inc