@arms/rum-core 0.0.2 → 0.0.4

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.
@@ -44,7 +44,9 @@ var Client = /*#__PURE__*/function () {
44
44
  ;
45
45
  if (processor.match(ctx)) {
46
46
  var res = processor.process(ctx);
47
- ctx.setRumEvent(res);
47
+ if (res) {
48
+ ctx.setRumEvent(res);
49
+ }
48
50
  }
49
51
  }
50
52
  reporter.report(ctx);
@@ -88,7 +88,7 @@ export interface IConfiguration {
88
88
  */
89
89
  endpoint: string;
90
90
  /**
91
- * repoter 发送事件之前
91
+ * reporter 发送事件之前
92
92
  */
93
93
  beforeReport?(bundle: RumEventBundle): any;
94
94
  /**
package/lib/utils/is.d.ts CHANGED
@@ -1,2 +1,8 @@
1
+ export type IsFnHelper<T = unknown> = (value: unknown) => value is T;
2
+ export declare function isTypeof<T = unknown>(value: unknown, type: string): value is T;
1
3
  export declare const isFunction: (func: any) => boolean;
2
- export declare const isArray: (arr: any) => boolean;
4
+ export declare const isUndefined: IsFnHelper<undefined>;
5
+ export declare const isString: IsFnHelper<string>;
6
+ export declare function isToString<T = unknown>(value: unknown, type: string): value is T;
7
+ export declare const isArray: IsFnHelper<unknown[]>;
8
+ export declare const isRegExp: IsFnHelper<string>;
package/lib/utils/is.js CHANGED
@@ -1,10 +1,28 @@
1
1
  "use strict";
2
2
 
3
3
  exports.__esModule = true;
4
- exports.isFunction = exports.isArray = void 0;
4
+ exports.isString = exports.isRegExp = exports.isFunction = exports.isArray = void 0;
5
+ exports.isToString = isToString;
6
+ exports.isTypeof = isTypeof;
7
+ exports.isUndefined = void 0;
8
+ function isTypeof(value, type) {
9
+ return typeof value === type;
10
+ }
5
11
  var isFunction = exports.isFunction = function isFunction(func) {
6
12
  return typeof func === 'function';
7
13
  };
8
- var isArray = exports.isArray = function isArray(arr) {
9
- return Array.isArray(arr);
14
+ var isUndefined = exports.isUndefined = function isUndefined(value) {
15
+ return isTypeof(value, 'undefined');
16
+ };
17
+ var isString = exports.isString = function isString(value) {
18
+ return isTypeof(value, 'string');
19
+ };
20
+ function isToString(value, type) {
21
+ return Object.prototype.toString.call(value) === "[object " + type + "]";
22
+ }
23
+ var isArray = exports.isArray = function isArray(value) {
24
+ return isToString(value, 'Array');
25
+ };
26
+ var isRegExp = exports.isRegExp = function isRegExp(value) {
27
+ return isToString(value, 'RegExp');
10
28
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arms/rum-core",
3
- "version": "0.0.2",
3
+ "version": "0.0.4",
4
4
  "description": "arms rum javascript sdk core",
5
5
  "author": "guangli.fj <guangli.fj@alibaba-inc.com>",
6
6
  "license": "ISC",