2.0.2 • Published 2 years ago

@saekitominaga/isbn-verify v2.0.2

Weekly downloads
50
License
MIT
Repository
github
Last release
2 years ago

Verify ISBN string format and check digit

npm version test status

Examples

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

const isbnVerify1 = new IsbnVerify('978-4-06-519981-0'); // ISBN with correct format but wrong check digit
isbnVerify1.isValid(); // false
isbnVerify1.isIsbn10(); // false
isbnVerify1.isIsbn10({ check_digit: true }); // false
isbnVerify1.isIsbn13(); // true
isbnVerify1.isIsbn13({ check_digit: true }); // false
isbnVerify1.verify(); // true
isbnVerify1.verify({ check_digit: true }); // false

const isbnVerify2 = new IsbnVerify('9784065199817');
isbnVerify2.isValid(); // true

const isbnVerify3 = new IsbnVerify('9784065199817', { strict: true });
isbnVerify3.isValid(); // false

Constructor

new IsbnVerify(isbn: string, options?: Option)

Parameters

Option

interface Option {
	strict?: boolean; // If `true`, syntax without hyphens is an error. If not specified, it defaults to `false`
}

Methods

Option

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

2 years ago

2.0.1

3 years ago

2.0.0

3 years ago

1.5.2

3 years ago

1.5.1

3 years ago

1.4.2

3 years ago

1.5.0

3 years ago

1.4.1

4 years ago

1.4.0

4 years ago

1.3.0

4 years ago

1.2.3

4 years ago

1.2.2

4 years ago

1.2.1

4 years ago

1.2.0

5 years ago

1.1.0

5 years ago

1.0.6

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago