GithubHelp home page GithubHelp logo

isbn-verify's Introduction

ISBN Verify

npm version Build Status Coverage Status

Verify ISBN string format and check digit.

Demo

Examples

import IsbnVerify from '@saekitominaga/isbn-verify';

const isbnVerify = new IsbnVerify('978-4-06-519981-0');
isbnVerify.isValid(); // false
isbnVerify.isIsbn10(); // false
isbnVerify.isIsbn13(); // true
isbnVerify.isIsbn13({ check_digit: true }); // false
isbnVerify.verifyFormat(); // true
isbnVerify.verifyCheckDigit(); // false

Constructor

new IsbnVerify(isbn: string, strict = false)

Parameters

isbn
ISBN value to check
strict [Optional]
Strict mode. If `true`, syntax without hyphens is an error. If not specified, it defaults to `false`

Methods

isValid(): boolean
Alias of `verifyCheckDigit()`
isIsbn13(options?: isOption): boolean
Whether it is a 13-digit ISBN
isIsbn10(options?: isOption): boolean
Whether it is a 10-digit ISBN
verifyFormat(): boolean
Verify format (do not verify check digit)
verifyCheckDigit(): boolean
Verify format including check digit (not necessarily applicable publication)

Arguments of isIsbn13() and isIsbn10() method

interface isOption {
	check_digit?: boolean; // Verify format including check digit
}

* isIsbnXX({ check_digit: true }) has the same effect as isIsbnXX() && isValid().

isbn-verify's People

Contributors

douglaszaltron avatar saekitominaga avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Forkers

productdevbook

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.