2.2.0 • Published 8 years ago

beautify-isbn v2.2.0

Weekly downloads
25
License
MIT
Repository
github
Last release
8 years ago

beautify-isbn npm npm

A small package to make ISBN human-readable

Install

Using yarn

$ yarn add beautify-isbn

Or npm

$ npm install --save beautify-isbn

Features

  • validate - Check the validity of ISBN
  • hyphenate - Hyphenate ISBN so that human can read it
  • dehyphenate - Remove hyphens so that machine can read it
  • toIsbn13 - Convert ISBN 10 to ISBN 13

Usage

// 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

License

MIT

2.2.0

8 years ago

2.1.0

8 years ago

2.0.0

8 years ago

1.0.2

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago

0.3.1

8 years ago

0.3.0

8 years ago

0.2.3

8 years ago

0.2.2

8 years ago

0.2.1

8 years ago

0.2.0

8 years ago

0.1.2

8 years ago

0.1.1

8 years ago