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

Dosen't accept Certain valid isbn13 #5

Closed
haithem-rihane opened this issue Apr 11, 2014 · 1 comment
Closed

Dosen't accept Certain valid isbn13 #5

haithem-rihane opened this issue Apr 11, 2014 · 1 comment

Comments

@haithem-rihane
Copy link

Hi,

The validator can't parse certain Isbn13 such one i copied from amazon books detail
Here's an example:

var isbn13a = ISBN.parse('978-2212136029');
isbn13a.isIsbn13();  

console return TypeError: Cannot call method 'isIsbn13' of null

@KratosGemini
Copy link

There are two things going on here.

  1. The lone hyphen is causing it to not parse as a valid ISBN. It either needs to have no hyphens or have all the hyphens in the hyphenated ISBN format (in this case: 978-2-212-13602-9).
  2. The ISBN registration group identifier is 2 for this ISBN. The only groups included the isbn.js file are: 0, 1, and 4. There is a isbn-groups.js file in the project that contains a full list of groups. Including that file will solve the missing group problem. I don't know if you are using this in a browser, Node.js, or something else. I'm not a Node expert, but I think there will need to be a little bit of tweaking in order to use it in Node. Or maybe there is some easy way I'm missing.

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

2 participants