Added
- feat:
ssn rule - Validates U.S. Social Security Numbers (SSN), ensuring the format XXX-XX-XXXX where each "X" is a digit
const v = new Validator({a: 'ssn'});
v.check({a: '987-65-4321'}); /* true */
v.check({a: '123-45-678'}); /* false */
- feat:
ulid rule - Validates ULIDs (Universally Unique Lexicographically Sortable Identifiers), ensuring a 26-character uppercase alphanumeric format.
const v = new Validator({ a: 'ulid' });
v.check({ a: '01ARZ3NDEKTSV4RRFFQ69G5FAV' }); // true
v.check({ a: '01ARZ3NDEKTSV4RRFFQ69G5FA' }); // false (too short)
- feat:
uuid rule - Validates general UUIDs, supporting versions 1 through 5
const v = new Validator({ a: 'uuid' });
v.check({ a: '550e8400-e29b-11d4-a716-446655440000' }); // true
v.check({ a: 'bla' }); // false
v.check({ a: '550e8400-e29b-61d4-a716-446655440000' }); // false, version 6 does not exist
- feat:
uuid_v1 rule to verify that a provided value is a correctly formatted UUID V1
- feat:
uuid_v2 rule to verify that a provided value is a correctly formatted UUID V2
- feat:
uuid_v3 rule to verify that a provided value is a correctly formatted UUID V3
- feat:
uuid_v4 rule to verify that a provided value is a correctly formatted UUID V4
- feat:
uuid_v5 rule to verify that a provided value is a correctly formatted UUID V5
const v = new Validator({a: 'uuid'});
v.check({a: '550e8400-e29b-11d4-a716-446655440000'}); /* true */
v.check({a: 'bla'}); /* false */
v.check({a: '550e8400-e29b-61d4-a716-446655440000'}); /* false, v6 does not exist */
- feat:
isbn rule - Validates International Standard Book Numbers (ISBNs), supporting both ISBN-10 and ISBN-13 formats.
const v = new Validator({ a: 'isbn' });
v.check({ a: '123456789X' }); // true (ISBN-10)
v.check({ a: '9781234567897' }); // true (ISBN-13)
v.check({ a: '1234567890' }); // true (ISBN-10)
v.check({ a: '1234567890123' }); // false (invalid ISBN)
- feat:
isbn_10 rule to verify that a provided value is a correctly formatted 10 character ISBN
- feat:
isbn_13 rule to verify that a provided value is a correctly formatted 13 character ISBN
- feat:
ean rule - Validates European Article Numbers (EANs), supporting both 8-character (EAN-8) and 13-character (EAN-13) formats.
const v = new Validator({ a: 'ean' });
v.check({ a: '12345670' }); // true (EAN-8)
v.check({ a: '1234567890128' }); // true (EAN-13)
v.check({ a: '1234567' }); // false (too short for EAN-8)
- feat:
ean_8 rule to verify that a provided value is a correctly formatted 8 character EAN
- feat:
ean_13 rule to verify that a provided value is a correctly formatted 13 character EAN
Improved
- dx:
color_hex rule now works with a branded ColorHex type as typeguard instead of string
- dx:
email rule now works with a branded Email type as typeguard instead of string
- dx:
guid rule now works with a branded Guid type as typeguard instead of string
- dx:
phone rule now works with a branded Phone type as typeguard instead of string
- dx:
sys_ipv4 rule now works with a branded IP_V4 type as typeguard instead of string
- dx:
sys_ipv6 rule now works with a branded IP_V6 type as typeguard instead of string
- dx:
sys_ipv4_or_v6 rule now works with a branded IP type as typeguard instead of string
- dx:
sys_mac rule now works with a branded MAC type as typeguard instead of string
- deps: Upgrade @valkyriestudios/utils to 12.27.1
- deps: Upgrade @types/node to 22.8.7
- deps: Upgrade eslint to 9.14.0
- deps: Upgrade typescript to 5.6.3
- deps: Upgrade typescript-eslint to 8.12.2