1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | const constants_1 = require("../../constants");
|
4 | const extend_metadata_util_1 = require("../../utils/extend-metadata.util");
|
5 | const shared_utils_1 = require("../../utils/shared.utils");
|
6 | const validate_each_util_1 = require("../../utils/validate-each.util");
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 |
|
27 |
|
28 | function UsePipes(...pipes) {
|
29 | return (target, key, descriptor) => {
|
30 | const isPipeValid = (pipe) => pipe &&
|
31 | (shared_utils_1.isFunction(pipe) || shared_utils_1.isFunction(pipe.transform));
|
32 | if (descriptor) {
|
33 | extend_metadata_util_1.extendArrayMetadata(constants_1.PIPES_METADATA, pipes, descriptor.value);
|
34 | return descriptor;
|
35 | }
|
36 | validate_each_util_1.validateEach(target, pipes, isPipeValid, '@UsePipes', 'pipe');
|
37 | extend_metadata_util_1.extendArrayMetadata(constants_1.PIPES_METADATA, pipes, target);
|
38 | return target;
|
39 | };
|
40 | }
|
41 | exports.UsePipes = UsePipes;
|