Giter Site home page Giter Site logo

beautify-isbn's Introduction

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

beautify-isbn's People

Contributors

zarnihpyoe avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.