@shippack/isbn-verify
TypeScript icon, indicating that this package has built-in type declarations

1.5.1 • Public • Published

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().

Readme

Keywords

Package Sidebar

Install

npm i @shippack/isbn-verify

Weekly Downloads

29

Version

1.5.1

License

MIT

Unpacked Size

51.9 kB

Total Files

12

Last publish

Collaborators

  • douglaszaltron