Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Audit check digit clue for itself #17

Open
maiconcarraro opened this issue Nov 28, 2024 · 0 comments
Open

Audit check digit clue for itself #17

maiconcarraro opened this issue Nov 28, 2024 · 0 comments

Comments

@maiconcarraro
Copy link

maiconcarraro commented Nov 28, 2024

You can use the existing ISBN from the demo that is 9781781682135, if you replace the last digit with a different number like 4, 9781781682134 it will get invalid and no clues. It would be nice to give a clue/hint similar to the invalid prefix.

image

Very similar to this:

isbn3/lib/audit.js

Lines 38 to 46 in 08d42be

const considerAltPrefix = (normalizedIsbn, altPrefix, clues) => {
const candidateBase = `${altPrefix}${normalizedIsbn.substring(3, 12)}`
const checkDigit = calculateCheckDigit(candidateBase)
const candidateData = parse(`${candidateBase}${checkDigit}`)
if (candidateData != null) {
const { isbn13h, isbn13, groupname } = candidateData
clues.push({ message: 'possible prefix error', candidate: isbn13h, isbn13, groupname })
}
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant