identifiers

package
v0.0.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 26, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

pkg/identifiers/identifiers.go

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NormalizeISBN

func NormalizeISBN(value string) string

NormalizeISBN removes hyphens, spaces, and common prefixes from an ISBN.

func ValidateISBN10

func ValidateISBN10(isbn string) bool

ValidateISBN10 validates an ISBN-10 checksum. ISBN-10 uses modulo 11 with weights 10,9,8,7,6,5,4,3,2,1.

func ValidateISBN13

func ValidateISBN13(isbn string) bool

ValidateISBN13 validates an ISBN-13 checksum. ISBN-13 uses alternating weights of 1 and 3.

Types

type Type

type Type string

Type represents the type of identifier.

const (
	TypeISBN10    Type = "isbn_10"
	TypeISBN13    Type = "isbn_13"
	TypeASIN      Type = "asin"
	TypeUUID      Type = "uuid"
	TypeGoodreads Type = "goodreads"
	TypeGoogle    Type = "google"
	TypeOther     Type = "other"
	TypeUnknown   Type = ""
)

func DetectType

func DetectType(value, scheme string) Type

DetectType determines the identifier type from a value and optional scheme. If scheme is provided, it takes precedence. Otherwise, pattern matching is used.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL