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