1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | exports.IsInt = exports.isInt = exports.IS_INT = void 0;
|
4 | const ValidateBy_1 = require("../common/ValidateBy");
|
5 | exports.IS_INT = 'isInt';
|
6 |
|
7 |
|
8 |
|
9 | function isInt(val) {
|
10 | return typeof val === 'number' && Number.isInteger(val);
|
11 | }
|
12 | exports.isInt = isInt;
|
13 |
|
14 |
|
15 |
|
16 | function IsInt(validationOptions) {
|
17 | return (0, ValidateBy_1.ValidateBy)({
|
18 | name: exports.IS_INT,
|
19 | validator: {
|
20 | validate: (value, args) => isInt(value),
|
21 | defaultMessage: (0, ValidateBy_1.buildMessage)(eachPrefix => eachPrefix + '$property must be an integer number', validationOptions),
|
22 | },
|
23 | }, validationOptions);
|
24 | }
|
25 | exports.IsInt = IsInt;
|
26 |
|
\ | No newline at end of file |