UNPKG

780 BJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3/**
4 * Function that returns a new decorator that applies all decorators provided by param
5 *
6 * Useful to build new decorators (or a decorator factory) encapsulating multiple decorators related with the same feature
7 *
8 * @param decorators one or more decorators (e.g., `ApplyGuard(...)`)
9 *
10 * @publicApi
11 */
12function applyDecorators(...decorators) {
13 return (target, propertyKey, descriptor) => {
14 for (const decorator of decorators) {
15 if (target instanceof Function && !descriptor) {
16 decorator(target);
17 continue;
18 }
19 decorator(target, propertyKey, descriptor);
20 }
21 };
22}
23exports.applyDecorators = applyDecorators;