Skip to content
This repository has been archived by the owner on Jan 28, 2023. It is now read-only.

tadas-s/isbnjs

This branch is 60 commits ahead of, 4 commits behind coolaj86/isbnjs:master.

Folders and files

NameName
Last commit message
Last commit date

Latest commit

0b42bc4 · Jan 21, 2021

History

87 Commits
Apr 4, 2015
Mar 14, 2016
Mar 11, 2016
Mar 9, 2016
Apr 4, 2015
Apr 4, 2015
Jul 5, 2016
Jul 5, 2016
Jul 5, 2016
Apr 4, 2015
Jan 20, 2021
Jan 20, 2021
Jan 20, 2021

Repository files navigation

Build Status

isbn2

An ISBN JavaScript Library.

Please note that this is a fork of isbn package which was forked from the original isbnjs project on Google Code.

npm install isbn2

Test Suite

To run the lint/test suite use:

npm run test

Update Groups

To get the latest ISBN groups from [isbn-international.org], use:

npm run get-groups

Results will be saved as a JavaScript object in a groups.js file that can used to update the isbn.js

Examples

var ISBN = require('isbn2').ISBN;

var isbn10a = ISBN.parse('4873113369');
isbn10a.isIsbn10();                       // true
isbn10a.isIsbn13();                       // false
isbn10a.asIsbn10();                       // 4873113369
isbn10a.asIsbn10(true);                   // 4-87311-336-9
isbn10a.asIsbn13();                       // 9784873113364
isbn10a.asIsbn13(true);                   // 978-4-87311-336-4

var isbn10b = ISBN.parse('1-933988-03-7');
isbn10b.isIsbn10();                       // true

var isbn13a = ISBN.parse('978-4-87311-336-4');
isbn13a.isIsbn13();                       // true

var isbn13b = ISBN.parse('9781590597279');
isbn13b.isIsbn13();                       // true

var foo = ISBN.parse('invalid format');   // null
ISBN.asIsbn13('4-87311-336-9');           // 9784873113364
ISBN.asIsbn10('978-4-87311-336-4', true); // 4-87311-336-9
ISBN.hyphenate('9784873113364');          // 978-4-87311-336-4
isbn13a.codes.source;                     // 978-4-87311-336-4
isbn13a.codes.prefix;                     // 978
isbn13a.codes.group;                      // 4
isbn13a.codes.publisher;                  // 87311
isbn13a.codes.article;                    // 336
isbn13a.codes.check;                      // 4
isbn13a.codes.check10;                    // 9
isbn13a.codes.check13;                    // 4
isbn13a.codes.groupname;                  // Japan

About

An ISBN JavaScript Library

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 97.4%
  • HTML 2.6%