A small package to make ISBN human-readable
Using yarn
$ yarn add beautify-isbn
Or npm
$ npm install --save beautify-isbn
validate
- Check the validity of ISBNhyphenate
- Hyphenate ISBN so that human can read itdehyphenate
- Remove hyphens so that machine can read ittoIsbn13
- Convert ISBN 10 to ISBN 13
// using ES6+
import { validate, hyphenate, dehyphenate, toIsbn13 } from 'beautify-isbn'
const isbn13 = '9780753555200'
const isbn10 = '0306406152'
console.log(validate(isbn13)) // true
console.log(validate(isbn10)) // true
console.log(hyphenate(isbn13)) // 978-0-7535-5520-0
console.log(hyphenate(isbn10)) // 0-306-40615-2
const hyphenatedIsbn13 = '978-0-7535-5520-0'
const hyphenatedIsbn10 = '0-306-40615-2'
console.log(dehyphenate(hyphenatedIsbn13)) // 9780753555200
console.log(dehyphenate(hyphenatedIsbn10)) // 0306406152
console.log(toIsbn13(isbn10)) // 9780306406157