{"action":"created","issue":{"url":"https://api.github.com/repos/Marak/faker.js/issues/258","labels_url":"https://api.github.com/repos/Marak/faker.js/issues/258/labels{/name}","comments_url":"https://api.github.com/repos/Marak/faker.js/issues/258/comments","events_url":"https://api.github.com/repos/Marak/faker.js/issues/258/events","html_url":"https://github.com/Marak/faker.js/pull/258","id":97238127,"number":258,"title":"feat(creditcard): Add credit card generator","user":{"login":"Mardaneus86","id":7780108,"avatar_url":"https://avatars.githubusercontent.com/u/7780108?v=3","gravatar_id":"","url":"https://api.github.com/users/Mardaneus86","html_url":"https://github.com/Mardaneus86","followers_url":"https://api.github.com/users/Mardaneus86/followers","following_url":"https://api.github.com/users/Mardaneus86/following{/other_user}","gists_url":"https://api.github.com/users/Mardaneus86/gists{/gist_id}","starred_url":"https://api.github.com/users/Mardaneus86/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Mardaneus86/subscriptions","organizations_url":"https://api.github.com/users/Mardaneus86/orgs","repos_url":"https://api.github.com/users/Mardaneus86/repos","events_url":"https://api.github.com/users/Mardaneus86/events{/privacy}","received_events_url":"https://api.github.com/users/Mardaneus86/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2015-07-25T16:43:28Z","updated_at":"2015-08-18T12:32:24Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/Marak/faker.js/pulls/258","html_url":"https://github.com/Marak/faker.js/pull/258","diff_url":"https://github.com/Marak/faker.js/pull/258.diff","patch_url":"https://github.com/Marak/faker.js/pull/258.patch"},"body":"_One of my first PR's, so please be gentle :sweat_smile:_\r\n\r\nAdded generator for credit cards by the following issuers: Visa, Mastercard, American Express and Discover for issue #169.\r\n\r\nThis isn't a perfect implementation, so there is certainly room for improvement. There is still some code duplication but with the added set of unit tests, this can be refactored in an easy way.\r\n\r\nFor lengths and first digits, I used http://www.freeformatter.com/credit-card-number-generator-validator.html as a reference.\r\nBased on the provided Gist in the issue, I had the first digits of Discover cards fixed to \"6011\". Other formats are possible in real life (as stated in the code comments).\r\n\r\nSorry to @thebergamo to grab this before you, but I was already working on it for a different project. Please add your comments to this one, or let's compare our solutions!\r\n\r\nPS: I had some trouble running the unit tests, I'll look into the issue list later if this has already been reported.\r\n\r\n**Usage:**\r\n```javascript\r\nvar card = faker.finance.creditcard();\r\n// or\r\nvar visa = faker.finance.creditcard(\"visa\");\r\n// or\r\nvar mastercard = faker.finance.creditcard(\"mastercard\");\r\n// or\r\nvar americanExpress = faker.finance.creditcard(\"americanexpress\");\r\n// or\r\nvar discover = faker.finance.creditcard(\"discover\");\r\n```\r\n\r\nThis returns an object with the keys \"issuer\" and \"number\". Most faker.js API functions return a string in a specific format, but since the issuer and number are so closely related it looked like a good candidate to return an object."},"comment":{"url":"https://api.github.com/repos/Marak/faker.js/issues/comments/132193258","html_url":"https://github.com/Marak/faker.js/pull/258#issuecomment-132193258","issue_url":"https://api.github.com/repos/Marak/faker.js/issues/258","id":132193258,"user":{"login":"Marak","id":70011,"avatar_url":"https://avatars.githubusercontent.com/u/70011?v=3","gravatar_id":"","url":"https://api.github.com/users/Marak","html_url":"https://github.com/Marak","followers_url":"https://api.github.com/users/Marak/followers","following_url":"https://api.github.com/users/Marak/following{/other_user}","gists_url":"https://api.github.com/users/Marak/gists{/gist_id}","starred_url":"https://api.github.com/users/Marak/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Marak/subscriptions","organizations_url":"https://api.github.com/users/Marak/orgs","repos_url":"https://api.github.com/users/Marak/repos","events_url":"https://api.github.com/users/Marak/events{/privacy}","received_events_url":"https://api.github.com/users/Marak/received_events","type":"User","site_admin":false},"created_at":"2015-08-18T12:32:24Z","updated_at":"2015-08-18T12:32:24Z","body":"@Mardaneus86 - Any status on this?"}}