yieme / isbnjs

Automatically exported from code.google.com/p/isbnjs
4 stars 4 forks source link

Isbn13 9790230367080 does not convert to Isbn10 - it returns undefined #4

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
I tried your library and then hit this problem.

This Isbn13 is in Amazon

Original issue reported on code.google.com by anas...@gmail.com on 30 Oct 2014 at 7:06

GitBruno commented 7 years ago

There is no equivalent for that ISBN-13. Because of an expected shortage in certain ISBN categories, the International Organization for Standardization (ISO) decided to migrate to a thirteen-digit ISBN (ISBN-13). This pool is bigger. You would only ever need to 'upgrade' an ISBN-10 to the new ISBN-13 format. Why do you want to create an ISBN-10?

maschyth commented 6 years ago

9790230367080 is NOT an ISBN-13

It's an ISMN or International Standard Music Number. ISBNs are for "books". As of 9/11/18, the only 979 prefixes released are 979-10, 979-11, and 979-12.

And to reiterate what GitBruno said, 979 numbers cannot be converted to ISBN-10. Because ALL ISBN-10 numbers are 978s without the prefix and corrected check digit.

That being said, 9790230367080 returns 'undefined' because 979-0 is not defined in the data as a group prefix. You could add that yourself if you know the correct ranges.

GitBruno commented 6 years ago

The ISBN-13 is not within the range issued by the agency. Adding this yourself would be pointless. Returning undefined is completely valid.

As @maschyth has outlined the ISBN-13 is in the ISMN range and therefore not a valid ISBN.

Therefore, I think we can close this issue?

maschyth commented 6 years ago

It’s all about the data. If the OP were to add ISMN ranges to the dataset, then the code would validate those as well.

https://www.ismn-international.org/ranges.html

But as we both stated, 979 numbers can’t be converted to 10 digits.

GitBruno commented 6 years ago

No need to add the data, just do this 👍

function forceValidate( ISBN ) { 
    return true; 
};
maschyth commented 6 years ago

“The red zone has always been for loading and unloading of passengers. There's never stopping in a white zone.”

Listen Bruno, don’t start up with your white zone shit again. :)