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.IsHexColor = exports.isHexColor = exports.IS_HEX_COLOR = void 0;
|
7 | const ValidateBy_1 = require("../common/ValidateBy");
|
8 | const isHexColor_1 = __importDefault(require("validator/lib/isHexColor"));
|
9 | exports.IS_HEX_COLOR = 'isHexColor';
|
10 |
|
11 |
|
12 |
|
13 |
|
14 | function isHexColor(value) {
|
15 | return typeof value === 'string' && (0, isHexColor_1.default)(value);
|
16 | }
|
17 | exports.isHexColor = isHexColor;
|
18 |
|
19 |
|
20 |
|
21 |
|
22 | function IsHexColor(validationOptions) {
|
23 | return (0, ValidateBy_1.ValidateBy)({
|
24 | name: exports.IS_HEX_COLOR,
|
25 | validator: {
|
26 | validate: (value, args) => isHexColor(value),
|
27 | defaultMessage: (0, ValidateBy_1.buildMessage)(eachPrefix => eachPrefix + '$property must be a hexadecimal color', validationOptions),
|
28 | },
|
29 | }, validationOptions);
|
30 | }
|
31 | exports.IsHexColor = IsHexColor;
|
32 |
|
\ | No newline at end of file |