UNPKG

@valkyriestudios/validator

Version:

A lightweight configurable javascript validator

17 lines (16 loc) 519 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.vISBN10 = vISBN10; exports.vISBN13 = vISBN13; exports.vISBN = vISBN; const ISBN_10_RGX = /^(?:\d{9}X|\d{10})$/; const ISBN_13_RGX = /^(?:\d{13})$/; function vISBN10(val) { return typeof val === 'string' && ISBN_10_RGX.test(val); } function vISBN13(val) { return typeof val === 'string' && ISBN_13_RGX.test(val); } function vISBN(val) { return typeof val === 'string' && (ISBN_10_RGX.test(val) || ISBN_13_RGX.test(val)); }