|
15 | 15 | - [URI strings](#uri-strings)
|
16 | 16 | - [Email address strings](#email-address-strings)
|
17 | 17 | - [JWT Strings](#jwt-strings)
|
| 18 | + - [Credit Card Numbers](#credit-card-numbers) |
18 | 19 | - [Other formats](#other-formats)
|
19 | 20 | - [Object Formats](#object-formats)
|
20 | 21 | - [Firestore Timestamps](#firestore-timestamps)
|
21 |
| -- [Roadmap](#roadmap) |
22 | 22 |
|
23 | 23 | ## 🚀 Features
|
24 | 24 |
|
@@ -266,6 +266,38 @@ Will result in
|
266 | 266 | }
|
267 | 267 | ```
|
268 | 268 |
|
| 269 | +### Credit Card Numbers |
| 270 | + |
| 271 | +Strings that contain valid credit card numbers will be inferred with the `creditcard` format: |
| 272 | + |
| 273 | +```javascript |
| 274 | +inferType("4485428259658366"); |
| 275 | +``` |
| 276 | + |
| 277 | +Will result in |
| 278 | + |
| 279 | +```json |
| 280 | +{ |
| 281 | + "name": "string", |
| 282 | + "value": "4485428259658366", |
| 283 | + "format": { |
| 284 | + "name": "creditcard", |
| 285 | + "variant": "visa" |
| 286 | + } |
| 287 | +} |
| 288 | +``` |
| 289 | + |
| 290 | +The following table illustrates the results of different credit card number strings |
| 291 | + |
| 292 | +| String | Variant | |
| 293 | +| ----------------------- | ---------- | |
| 294 | +| `"4485 4282 5965 8366"` | visa | |
| 295 | +| `"4485428259658366"` | visa | |
| 296 | +| `"375092442988287"` | amex | |
| 297 | +| `"6011150635208157"` | discover | |
| 298 | +| `"5291160983813402"` | mastercard | |
| 299 | +| `"38223928053796"` | dinersclub | |
| 300 | + |
269 | 301 | ### Other formats
|
270 | 302 |
|
271 | 303 | The following table illustrates the rest of the formats JSON Infer Types supports
|
@@ -295,7 +327,6 @@ The following table illustrates the rest of the formats JSON Infer Types support
|
295 | 327 | | `'{ "foo": 1 }'` | json | ecma262 |
|
296 | 328 | | `'{ foo: 1, }'` | json | json5 |
|
297 | 329 | | `"/foo/bar"`, `"/foo/-/bar"` | jsonPointer | rfc6901 |
|
298 |
| -| `"0/foo/bar"`, `"2/0/baz/1/zip"` | jsonPointer | relative | |
299 | 330 | | `"😄"`, `"🤪👨🏽🚀"`, `"👩👩👧👧"` | emoji | |
|
300 | 331 | | `"1.11.0"`, `"0.0.1"`, `"1.0.0-alpha.1"` | semver | |
|
301 | 332 | | `"#ff0000"`, `"#D47DB9"` | color | hex |
|
@@ -333,9 +364,3 @@ Inferring this object will result in the following inferred type:
|
333 | 364 | ```
|
334 | 365 |
|
335 | 366 | Please feel free to request additional formats by opening a [Github issue](https://github.com/jsonhero-io/json-infer-types/issues)
|
336 |
| - |
337 |
| -## Roadmap |
338 |
| - |
339 |
| -- Infer credit card numbers |
340 |
| -- Infer credit card types |
341 |
| -- Infer mac addresses |
|
0 commit comments