Skip to content

Instantly share code, notes, and snippets.

@BroFox86
Last active May 28, 2024 18:32
Show Gist options
  • Save BroFox86/9297341dd4a955ae4be45b6c2ab3894e to your computer and use it in GitHub Desktop.
Save BroFox86/9297341dd4a955ae4be45b6c2ab3894e to your computer and use it in GitHub Desktop.
[Conditions for checking some CC cards] #forms
if (value.startsWith('34') || value.startsWith('37')) {
return 'americanExpress'
}
if (value.startsWith('62')) {
return 'chinaUnionPay'
}
if (value.startsWith('6011') || value.startsWith('65')) {
return 'DiscoverCard'
}
if (Number(value.slice(0, 3)) >= 644 && Number(value.slice(0, 3)) <= 649) {
return 'DiscoverCard'
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment