1 | ;
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | var assign = require("lodash/assign");
|
4 | /**
|
5 | * Mixins an object into the classes prototype.
|
6 | * @export
|
7 | * @param {...Object[]} srcs
|
8 | * @returns {ClassDecorator}
|
9 | * @example
|
10 | *
|
11 | * const myMixin = {
|
12 | * blorg: () => 'blorg!'
|
13 | * }
|
14 | *
|
15 | * @Mixin(myMixin)
|
16 | * class MyClass {}
|
17 | *
|
18 | * const myClass = new MyClass();
|
19 | *
|
20 | * myClass.blorg(); // => 'blorg!'
|
21 | */
|
22 | function Mixin() {
|
23 | var srcs = [];
|
24 | for (var _i = 0; _i < arguments.length; _i++) {
|
25 | srcs[_i] = arguments[_i];
|
26 | }
|
27 | return (function (target) {
|
28 | assign.apply(void 0, [target.prototype].concat(srcs));
|
29 | return target;
|
30 | });
|
31 | }
|
32 | exports.Mixin = Mixin;
|
33 | exports.mixin = Mixin;
|
34 | exports.default = Mixin;
|
35 | //# sourceMappingURL=mixin.js.map |
\ | No newline at end of file |