Skip to report

Credit card validation reuses Valibot’s Luhn check

Follow Valibot’s creditCard validation, which checks seven provider formats and the Luhn checksum through the helper IMEI validation already used.

open-circle/valibot #292 · PR by ariskemper · Merged

open-circle/valibot a46941a5..d2654763

base and head as given

  • Credit card validation joined the library’s validation catalog.
  • Credit card validation now depends on the shared Luhn checker.
files changed
11
in a component
4
lines in components
78
components
3
public routes changed
0
schema statements
0
new dependencies
0
excluded by role
7
Based on 4 of 4 eligible changed files

Credit card validation

Added
Before
Credit card validation did not exist
After
Cards pass provider and Luhn checks

Applications can validate credit card numbers with provider-format checks and a Luhn checksum. Spaces and hyphens are accepted before validation.

In favour

  • In favour: Rejects Luhn-valid numbers outside listed card provider formats

Against

  • Against: Mastercard pattern alternation is not anchored consistently
Files changed in 3 components. Dependencies shown: 2 new
new · 21 component added

2 new dependencies between components — Validations → Credit Card Validations · Credit Card Validations → Is Luhn Algo

What else could behave differently

3 components · 5 files

These components import changed code, directly or through other files. A traced dependency is a place to review, not a confirmed runtime failure. Some paths stopped at heavily imported files; inspect those consumers separately.

Reached 2

ComponentSymbolCited atFilesReached by
Credit Card Validationslibrary/src/validations/creditCard/Body changed library/src/utils/isLuhnAlgo/isLuhnAlgo.ts:13-3121 direct · 1 at two steps
Trace path

Shortest component path from the changed symbol:

  1. Is Luhn Algo
  2. Credit Card Validations

Later steps follow file imports; they do not prove this symbol is called.

library/src/validations/imei/Body changed library/src/utils/isLuhnAlgo/isLuhnAlgo.ts:13-3121 direct · 1 at two steps
Trace path

Shortest component path from the changed symbol:

  1. Is Luhn Algo
  2. library/src/validations/imei/

Later steps follow file imports; they do not prove this symbol is called.

Held back 1

ComponentFilesReached byResolution
library/src/validations/1none direct · 1 at three stepsprecise

Not traced past a hub 1

SymbolHub fileImported by
library/src/utils/isLuhnAlgo/isLuhnAlgo.ts:isLuhnAlgolibrary/src/validations/index.ts38

Statements 2

A body change to isLuhnAlgo reached 2 credit card validation files; 1 of 2 names in its file changed. 11
library/src/utils/isLuhnAlgo/isLuhnAlgo.ts:13-31
A body change to isLuhnAlgo reached 2 IMEI validation files; 1 of 2 names in its file changed. 11
library/src/utils/isLuhnAlgo/isLuhnAlgo.ts:13-31

3 reached files belong to no component — tests, docs and config.

Routes, schema, dependencies

No public URL, no migration and no new package.

Not stated

  • 42 import edges resolve to more than one file. A reach that passes through one is held back rather than claimed, and said so where it is listed.

Inspect components, files and symbols

Component

ValidationsModified
library/src/validations/

1 file · 1 line

1 dependent

Is Luhn AlgoModified
library/src/utils/isLuhnAlgo/

1 file · 2 lines

3 dependents

Credit Card ValidationsAdded
library/src/validations/creditCard/

2 files · 75 lines

1 dependent

The credit card validation surface added CreditCardValidation and creditCard.

File

Validationslibrary/src/validations/
library/src/validations/index.ts

+1 −0

Is Luhn Algolibrary/src/utils/isLuhnAlgo/
library/src/utils/isLuhnAlgo/isLuhnAlgo.ts

+1 −1

Credit Card Validationslibrary/src/validations/creditCard/
library/src/validations/creditCard/creditCard.ts

+74 −0

Credit Card Validationslibrary/src/validations/creditCard/
library/src/validations/creditCard/index.ts

+1 −0

Function

imports what changeddownstream of it, one mark per step

Diff

Validationslibrary/src/validations/
library/src/validations/index.ts

3–3

Is Luhn Algolibrary/src/utils/isLuhnAlgo/
library/src/utils/isLuhnAlgo/isLuhnAlgo.ts

15–15

Credit Card Validationslibrary/src/validations/creditCard/
library/src/validations/creditCard/creditCard.ts

1–74

Credit Card Validationslibrary/src/validations/creditCard/
library/src/validations/creditCard/index.ts

1–1

Analysis scope

878 → 3
  1. 878
    files at head
  2. 135
    components
  3. 3
    changed by this change

Where the new files landed

2 new files
New fileBelongs toUsed byCallsServes
library/src/validations/creditCard/2 new files
Credit Card Validationsnew territory
Validations
library/src/types/library/src/utils/

2 added files carry no component — 1 docs, 1 test.

3components changed
1reached, not changed
1components added/removed
6dependencies added between components
0dependencies removed between components
0files moved to another path

11 files changed, 8 claims stated. 3 components reached in total.

naming: “model

narrative: “model

analyzer 0.2.0, config v1.9.0-phase8

Every line above is derived from a46941a5..d2654763 and nothing else.