@arms/rum-core 0.0.25-beta.14 → 0.0.25-beta.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -14,4 +14,4 @@ export * from './utils/is';
14
14
  export * from './utils/number';
15
15
  export * from './utils/match';
16
16
  export * from './utils/trace';
17
- export { Client, Context, Reporter, Shell };
17
+ export { Client, Context, Reporter, Shell };
@@ -0,0 +1,73 @@
1
+ function _createForOfIteratorHelperLoose(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (it) return (it = it.call(o)).next.bind(it); if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; return function () { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
2
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
3
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
4
+ import { EventType } from '../types/client';
5
+ import { EventEmitter } from 'events';
6
+ import Context from './context';
7
+ import { isFunction } from "../utils/is";
8
+ var Client = /*#__PURE__*/function () {
9
+ function Client() {
10
+ var _this = this;
11
+ this.emitter = new EventEmitter();
12
+ this.collectors = void 0;
13
+ this.processors = void 0;
14
+ this.reporter = void 0;
15
+ this.ctx = void 0;
16
+ this.sendEvent = function (payload) {
17
+ _this.emitter.emit(EventType.collect, payload);
18
+ };
19
+ }
20
+ var _proto = Client.prototype;
21
+ _proto.init = function init(config, rumSession) {
22
+ var _this2 = this;
23
+ this.ctx = new Context(config, rumSession);
24
+ var ctx = this.ctx,
25
+ collectors = this.collectors,
26
+ processors = this.processors,
27
+ reporter = this.reporter;
28
+ processors.forEach(function (processor) {
29
+ isFunction(processor.setup) && processor.setup(ctx);
30
+ });
31
+
32
+ // collector 收集数据统一 push 到各匹配 processor
33
+ this.emitter.on(EventType.collect, function (payload) {
34
+ ctx.setRumEvent(payload);
35
+ for (var _iterator = _createForOfIteratorHelperLoose(processors), _step; !(_step = _iterator()).done;) {
36
+ var processor = _step.value;
37
+ // default match return true
38
+ if (!processor.match) {
39
+ processor.match = function () {
40
+ return true;
41
+ };
42
+ }
43
+ if (processor.match(ctx)) {
44
+ var res = processor.process(ctx);
45
+ if (res) {
46
+ ctx.setRumEvent(res);
47
+ }
48
+ }
49
+ }
50
+ reporter.report(ctx);
51
+ });
52
+ collectors.forEach(function (collector) {
53
+ collector.setup(ctx, _this2.sendEvent);
54
+ });
55
+ };
56
+ _proto.setContext = function setContext(ctx) {
57
+ this.ctx = ctx;
58
+ };
59
+ _proto.getContext = function getContext() {
60
+ return this.ctx;
61
+ };
62
+ _proto.useCollectors = function useCollectors(collectors) {
63
+ this.collectors = collectors;
64
+ };
65
+ _proto.useProcessors = function useProcessors(processors) {
66
+ this.processors = processors;
67
+ };
68
+ _proto.useReporter = function useReporter(reporter) {
69
+ this.reporter = reporter;
70
+ };
71
+ return Client;
72
+ }();
73
+ export default Client;
@@ -0,0 +1,38 @@
1
+ var Context = /*#__PURE__*/function () {
2
+ function Context(config, rumSession) {
3
+ this.config = config;
4
+ this.rumEvent = void 0;
5
+ this.views = [];
6
+ this.session = void 0;
7
+ if (rumSession) {
8
+ this.session = rumSession;
9
+ this.session.init(config);
10
+ }
11
+ }
12
+ var _proto = Context.prototype;
13
+ _proto.getConfig = function getConfig() {
14
+ return this.config;
15
+ };
16
+ _proto.setConfig = function setConfig(config) {
17
+ this.config = config;
18
+ };
19
+ _proto.getViews = function getViews() {
20
+ return this.views;
21
+ };
22
+ _proto.addView = function addView(view) {
23
+ this.views.push(view);
24
+ };
25
+ _proto.removeView = function removeView(viewId) {
26
+ this.views = this.views.filter(function (view) {
27
+ return view.id !== viewId;
28
+ });
29
+ };
30
+ _proto.getRumEvent = function getRumEvent() {
31
+ return this.rumEvent;
32
+ };
33
+ _proto.setRumEvent = function setRumEvent(rumEvent) {
34
+ this.rumEvent = rumEvent;
35
+ };
36
+ return Context;
37
+ }();
38
+ export default Context;
@@ -0,0 +1,131 @@
1
+ import { RumEventType } from '../types/rum-event';
2
+ import { getErrorID } from '../utils/exception';
3
+ import { isObject } from "../utils/is";
4
+ var FLUSH_TIME = 3000;
5
+ var MAX_EVENT_COUNT = 20;
6
+ var Reporter = /*#__PURE__*/function () {
7
+ function Reporter() {
8
+ this.name = 'reporter';
9
+ /**
10
+ * 新上报事件优先检测队列是否超过 50 条,如果超过立即 report。
11
+ * 如果没超过则检测 FlushTime 内有无新上报事件,如果有新事件,重置 timer,无则 report
12
+ */
13
+ this.eventQueue = [];
14
+ this.ctx = void 0;
15
+ this.timer = void 0;
16
+ }
17
+ var _proto = Reporter.prototype;
18
+ _proto.getReportCfg = function getReportCfg() {
19
+ var cfg = this.ctx.getConfig().reportConfig;
20
+ if (!isObject(cfg)) {
21
+ cfg = {};
22
+ }
23
+ if (!cfg.flushTime || cfg.flushTime < 0 || cfg.flushTime > 10000) {
24
+ cfg.flushTime = FLUSH_TIME;
25
+ }
26
+ if (!cfg.maxEventCount || cfg.maxEventCount < 1 || cfg.maxEventCount > 100) {
27
+ cfg.maxEventCount = MAX_EVENT_COUNT;
28
+ }
29
+ return cfg;
30
+ };
31
+ _proto.report = function report(ctx) {
32
+ var _this = this;
33
+ this.ctx = ctx;
34
+ this.init(ctx);
35
+ clearTimeout(this.timer);
36
+ this.pushToQueue();
37
+ var reportConfig = this.getReportCfg();
38
+ // 超过 MaxCount 直接 flush,否则延迟发送
39
+ if (this.eventQueue.length >= reportConfig.maxEventCount) {
40
+ this.flushEventQueue();
41
+ } else {
42
+ this.timer = setTimeout(function () {
43
+ _this.flushEventQueue();
44
+ }, reportConfig.flushTime);
45
+ }
46
+ };
47
+ _proto.pushToQueue = function pushToQueue() {
48
+ var ctx = this.ctx,
49
+ eventQueue = this.eventQueue;
50
+ var event = ctx.getRumEvent();
51
+
52
+ // 针对相同 event,做 times 合并
53
+ // todo,支持其他类型 event 合并
54
+ if (event.event_type === RumEventType.EXCEPTION) {
55
+ var _ref = event,
56
+ message = _ref.message,
57
+ stack = _ref.stack;
58
+ var curErrorId = getErrorID({
59
+ message: message,
60
+ stack: stack
61
+ });
62
+ var targetEvent = this.eventQueue.find(function (cacheEvent) {
63
+ if (cacheEvent.event_type === RumEventType.EXCEPTION) {
64
+ var _ref2 = cacheEvent,
65
+ _message = _ref2.message,
66
+ _stack = _ref2.stack;
67
+ return getErrorID({
68
+ message: _message,
69
+ stack: _stack
70
+ }) === curErrorId;
71
+ }
72
+ });
73
+ if (targetEvent) {
74
+ targetEvent.times++;
75
+ return;
76
+ }
77
+ }
78
+ if (event.event_type === RumEventType.ACTION) {
79
+ var _ref3 = event,
80
+ target_name = _ref3.target_name;
81
+ var _targetEvent = this.eventQueue.find(function (cacheEvent) {
82
+ if (cacheEvent.event_type === RumEventType.ACTION) {
83
+ return target_name === cacheEvent.target_name;
84
+ }
85
+ });
86
+ if (_targetEvent) {
87
+ _targetEvent.times++;
88
+ return;
89
+ }
90
+ }
91
+ eventQueue.push(event);
92
+ }
93
+
94
+ /**
95
+ * eventQueue 提取最新 View 作为公共 View,event 中不同 View Event 保留 View id
96
+ */;
97
+ _proto.flushEventQueue = function flushEventQueue() {
98
+ var ctx = this.ctx,
99
+ eventQueue = this.eventQueue;
100
+ if (!eventQueue.length) {
101
+ return;
102
+ }
103
+ var views = ctx.getViews();
104
+ var curView = views[views.length - 1];
105
+ views.forEach(function (view) {
106
+ if (view.id === curView.id) {
107
+ var _events = eventQueue.filter(function (event) {
108
+ var _event$view;
109
+ return ((_event$view = event.view) === null || _event$view === void 0 ? void 0 : _event$view.id) === view.id;
110
+ });
111
+ _events.forEach(function (event) {
112
+ delete event.view;
113
+ });
114
+ }
115
+ });
116
+ var session = ctx.session;
117
+ var sampled = session ? session.getSampled() : true;
118
+ sampled && this.request(ctx, eventQueue, curView);
119
+ this.eventQueue = [];
120
+ }
121
+
122
+ /**
123
+ * 接口请求由各平台 sdk reporter 实现
124
+ */;
125
+ /**
126
+ * 初始化时
127
+ */
128
+ _proto.init = function init(ctx) {};
129
+ return Reporter;
130
+ }();
131
+ export { Reporter as default };
@@ -0,0 +1,80 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ import { RumEventType } from "../types/rum-event";
3
+ import Client from '../model/client';
4
+ import { isNumber } from "../utils/is";
5
+ var Shell = /*#__PURE__*/function () {
6
+ function Shell(config) {
7
+ this.client = void 0;
8
+ this.client = new Client();
9
+ if (config && this.init) {
10
+ this.init(config);
11
+ }
12
+ }
13
+
14
+ /**
15
+ * 初始化
16
+ */
17
+ var _proto = Shell.prototype;
18
+ _proto.sendEvent = function sendEvent(payload) {
19
+ if (this.client) {
20
+ this.client.sendEvent(payload);
21
+ }
22
+ }
23
+
24
+ /**
25
+ * get config
26
+ */;
27
+ _proto.getConfig = function getConfig() {
28
+ if (this.client) {
29
+ return this.client.getContext().getConfig();
30
+ }
31
+ }
32
+
33
+ /**
34
+ * set config
35
+ */;
36
+ /**
37
+ * 自定义事件上报
38
+ */
39
+ _proto.sendCustom = function sendCustom(payload) {
40
+ if (!payload.name || !payload.type) {
41
+ return;
42
+ }
43
+ var data = _extends({}, payload, {
44
+ event_type: RumEventType.CUSTOM
45
+ });
46
+ this.sendEvent(data);
47
+ };
48
+ /**
49
+ * 自定义异常上报
50
+ */
51
+ _proto.sendException = function sendException(payload) {
52
+ if (!payload.name || !payload.message) {
53
+ return;
54
+ }
55
+ var data = _extends({
56
+ times: 1
57
+ }, payload, {
58
+ event_type: RumEventType.EXCEPTION,
59
+ type: 'custom',
60
+ source: 'custom'
61
+ });
62
+ this.sendEvent(data);
63
+ };
64
+ /**
65
+ * 自定义资源上报
66
+ */
67
+ _proto.sendResource = function sendResource(payload) {
68
+ if (!payload.name || !payload.type || !isNumber(payload.duration)) {
69
+ return;
70
+ }
71
+ var data = _extends({
72
+ times: 1
73
+ }, payload, {
74
+ event_type: RumEventType.RESOURCE
75
+ });
76
+ this.sendEvent(data);
77
+ };
78
+ return Shell;
79
+ }();
80
+ export { Shell as default };
package/es/style.js ADDED
@@ -0,0 +1 @@
1
+ //empty file
@@ -0,0 +1,4 @@
1
+ export var EventType = /*#__PURE__*/function (EventType) {
2
+ EventType["collect"] = "collect";
3
+ return EventType;
4
+ }({});
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,24 @@
1
+ export var RumEventType = /*#__PURE__*/function (RumEventType) {
2
+ RumEventType["VIEW"] = "view";
3
+ RumEventType["RESOURCE"] = "resource";
4
+ RumEventType["EXCEPTION"] = "exception";
5
+ RumEventType["LONG_TASK"] = "longtask";
6
+ RumEventType["ACTION"] = "action";
7
+ RumEventType["CUSTOM"] = "custom";
8
+ return RumEventType;
9
+ }({});
10
+ /**
11
+ * 枚举值,表示资源是否加载成功
12
+ */
13
+ export var ResourceStatus = /*#__PURE__*/function (ResourceStatus) {
14
+ ResourceStatus[ResourceStatus["Unknown"] = -1] = "Unknown";
15
+ ResourceStatus[ResourceStatus["Failed"] = 0] = "Failed";
16
+ ResourceStatus[ResourceStatus["Success"] = 1] = "Success";
17
+ return ResourceStatus;
18
+ }({});
19
+ export var AppType = /*#__PURE__*/function (AppType) {
20
+ AppType["browser"] = "browser";
21
+ AppType["miniapp"] = "miniapp";
22
+ AppType["uniapp"] = "uniapp";
23
+ return AppType;
24
+ }({});
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,131 @@
1
+ import { isFunction } from "./is";
2
+
3
+ /**
4
+ * 劫持函数
5
+ */
6
+ export function interceptFunction(target, name, callback) {
7
+ var registeredMethod = target[name];
8
+ target[name] = function () {
9
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
10
+ args[_key] = arguments[_key];
11
+ }
12
+ callback.apply(this, args);
13
+ if (registeredMethod) {
14
+ return registeredMethod.apply(this, args);
15
+ }
16
+ };
17
+ }
18
+
19
+ /**
20
+ * @description: GUID v4
21
+ * @return {String}
22
+ */
23
+ export function generateGUID() {
24
+ var guid = '';
25
+ try {
26
+ if (crypto && crypto.randomUUID) {
27
+ guid = crypto.randomUUID();
28
+ } else if (crypto && crypto.getRandomValues) {
29
+ var buf = new Uint8Array(16);
30
+ crypto.getRandomValues(buf);
31
+ buf[6] = buf[6] & 0x0f | 0x40; // version 4 UUID
32
+ buf[8] = buf[8] & 0x3f | 0x80; // variant 10xxxxxx
33
+ guid = buf.reduce(function (str, _byte) {
34
+ return str + _byte.toString(16).padStart(2, '0');
35
+ }, '').replace(/^(.{8})(.{4})(.{4})(.{4})(.{12})$/, '\$1-\$2-\$3-\$4-\$5');
36
+ }
37
+ } catch (e) {
38
+ //
39
+ }
40
+ if (!guid) {
41
+ guid = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
42
+ var r = Math.random() * 16 | 0,
43
+ v = c == 'x' ? r : r & 0x3 | 0x8;
44
+ return v.toString(16);
45
+ });
46
+ }
47
+ return guid;
48
+ }
49
+
50
+ /**
51
+ * @description: 随机生成 traceId 或 sessionId
52
+ * @return {String}
53
+ */
54
+ export function generateTraceId() {
55
+ var traceId = generateGUID().replace(/-/g, '');
56
+ // 适配OpenTracing 实现(long long转成16进制最高位不能为0)
57
+ if (traceId[0] === '0') {
58
+ traceId = '1' + traceId.substring(1);
59
+ }
60
+ if (traceId[16] === '0') {
61
+ traceId = traceId.substring(0, 16) + '1' + traceId.substring(17);
62
+ }
63
+ return traceId;
64
+ }
65
+
66
+ /**
67
+ * @description: 随机生成 spanId
68
+ * @param len {number}
69
+ * @param radix {number}
70
+ * @return {String}
71
+ */
72
+ export function generateSpanId(len, radix) {
73
+ if (len === void 0) {
74
+ len = 16;
75
+ }
76
+ if (radix === void 0) {
77
+ radix = 16;
78
+ }
79
+ var result = '';
80
+ for (var i = 0; i < len; i++) {
81
+ result += Math.floor(Math.random() * radix).toString(radix);
82
+ }
83
+ return result;
84
+ }
85
+
86
+ /**
87
+ * @description: 随机生成 eventId
88
+ * @param sessionId {string} sessionId
89
+ * @return {String}
90
+ */
91
+ export function generateEventId(sessionId) {
92
+ var spanId = generateSpanId();
93
+ return "00-" + sessionId + "-" + spanId;
94
+ }
95
+
96
+ /**
97
+ * @desc 函数防抖
98
+ * @param func 回调函数
99
+ * @param wait 延迟执行毫秒数
100
+ */
101
+ export function debounce(func, wait) {
102
+ var timer;
103
+ if (!isFunction(func)) {
104
+ return;
105
+ }
106
+ return function () {
107
+ var context = this;
108
+ var args = arguments;
109
+ if (timer) {
110
+ clearTimeout(timer);
111
+ }
112
+ timer = setTimeout(function () {
113
+ func.apply(context, args);
114
+ }, wait);
115
+ };
116
+ }
117
+
118
+ /**
119
+ * @desc 函数延迟执行
120
+ * @param func 回调函数
121
+ * @param wait 延迟执行毫秒数
122
+ */
123
+ export function delay(func, wait) {
124
+ if (!isFunction(func)) {
125
+ return;
126
+ }
127
+ for (var _len2 = arguments.length, args = new Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
128
+ args[_key2 - 2] = arguments[_key2];
129
+ }
130
+ return setTimeout.apply(void 0, [func, +wait || 0].concat(args));
131
+ }
@@ -0,0 +1,10 @@
1
+ /**
2
+ * 获取错误对象唯一标识
3
+ */
4
+ export var getErrorID = function getErrorID(error) {
5
+ var _error$message = error.message,
6
+ message = _error$message === void 0 ? '' : _error$message,
7
+ _error$stack = error.stack,
8
+ stack = _error$stack === void 0 ? '' : _error$stack;
9
+ return message + stack;
10
+ };
package/es/utils/is.js ADDED
@@ -0,0 +1,33 @@
1
+ export function isTypeof(value, type) {
2
+ return typeof value === type;
3
+ }
4
+ export var isFunction = function isFunction(func) {
5
+ return typeof func === 'function';
6
+ };
7
+ export var isUndefined = function isUndefined(value) {
8
+ return isTypeof(value, 'undefined');
9
+ };
10
+ export var isString = function isString(value) {
11
+ return isTypeof(value, 'string');
12
+ };
13
+ export function isToString(value, type) {
14
+ return Object.prototype.toString.call(value) === "[object " + type + "]";
15
+ }
16
+ export var isArray = function isArray(value) {
17
+ return isToString(value, 'Array');
18
+ };
19
+ export var isRegExp = function isRegExp(value) {
20
+ return isToString(value, 'RegExp');
21
+ };
22
+ export var isBoolean = function isBoolean(value) {
23
+ return isTypeof(value, 'boolean');
24
+ };
25
+ export var isNumber = function isNumber(value) {
26
+ return isTypeof(value, 'number') && !isNaN(value) || isTypeof(value, 'bigint');
27
+ };
28
+ export var isNull = function isNull(value) {
29
+ return isTypeof(value, 'null');
30
+ };
31
+ export var isObject = function isObject(value) {
32
+ return !isNull(value) && isTypeof(value, 'object');
33
+ };
@@ -0,0 +1,37 @@
1
+ import { isFunction, isRegExp, isString } from "./is";
2
+ import { startsWith } from "./polyfills";
3
+ export function isMatchOption(item) {
4
+ return isString(item) || isFunction(item) || isRegExp(item);
5
+ }
6
+
7
+ /**
8
+ * 如果值有一个选项匹配,则返回true。在比较字符串时,useStartsWith: true时将把值与选项的开始进行比较,而不是要求精确匹配。
9
+ */
10
+ export function matchList(list, value, useStartsWith) {
11
+ if (useStartsWith === void 0) {
12
+ useStartsWith = true;
13
+ }
14
+ return list.some(function (item) {
15
+ try {
16
+ if (typeof item === 'function') {
17
+ return item(value);
18
+ } else if (item instanceof RegExp) {
19
+ return item.test(value);
20
+ } else if (typeof item === 'string') {
21
+ return useStartsWith ? startsWith(value, item) : item === value;
22
+ }
23
+ } catch (e) {}
24
+ return false;
25
+ });
26
+ }
27
+ export function urlMatch(url, list) {
28
+ if (list === void 0) {
29
+ list = [];
30
+ }
31
+ try {
32
+ var rules = [/https?:\/\/.*rum|retcode\.aliyuncs\.com/, /https?:\/\/.*log-global\.aliyuncs\.com/, /https?:\/\/.*\.mmstat\.com/].concat(list);
33
+ return matchList(rules, url);
34
+ } catch (e) {
35
+ return false;
36
+ }
37
+ }
@@ -0,0 +1,40 @@
1
+ export var ONE_SECOND = 1e3;
2
+ export var ONE_MINUTE = 60 * ONE_SECOND;
3
+ export var ONE_HOUR = 60 * ONE_MINUTE;
4
+ export var ONE_DAY = 24 * ONE_HOUR;
5
+
6
+ /**
7
+ * Return true if the draw is successful
8
+ * @param threshold between 0 and 100
9
+ */
10
+ export function performDraw(threshold) {
11
+ return threshold !== 0 && Math.random() * 100 <= threshold;
12
+ }
13
+
14
+ /**
15
+ * 保留指定位数的小数
16
+ * @param num 原数据
17
+ * @param decimal 小数位数
18
+ * @param min 限制最小值,否则返回undefined
19
+ * @returns
20
+ */
21
+ export function formatNumber(num, decimal, min) {
22
+ if (decimal === void 0) {
23
+ decimal = 3;
24
+ }
25
+ if (min === void 0) {
26
+ min = 0;
27
+ }
28
+ if (!num) {
29
+ return num;
30
+ }
31
+ var str = num.toString();
32
+ var index = str.indexOf('.');
33
+ if (index !== -1) {
34
+ str = str.substring(0, decimal + index + 1);
35
+ } else {
36
+ str = str.substring(0);
37
+ }
38
+ var result = parseFloat(str);
39
+ return result >= min ? result : undefined;
40
+ }
@@ -0,0 +1,28 @@
1
+ export function find(array, predicate) {
2
+ for (var i = 0; i < array.length; i += 1) {
3
+ var item = array[i];
4
+ if (predicate(item, i)) {
5
+ return item;
6
+ }
7
+ }
8
+ return undefined;
9
+ }
10
+ export function startsWith(candidate, search) {
11
+ return candidate.slice(0, search.length) === search;
12
+ }
13
+ export function endsWith(candidate, search) {
14
+ return candidate.slice(-search.length) === search;
15
+ }
16
+ export function assign(target) {
17
+ for (var _len = arguments.length, toAssign = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
18
+ toAssign[_key - 1] = arguments[_key];
19
+ }
20
+ toAssign.forEach(function (source) {
21
+ for (var _key2 in source) {
22
+ if (Object.prototype.hasOwnProperty.call(source, _key2)) {
23
+ target[_key2] = source[_key2];
24
+ }
25
+ }
26
+ });
27
+ return target;
28
+ }