Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Comments

feat(isLuhnValid): Expose isLuhnValid independently from isCreditCard#1974

Merged
rubiin merged 2 commits intovalidatorjs:masterfrom
ST-DDT:expose/luhnCheck
Jul 17, 2022
Merged

feat(isLuhnValid): Expose isLuhnValid independently from isCreditCard#1974
rubiin merged 2 commits intovalidatorjs:masterfrom
ST-DDT:expose/luhnCheck

Conversation

@ST-DDT
Copy link
Contributor

@ST-DDTST-DDT commentedMay 22, 2022
edited
Loading

Currently the luhn checking algorithm is only used inside isCreditCard, but the luhn algorithm is also used in/for other "numbers", so it would be nice if theisLuhnValid could be exposed independently.

is a simplechecksum formula used to validate a variety of identification numbers, such ascredit card numbers,IMEI numbers,National Provider Identifier numbers in the United States,CanadianSocial Insurance Numbers,Israeli ID Numbers,South African ID Numbers,SwedishNational identification numbers,Swedish Corporate Identity Numbers (OrgNr),Greek Social Security Numbers (ΑΜΚΑ), SIM card numbers and survey codes appearing onMcDonald's,Taco Bell, andTractor Supply Co. receipts.

Source:https://en.wikipedia.org/wiki/Luhn_algorithm

The code is copied from the existingisCreditCard check.

Checklist

  • PR contains only changes related; no stray files, etc.
  • README updated (where applicable)
  • Tests written (where applicable) -Tests fromisCreditCard apply, if any exist.

@codecov
Copy link

codecovbot commentedMay 22, 2022
edited
Loading

Codecov Report

Merging#1974 (4098467) intomaster (cfcf911) willnot change coverage.
The diff coverage is100.00%.

@@            Coverage Diff            @@##            master     #1974   +/-   ##=========================================  Coverage   100.00%   100.00%           =========================================  Files          103       104    +1       Lines         2097      2104    +7       Branches       473       473           =========================================+ Hits          2097      2104    +7
Impacted FilesCoverage Δ
src/index.js100.00% <100.00%> (ø)
src/lib/isCreditCard.js100.00% <100.00%> (ø)
src/lib/isLuhnValid.js100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend -Click here to learn more
Δ = absolute <relative> (impact),ø = not affected,? = missing data
Powered byCodecov. Last updatecfcf911...4098467. Read thecomment docs.

@WikiRik
Copy link
Member

isCreditCard is testing different aspects as well. Can you add special tests for isLuhnValid?

@ST-DDT
Copy link
ContributorAuthor

isCreditCard is testing different aspects as well. Can you add special tests for isLuhnValid?

Done

@rubiinrubiin merged commitc57ff39 intovalidatorjs:masterJul 17, 2022
@ST-DDTST-DDT deleted the expose/luhnCheck branchJuly 18, 2022 02:25
@profnandaa
Copy link
Member

Suggesting a rename toisLuhnNumber instead.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@rubiinrubiinrubiin approved these changes

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

4 participants

@ST-DDT@WikiRik@profnandaa@rubiin

[8]ページ先頭

©2009-2026 Movatter.jp