{"id":18938018,"url":"https://github.com/afzalimdad9/card-validator","last_synced_at":"2026-02-27T16:40:26.793Z","repository":{"id":254817783,"uuid":"847631615","full_name":"afzalimdad9/card-validator","owner":"afzalimdad9","description":"Card validation helpers for payment forms.","archived":false,"fork":false,"pushed_at":"2024-08-26T14:45:14.000Z","size":31,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-09-14T22:27:09.597Z","etag":null,"topics":["amex","card","card-validator","credit-card","mastercard","payments","rupay","visa"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/afzalimdad9.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-08-26T08:37:52.000Z","updated_at":"2025-01-20T09:10:13.000Z","dependencies_parsed_at":"2024-08-26T10:58:22.654Z","dependency_job_id":null,"html_url":"https://github.com/afzalimdad9/card-validator","commit_stats":null,"previous_names":["afzalimdad9/card-validator"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/afzalimdad9/card-validator","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/afzalimdad9%2Fcard-validator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/afzalimdad9%2Fcard-validator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/afzalimdad9%2Fcard-validator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/afzalimdad9%2Fcard-validator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/afzalimdad9","download_url":"https://codeload.github.com/afzalimdad9/card-validator/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/afzalimdad9%2Fcard-validator/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29905094,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-27T14:46:13.553Z","status":"ssl_error","status_checked_at":"2026-02-27T14:46:10.522Z","response_time":57,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["amex","card","card-validator","credit-card","mastercard","payments","rupay","visa"],"created_at":"2024-11-08T12:13:13.584Z","updated_at":"2026-02-27T16:40:26.779Z","avatar_url":"https://github.com/afzalimdad9.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"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{\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\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","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fafzalimdad9%2Fcard-validator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fafzalimdad9%2Fcard-validator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fafzalimdad9%2Fcard-validator/lists"}