{"_id":"@afzalimdad9/simple-card-validator","name":"@afzalimdad9/simple-card-validator","dist-tags":{"latest":"1.2.3"},"versions":{"1.2.3":{"name":"@afzalimdad9/simple-card-validator","version":"1.2.3","description":"Card validation helpers for card number, expiry and CVV.","main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1","minify":"minify --output dist/validator.js src/validator.js"},"repository":{"type":"git","url":"git+https://github.com/afzalimdad9/card-validator.git"},"keywords":["card-validation","validation","card","checker"],"author":{"name":"boazjohn@gmail.com"},"license":"MIT","bugs":{"url":"https://github.com/afzalimdad9/card-validator/issues"},"homepage":"https://github.com/afzalimdad9/card-validator#readme","_id":"@afzalimdad9/simple-card-validator@1.2.3","_nodeVersion":"20.16.0","_npmVersion":"10.8.1","dist":{"integrity":"sha512-CoeykLyqe0UhvCMx+nR8Dl+kBZTH3Ryox1qID4yjL7JkbUBMYtgNtNdJKJCrjKmoK8OppbPAiRf7acwg/KLX7w==","shasum":"91d5b35cddf7d540c7e4d7f3a7257c8e77161896","tarball":"https://registry.npmjs.org/@afzalimdad9/simple-card-validator/-/simple-card-validator-1.2.3.tgz","fileCount":7,"unpackedSize":16731,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIAVUqhgSHldmQeSnirYnrpQ2+4w9/4u+Pi4+A0hEk5YAAiEA2Ku65ZeiGvGlsZLUyHamkgClOmda9bmp7C6Pb4EoPgM="}]},"_npmUser":{"name":"afzalimdad9","email":"afzalimdad9@gmail.com"},"directories":{},"maintainers":[{"name":"afzalimdad9","email":"afzalimdad9@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/simple-card-validator_1.2.3_1724661389234_0.6880237441194719"},"_hasShrinkwrap":false}},"time":{"created":"2024-08-26T08:36:29.159Z","1.2.3":"2024-08-26T08:36:29.369Z","modified":"2024-08-26T08:36:29.602Z"},"maintainers":[{"name":"afzalimdad9","email":"afzalimdad9@gmail.com"}],"description":"Card validation helpers for card number, expiry and CVV.","homepage":"https://github.com/afzalimdad9/card-validator#readme","keywords":["card-validation","validation","card","checker"],"repository":{"type":"git","url":"git+https://github.com/afzalimdad9/card-validator.git"},"author":{"name":"boazjohn@gmail.com"},"bugs":{"url":"https://github.com/afzalimdad9/card-validator/issues"},"license":"MIT","readme":"# Card Validator\n\nGeneric helpers for card number, expiry and CVV validations\n\n[![npm version](https://badge.fury.io/js/%40afzalimdad9%2Fsimple-card-validator.svg)](https://badge.fury.io/js/%40afzalimdad9%2Fsimple-card-validator)\n\n## Usage:\nImport the library and initialize card object.\n\nInstall from npm:\n\n`npm i @afzalimdad9/simple-card-validator --save`\n\n`var cardValidator = require('simple-card-validator');`\n\nOr, you can simply use the file from `dist/validator.js` if you are not using node/npm.\n\n`var card = new cardValidator('4242-4242-4242-4242');`\n\n### Getting card details\n`card.getCardDetails();`\nThis would output, card brand and different validation outputs like below:\n```\n{ card_type: 'visa',\n  valid: true,\n  luhn_valid: true,\n  length_valid: true,\n  cvv_length: [ 3 ],\n  gaps: [ 4, 8, 12 ],\n  supported_lengths: [ 16 ],\n  max_length: 16 }\n```\n\n#### Output format\n\n| Field             | Description                           | Type              |\n| ----------------- | ------------------------------------- | ----------------- |\n| card_type         | The card issuer for the provided card | String            |\n| valid             | Are the card details valid            | Boolean           |\n| luhn_valid        | Is the card number valid              | Boolean           |\n| length_valid      | If the card number length is valid    | Boolean           |\n| cvv_length        | If the CVV/CAVV length is valid       | Array [ Integer ] |\n| gaps              | Gaps for UI as printed in cards       | Array [ Integer ] |\n| supported_lengths | Supported lengths for the card type   | Array [ Integer ] |\n| max_length        | Maximum length for the card type      | Integer           |\n\n\n### Validations\nTo simply validate a card, call:\n`card.validateCard();`\nThe result will be a validity boolean.\n\nFor validating expiry date,\n`card.validateExpiry('12/2018');`\n\nAdditionally, the base date can be set for expiry validations. The base month and date can be provided by using,\n`card.setBaseDate(month, year);`\n\neg: `card.setBaseDate('02', '2016');`\n\nFor validating CVV, use:\n`card.validateCvv(111);`\nCVV will be validated based on the brand of the card.\n\n## License\n\nMIT license. Copyright © 2024 - [afzalimdad9](https://afzalimdad9.vercel.app).\n\n","readmeFilename":"README.md"}