@vuetkit/shared 0.0.2 → 0.0.3
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/README.md +10 -0
- package/dist/index.d.ts +15 -3
- package/dist/index.js +27 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -3,3 +3,13 @@
|
|
|
3
3
|
## Description
|
|
4
4
|
|
|
5
5
|
Collection of business development utilities for Vue3 projects.
|
|
6
|
+
|
|
7
|
+
## All Functions
|
|
8
|
+
|
|
9
|
+
### Data Type
|
|
10
|
+
|
|
11
|
+
- [getDataType](/shared/src/dataType/getDataType/)
|
|
12
|
+
- [isObj](/shared/src/dataType/isObj/)
|
|
13
|
+
- [realObj](/shared/src/dataType/realObj/)
|
|
14
|
+
- [isFunc](/shared/src/dataType/isFunc/)
|
|
15
|
+
- [isArr](/shared/src/dataType/isArr/)
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,16 @@
|
|
|
1
|
-
//#region src/
|
|
2
|
-
declare function
|
|
1
|
+
//#region src/dataType/getDataType/index.d.ts
|
|
2
|
+
declare function getDataType<T>(val: T): string;
|
|
3
3
|
//#endregion
|
|
4
|
-
|
|
4
|
+
//#region src/dataType/isArr/index.d.ts
|
|
5
|
+
declare function isArr<T>(val: T): boolean;
|
|
6
|
+
//#endregion
|
|
7
|
+
//#region src/dataType/isFunc/index.d.ts
|
|
8
|
+
declare function isFunc<T>(fn: T): boolean;
|
|
9
|
+
//#endregion
|
|
10
|
+
//#region src/dataType/isObj/index.d.ts
|
|
11
|
+
declare function isObj<T>(obj: T): boolean;
|
|
12
|
+
//#endregion
|
|
13
|
+
//#region src/dataType/realObj/index.d.ts
|
|
14
|
+
declare function realObj<T>(obj: T): boolean;
|
|
15
|
+
//#endregion
|
|
16
|
+
export { getDataType, isArr, isFunc, isObj, realObj };
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,29 @@
|
|
|
1
|
-
//#region src/
|
|
2
|
-
function
|
|
3
|
-
return
|
|
1
|
+
//#region src/dataType/isObj/index.ts
|
|
2
|
+
function isObj(obj) {
|
|
3
|
+
return typeof obj === "object" && obj !== null;
|
|
4
4
|
}
|
|
5
5
|
//#endregion
|
|
6
|
-
|
|
6
|
+
//#region src/dataType/getDataType/index.ts
|
|
7
|
+
function getDataType(val) {
|
|
8
|
+
if (val === null) return "null";
|
|
9
|
+
if (val === void 0) return "undefined";
|
|
10
|
+
if (!isObj(val)) return typeof val;
|
|
11
|
+
return Object.prototype.toString.call(val);
|
|
12
|
+
}
|
|
13
|
+
//#endregion
|
|
14
|
+
//#region src/dataType/isArr/index.ts
|
|
15
|
+
function isArr(val) {
|
|
16
|
+
return Array.isArray(val);
|
|
17
|
+
}
|
|
18
|
+
//#endregion
|
|
19
|
+
//#region src/dataType/isFunc/index.ts
|
|
20
|
+
function isFunc(fn) {
|
|
21
|
+
return typeof fn === "function";
|
|
22
|
+
}
|
|
23
|
+
//#endregion
|
|
24
|
+
//#region src/dataType/realObj/index.ts
|
|
25
|
+
function realObj(obj) {
|
|
26
|
+
return getDataType(obj) === "[object Object]";
|
|
27
|
+
}
|
|
28
|
+
//#endregion
|
|
29
|
+
export { getDataType, isArr, isFunc, isObj, realObj };
|