By Nick Carbone | drumnickydrum@gmail.com
This application checks for the validity of records inside a JSON file. It considers a record invalid if either of the following conditions are met:
- It is a duplicate of another record
- The name field is null, missing, or blank
- The address field is null, missing, or blank
- The zip field is null, missing, or an invalid U.S. zipcode
For the purposes of this application, an invalid zipcode doesn't match the following formats:
- 12345
- 12345-1234
Note: ID collisions are not currently being checked.
- Install Node.js
- Download or clone this repo
- From the repo's path, open a CLI and enter:
node printBadRecords.js data.jsonA complete list of invalid and duplicate entries inside data.json will be printed to the console.
- Follow previous steps to install Node and Download/Clone this repo
- From the same path, install Jest as a dev dependency with:
npm install- Run tests:
npm testTo configure Jest, edit test script inside package.json.