UNPKG

validatorshield

Version:

Universal validation (frontend + backend) with TypeScript. Includes common rules and Sequelize-backed async rules (unique, exists).

15 lines (14 loc) 339 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.regex = regex; function regex(value, _ctx, pattern, flags) { if (typeof value !== 'string') return false; try { const re = new RegExp(pattern, flags); return re.test(value); } catch { return false; } }