https://github.com/hutsoninc/data-scrubber
Data validation and formatting utilities used by Hutson marketing team.
https://github.com/hutsoninc/data-scrubber
hutson internal-tool
Last synced: 7 months ago
JSON representation
Data validation and formatting utilities used by Hutson marketing team.
- Host: GitHub
- URL: https://github.com/hutsoninc/data-scrubber
- Owner: hutsoninc
- License: mit
- Created: 2018-12-21T13:40:36.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2020-06-08T06:07:17.000Z (about 6 years ago)
- Last Synced: 2025-01-28T05:36:09.910Z (over 1 year ago)
- Topics: hutson, internal-tool
- Language: JavaScript
- Size: 177 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 12
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# data-scrubber
[](https://travis-ci.com/hutsoninc/data-scrubber) [](https://www.npmjs.com/package/@hutsoninc/data-scrubber)
Data validation and formatting utilities used by Hutson marketing team.
## Usage
`npm install @hutsoninc/data-scrubber`
```js
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'
```
### API
Each method will validate and format the input, returning an empty string for invalid inputs or the formatted value otherwise.
#### scrubEmail
Converts input to lowercase string and returns it.
#### scrubHutsonBranch
Converts city name or store number to a formatted string.
#### scrubPhone
Removes formatting (hyphens, parentheses, and spaces), returning a 10-digit phone number string.
#### scrubState
Converts state names and abbreviations of any case to an all caps abbreviation string.
#### scrubZip
Removes +4 part from zip codes and returns 5-digit zip code string.
## License
MIT © [Hutson Inc](https://www.hutsoninc.com)