1 | "use strict";
|
2 | var __importDefault = (this && this.__importDefault) || function (mod) {
|
3 | return (mod && mod.__esModule) ? mod : { "default": mod };
|
4 | };
|
5 | Object.defineProperty(exports, "__esModule", { value: true });
|
6 | exports.IsIdentityCard = exports.isIdentityCard = exports.IS_IDENTITY_CARD = void 0;
|
7 | const ValidateBy_1 = require("../common/ValidateBy");
|
8 | const isIdentityCard_1 = __importDefault(require("validator/lib/isIdentityCard"));
|
9 | exports.IS_IDENTITY_CARD = 'isIdentityCard';
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 | function isIdentityCard(value, locale) {
|
17 | return typeof value === 'string' && (0, isIdentityCard_1.default)(value, locale);
|
18 | }
|
19 | exports.isIdentityCard = isIdentityCard;
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 | function IsIdentityCard(locale, validationOptions) {
|
27 | return (0, ValidateBy_1.ValidateBy)({
|
28 | name: exports.IS_IDENTITY_CARD,
|
29 | constraints: [locale],
|
30 | validator: {
|
31 | validate: (value, args) => isIdentityCard(value, args.constraints[0]),
|
32 | defaultMessage: (0, ValidateBy_1.buildMessage)(eachPrefix => eachPrefix + '$property must be a identity card number', validationOptions),
|
33 | },
|
34 | }, validationOptions);
|
35 | }
|
36 | exports.IsIdentityCard = IsIdentityCard;
|
37 |
|
\ | No newline at end of file |