UNPKG

1.88 kBJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3var tslib_1 = require("tslib");
4var ObjectUtils = /** @class */ (function () {
5 function ObjectUtils() {
6 }
7 /**
8 * Copy the values of all of the enumerable own properties from one or more source objects to a
9 * target object. Returns the target object.
10 * @param target The target object to copy to.
11 * @param sources One or more source objects from which to copy properties
12 */
13 ObjectUtils.assign = function (target) {
14 var sources = [];
15 for (var _i = 1; _i < arguments.length; _i++) {
16 sources[_i - 1] = arguments[_i];
17 }
18 var e_1, _a, e_2, _b;
19 try {
20 for (var sources_1 = tslib_1.__values(sources), sources_1_1 = sources_1.next(); !sources_1_1.done; sources_1_1 = sources_1.next()) {
21 var source = sources_1_1.value;
22 try {
23 for (var _c = tslib_1.__values(Object.getOwnPropertyNames(source)), _d = _c.next(); !_d.done; _d = _c.next()) {
24 var prop = _d.value;
25 target[prop] = source[prop];
26 }
27 }
28 catch (e_2_1) { e_2 = { error: e_2_1 }; }
29 finally {
30 try {
31 if (_d && !_d.done && (_b = _c.return)) _b.call(_c);
32 }
33 finally { if (e_2) throw e_2.error; }
34 }
35 }
36 }
37 catch (e_1_1) { e_1 = { error: e_1_1 }; }
38 finally {
39 try {
40 if (sources_1_1 && !sources_1_1.done && (_a = sources_1.return)) _a.call(sources_1);
41 }
42 finally { if (e_1) throw e_1.error; }
43 }
44 };
45 return ObjectUtils;
46}());
47exports.ObjectUtils = ObjectUtils;
48
49//# sourceMappingURL=ObjectUtils.js.map