Comments (1)
func isMaestro(c *Card, ccDigits digits) bool {
return matchesValue(ccDigits.At(4), []int{5018, 5020, 5038, 5612, 5893, 6304, 6759, 6761, 6762, 6763, 6390}) ||
c.Number[:3] == "0604"
}
This example uses the card validator library from npm. And as we can see the card number 6799998900000200010
gets maestro
as the card brand.
'use strict'
const valid = require("card-validator")
const numberValidation = valid.number("6799998900000200010")
if (!numberValidation.isPotentiallyValid) {
console.error("error")
}
if (numberValidation.card) {
console.log(numberValidation.card.type) // 'maestro'
}
card-validator
uses credit-card-type to validate the card brands. And as we can see in src/lib/card-types.ts line 104
maestro: {
niceType: "Maestro",
type: "maestro",
patterns: [
493698,
[500000, 504174],
[504176, 506698],
[506779, 508999],
[56, 59],
63,
67,
6,
],
gaps: [4, 8, 12],
lengths: [12, 13, 14, 15, 16, 17, 18, 19],
code: {
name: "CVC",
size: 3,
},
} as BuiltInCreditCardType,
Maestro uses more numbers as a pattern to check the brand.
patterns: [
493698,
[500000, 504174],
[504176, 506698],
[506779, 508999],
[56, 59],
63,
67,
6,
],
When in Go we only use these
5018, 5020, 5038, 5612, 5893, 6304, 6759, 6761, 6762, 6763, 6390 and 0604
from go-credit-card.
Related Issues (6)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from go-credit-card.