{"_id":"csv-validator","_rev":"5-0858dab23d853eb5a160dd1b74a9293c","name":"csv-validator","description":"csv parser with validator","dist-tags":{"latest":"0.0.3"},"versions":{"0.0.1":{"name":"csv-validator","version":"0.0.1","description":"csv parser with validator","main":"./lib","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"keywords":["csv","parser","validator"],"author":{"name":"jettcalleja"},"license":"MIT","dependencies":{"csvtojson":"^1.1.9"},"repository":{"type":"git","url":"git+https://github.com/jettcalleja/csv-validator.git"},"devDependencies":{"chai":"^4.1.2","eslint":"^4.10.0","eslint-config-standard":"^10.2.1","eslint-plugin-import":"^2.8.0","eslint-plugin-node":"^5.2.1","eslint-plugin-promise":"^3.6.0","eslint-plugin-standard":"^3.0.1","mocha":"^4.0.1","should":"^13.1.3"},"gitHead":"b34fd922cff689f77f6b38a90f71973279a985e6","bugs":{"url":"https://github.com/jettcalleja/csv-validator/issues"},"homepage":"https://github.com/jettcalleja/csv-validator#readme","_id":"csv-validator@0.0.1","_npmVersion":"5.5.1","_nodeVersion":"8.9.0","_npmUser":{"name":"jettcalleja","email":"jettcalleja@gmail.com"},"dist":{"integrity":"sha512-dNu6w91NKUvngonPH9r5SDmO4A/l/gKbn3PJGy9dtLAFkDju8SYVatFJpWZRkeiBCpPYWYXBNrhcTHvgcqMOXA==","shasum":"69501a3f7113ae40d07fb8ae3e09364750880a03","tarball":"https://registry.npmjs.org/csv-validator/-/csv-validator-0.0.1.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDIxZjY+xvzuS25daah+h9IGcj+uB3p8Y8P/QlJ061bLgIgOdgu+QIWYhOvThjeqjlr/lQ6ttpT5aNBsIGKnZ+nmxw="}]},"maintainers":[{"name":"jettcalleja","email":"jettcalleja@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/csv-validator-0.0.1.tgz_1509556679220_0.17345237755216658"}},"0.0.2":{"name":"csv-validator","version":"0.0.2","description":"csv parser with validator","main":"./lib","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"keywords":["csv","parser","validator"],"author":{"name":"jettcalleja"},"license":"MIT","dependencies":{"csvtojson":"^1.1.9"},"repository":{"type":"git","url":"git+https://github.com/jettcalleja/csv-validator.git"},"devDependencies":{"chai":"^4.1.2","eslint":"^4.10.0","eslint-config-standard":"^10.2.1","eslint-plugin-import":"^2.8.0","eslint-plugin-node":"^5.2.1","eslint-plugin-promise":"^3.6.0","eslint-plugin-standard":"^3.0.1","mocha":"^4.0.1","should":"^13.1.3"},"gitHead":"774420eb7cf9f2af0fcc509aa01e3c957af554fe","bugs":{"url":"https://github.com/jettcalleja/csv-validator/issues"},"homepage":"https://github.com/jettcalleja/csv-validator#readme","_id":"csv-validator@0.0.2","_npmVersion":"5.5.1","_nodeVersion":"8.9.0","_npmUser":{"name":"jettcalleja","email":"jettcalleja@gmail.com"},"dist":{"integrity":"sha512-EadDBXKSeb8LR666bwSbSeQPucsq9N2Ng1CLnup/XX9lVya74DuHn3qAKc8162uWk2ijyUd+hcnLJFBFvuLySw==","shasum":"577bf2443c10c4f81d25bdc610a8a9c5070772ac","tarball":"https://registry.npmjs.org/csv-validator/-/csv-validator-0.0.2.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIBWKLxI4CVONya5ZheD9RBy2C/CoJr9u6Vytd0oE9bZWAiBlInNHwTQPhly80JQpFGpeZGtx73sFLP0bfaPH0eVpJw=="}]},"maintainers":[{"name":"jettcalleja","email":"jettcalleja@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/csv-validator-0.0.2.tgz_1509557004549_0.05254137306474149"}},"0.0.3":{"name":"csv-validator","version":"0.0.3","description":"csv parser with validator","main":"./lib","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"keywords":["csv","parser","validator"],"author":{"name":"jettcalleja"},"license":"MIT","dependencies":{"csvtojson":"^1.1.9"},"repository":{"type":"git","url":"git+https://github.com/jettcalleja/csv-validator.git"},"devDependencies":{"chai":"^4.1.2","eslint":"^4.10.0","eslint-config-standard":"^10.2.1","eslint-plugin-import":"^2.8.0","eslint-plugin-node":"^5.2.1","eslint-plugin-promise":"^3.6.0","eslint-plugin-standard":"^3.0.1","mocha":"^4.0.1","should":"^13.1.3"},"gitHead":"f9b3cfb649a9460cbc8603266cacf7c5c2e1d216","bugs":{"url":"https://github.com/jettcalleja/csv-validator/issues"},"homepage":"https://github.com/jettcalleja/csv-validator#readme","_id":"csv-validator@0.0.3","_shasum":"b2acb8f46f197af44cc0a4992e63ef7b48279a2a","_from":".","_npmVersion":"3.10.8","_nodeVersion":"6.9.1","_npmUser":{"name":"jettcalleja","email":"jettcalleja@gmail.com"},"dist":{"shasum":"b2acb8f46f197af44cc0a4992e63ef7b48279a2a","tarball":"https://registry.npmjs.org/csv-validator/-/csv-validator-0.0.3.tgz","integrity":"sha512-8IM4Z0HOMOmJzYvAKFUkxOycomilTpgmMEe9nz10+mk5J5Td4x1/+miJuAx64j8BbQUQRmnU0x5iRNfC6QwWcA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCICbrD9xJnAeG3KstMLSJHXIqzXymaMEw866Am4AsMlBkAiBbRpXPoiS9CafsJF3nz87MfqJStZ1VjLH6DOtyNjz+Xw=="}]},"maintainers":[{"name":"jettcalleja","email":"jettcalleja@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/csv-validator-0.0.3.tgz_1509557624848_0.09413273981772363"}}},"readme":"# `csv-validator`\n\nnodejs validator for csv file\n\n# Features\n\n* Parse csv (supports only file as of now) and convert to json array\n* Validate each line with type or RegExp\n* Return each line's error with error message\n* Support callback and promise\n* Non-blocking parsing\n\n# Install\n\n```sh\nnpm install csv-validator --save\n```\n\n# Example\n\nWithout errors:\n\n```javascript\n/** csv file\nname,phone,email,country\njohn,123,john@ph.com,PH\ndoe,456,doe@us.com,US\n*/\n\nconst csv = require('csv-validator');\nconst csvFilePath = '<path to csv file>';\nconst headers = {\n    name: '', // any string\n    phone: 1, // any number\n    email: /^(([^<>()[\\]\\\\.,;:\\s@\\\"]+(\\.[^<>()[\\]\\\\.,;:\\s@\\\"]+)*)|(\\\".+\\\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$/, // RegExp\n    _country: '' // add '_' as first character of the key to indicate as optional\n};\n\ncsv(csvFilePath, headers)\n    .then(console.log) // [ { name: 'john', phone: '123', email: 'john@ph.com', country: 'PH' }, { name: 'doe', phone: '456', email: 'doe@us.com', country: 'US' } ]\n```\n\nWith error:\n\n```javascript\n/** csv file\nname,phone,email,country\njohn,123a,john@ph.com,PH\ndoe,456,doe@us.com\n*/\n\nconst csv = require('csv-validator');\nconst csvFilePath = '<path to csv file>';\nconst headers = {\n    name: '', // any string\n    phone: 1, // any number\n    email: /^(([^<>()[\\]\\\\.,;:\\s@\\\"]+(\\.[^<>()[\\]\\\\.,;:\\s@\\\"]+)*)|(\\\".+\\\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$/, // RegExp\n    country: '' // add '_' as first character of the key to indicate as optional\n};\n\ncsv(csvFilePath, headers)\n    .then(console.log)\n    .catch(console.error) // [ 'Row 1: phone must be a type number', 'Row 2: country is required' ]\n```\n\nError messages:\n\n* **... must be a type number**: the column should be a number\n* **... is required**: the column should be filled\n* **... must be in /^[0-9]?.*/**: the column should be in RegExp (in this example: /^[0-9]?$/)\n\n# Contribution \n\n* Any pull request for new features and bug fixes is appreciated.\n* Just make sure to add test.\n\n# LICENSE\n\nMIT","maintainers":[{"name":"jettcalleja","email":"jettcalleja@gmail.com"}],"time":{"modified":"2022-06-14T05:19:51.967Z","created":"2017-11-01T17:17:59.338Z","0.0.1":"2017-11-01T17:17:59.338Z","0.0.2":"2017-11-01T17:23:24.638Z","0.0.3":"2017-11-01T17:33:44.919Z"},"homepage":"https://github.com/jettcalleja/csv-validator#readme","keywords":["csv","parser","validator"],"repository":{"type":"git","url":"git+https://github.com/jettcalleja/csv-validator.git"},"author":{"name":"jettcalleja"},"bugs":{"url":"https://github.com/jettcalleja/csv-validator/issues"},"license":"MIT","readmeFilename":"README.md"}