UNPKG

557 BJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3/**
4 * Decorator that binds *parameter decorators* to the method that follows.
5 *
6 * Useful when the language doesn't provide a 'Parameter Decorator' feature
7 * (i.e., vanilla JavaScript).
8 *
9 * @param decorators one or more parameter decorators (e.g., `Req()`)
10 *
11 * @publicApi
12 */
13function Bind(...decorators) {
14 return (target, key, descriptor) => {
15 decorators.forEach((fn, index) => fn(target, key, index));
16 return descriptor;
17 };
18}
19exports.Bind = Bind;