https://github.com/avram/identifiers-js
JavaScript parsing of various useful identifiers
https://github.com/avram/identifiers-js
Last synced: about 15 hours ago
JSON representation
JavaScript parsing of various useful identifiers
- Host: GitHub
- URL: https://github.com/avram/identifiers-js
- Owner: avram
- Created: 2011-08-01T09:31:40.000Z (almost 15 years ago)
- Default Branch: master
- Last Pushed: 2011-11-05T18:05:37.000Z (over 14 years ago)
- Last Synced: 2025-10-19T06:53:47.786Z (9 months ago)
- Language: JavaScript
- Homepage:
- Size: 97.7 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README
Awesome Lists containing this project
README
JavaScript parsing of various identifiers
Based on ISBN Users' Manual (http://www.isbn.org/standards/home/isbn/international/html/usm4.htm)
and the Wikipedia treatment of ISBN (http://en.wikipedia.org/wiki/International_Standard_Book_Number)
and the Wikipedia treatment of ISSN (http://en.wikipedia.org/wiki/International_Standard_Serial_Number)
and the Wikipedia treatment of SICI (http://en.wikipedia.org/wiki/Serial_Item_and_Contribution_Identifier)
This will also check ISMN validity, although it does not distinguish from their
neighbors in namespace, ISBN-13. It does not handle pre-2008 M-prefixed ISMNs;
see http://en.wikipedia.org/wiki/International_Standard_Music_Number
This does not validate multiple identifiers in one field,
but it will gracefully ignore all non-number detritus,
such as extraneous hyphens, spaces, and comments.
It currently maintains hyphens in non-initial and non-final position,
discarding consecutive ones beyond the first as well.
It also adds the customary hyphen to valid ISSNs.
Takes the first 8 valid digits and tries to read an ISSN,
takes the first 10 valid digits and tries to read an ISBN 10 or a UPC,
and takes the first 13 valid digits to try to read an ISBN 13 or an EAN.
It also tries to parse the input as an SICI; if found, it will populate the
SICI attribute with the proper SICI and the ISSN with the constituent ISSN.
A later version will return the other metadata encoded by SICI as well.
Returns an object with six attributes:
"issn"
"isbn10"
"isbn13"
"upc"
"ean"
"sici"
Each will be set to a valid identifier if found, and otherwise be a
boolean false.
The UPC logic is for a 10-digit UPC-A; the newer EAN system is equivalent
to the isbn13 algorithm.
There could conceivably be a valid ISBN-13 with an ISBN-10
substring; this should probably be interpreted as the latter, but it is a
client UI issue.