isbn

Creates an ISBN validation action.

const Action = v.isbn<TInput, TMessage>(message);

Generics

Parameters

  • message TMessage

Explanation

With isbn you can validate the formatting of a string. If the input is not an ISBN, you can use message to customize the error message.

This action supports both ISBN-10 and ISBN-13 formats and accepts hyphens and spaces as separators.

Returns

Examples

The following examples show how isbn can be used.

ISBN schema

Schema to validate an ISBN.

const IsbnSchema = v.pipe(v.string(), v.isbn('The ISBN is badly formatted'));

// Valid ISBN-10 formats:
// '0-306-40615-2'
// '0306406152'
// '0 306 40615 2'

// Valid ISBN-13 formats:
// '978-0-306-40615-7'
// '9780306406157'
// '978 0 306 40615 7'

The following APIs can be combined with isbn.

Schemas

Methods

Utils

Contributors

Thanks to all the contributors who helped make this page better!

  • GitHub profile picture of @ysknsid25
  • GitHub profile picture of @fabian-hiller

Partners

Thanks to our partners who support the project ideally and financially.

Sponsors

Thanks to our GitHub sponsors who support the project financially.

  • GitHub profile picture of @antfu
  • GitHub profile picture of @vasilii-kovalev
  • GitHub profile picture of @saturnonearth
  • GitHub profile picture of @ruiaraujo012
  • GitHub profile picture of @hyunbinseo
  • GitHub profile picture of @nickytonline
  • GitHub profile picture of @KubaJastrz
  • GitHub profile picture of @andrewmd5
  • GitHub profile picture of @Thanaen
  • GitHub profile picture of @caegdeveloper
  • GitHub profile picture of @bmoyroud
  • GitHub profile picture of @dslatkin