@arms/rum-core 0.0.3 → 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.
- package/lib/model/client.js +3 -1
- package/lib/utils/is.d.ts +4 -0
- package/lib/utils/is.js +14 -1
- package/package.json +1 -1
package/lib/model/client.js
CHANGED
package/lib/utils/is.d.ts
CHANGED
|
@@ -2,3 +2,7 @@ export type IsFnHelper<T = unknown> = (value: unknown) => value is T;
|
|
|
2
2
|
export declare function isTypeof<T = unknown>(value: unknown, type: string): value is T;
|
|
3
3
|
export declare const isFunction: (func: any) => boolean;
|
|
4
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,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
exports.__esModule = true;
|
|
4
|
-
exports.isFunction = void 0;
|
|
4
|
+
exports.isString = exports.isRegExp = exports.isFunction = exports.isArray = void 0;
|
|
5
|
+
exports.isToString = isToString;
|
|
5
6
|
exports.isTypeof = isTypeof;
|
|
6
7
|
exports.isUndefined = void 0;
|
|
7
8
|
function isTypeof(value, type) {
|
|
@@ -12,4 +13,16 @@ var isFunction = exports.isFunction = function isFunction(func) {
|
|
|
12
13
|
};
|
|
13
14
|
var isUndefined = exports.isUndefined = function isUndefined(value) {
|
|
14
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');
|
|
15
28
|
};
|