UNPKG

valibot-schema-roman-numerals

Version:
8 lines 682 B
import {custom}from'valibot';var s=/^(M{1,4}(CM|CD|D?C{0,3})(XC|XL|L?X{0,3})(IX|IV|V?I{0,3})|M{0,4}(CM|C?D|D?C{1,3})(XC|XL|L?X{0,3})(IX|IV|V?I{0,3})|M{0,4}(CM|CD|D?C{0,3})(XC|X?L|L?X{1,3})(IX|IV|V?I{0,3})|M{0,4}(CM|CD|D?C{0,3})(XC|XL|L?X{0,3})(IX|I?V|V?I{1,3}))$/,r=e=>s.test(e),n=e=>typeof e=="string"&&r(e),o=e=>`Invalid type: Expected roman numeral received ${e.received}`,C=e=>custom(n,typeof e=="string"?()=>e:e||o);/** * Regular expression pattern for validating Roman numerals. * Ensures proper character combinations and repetition rules. * * Copyright (c) 2023 Jeremy Bunting * @license MIT * @see {@link https://github.com/qbunt/romans} */export{C as romanNumeral};