hsu-utils 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/hsu-utils.js +9 -9
- package/dist/hsu-utils.min.js +1 -1
- package/dist/hsu-utils.min.js.LICENSE.txt +1 -1
- package/es/ConsoleTable/index.d.ts +1 -1
- package/es/ConsoleTable/index.js +1 -1
- package/es/DeepCopy/index.d.ts +1 -1
- package/es/DeepCopy/index.js +2 -2
- package/es/Equal/index.d.ts +6 -0
- package/es/Equal/index.js +7 -1
- package/es/Typeof/index.d.ts +1 -1
- package/es/Typeof/index.js +1 -1
- package/es/index.d.ts +5 -5
- package/es/index.js +5 -5
- package/lib/ConsoleTable/index.d.ts +1 -1
- package/lib/ConsoleTable/index.js +1 -2
- package/lib/DeepCopy/index.d.ts +1 -1
- package/lib/DeepCopy/index.js +5 -6
- package/lib/Equal/index.d.ts +6 -0
- package/lib/Equal/index.js +8 -2
- package/lib/Typeof/index.d.ts +1 -1
- package/lib/Typeof/index.js +1 -2
- package/lib/index.d.ts +5 -5
- package/lib/index.js +12 -11
- package/package.json +1 -1
package/dist/hsu-utils.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
/*!
|
2
2
|
*
|
3
|
-
* hsu-utils v0.0.
|
3
|
+
* hsu-utils v0.0.3
|
4
4
|
*
|
5
5
|
* some front-end utils
|
6
6
|
*
|
@@ -55,7 +55,7 @@ return /******/ (() => { // webpackBootstrap
|
|
55
55
|
\*************************************/
|
56
56
|
/***/ ((__unused_webpack_module, exports) => {
|
57
57
|
|
58
|
-
eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\
|
58
|
+
eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nvar NODE = '+';\nvar EDGE = '-';\nvar HIGH = '|';\nvar SPACE = ' ';\nvar EMPTY = '';\nfunction get_string_width(str) {\n var width = 0;\n for (var _i = 0, str_1 = str; _i < str_1.length; _i++) {\n var char = str_1[_i];\n width += char.charCodeAt(0) < 128 && char.charCodeAt(0) >= 0 ? 1 : 2;\n }\n return width;\n}\nfunction get_egde(width) {\n var edge = '';\n for (var i = 0; i <= width; i++) {\n edge += EDGE;\n }\n return edge;\n}\nfunction get_edge(widths, no_line_break) {\n if (no_line_break === void 0) { no_line_break = false; }\n var col_num = widths.length;\n var border = '';\n widths.forEach(function (width, col) {\n border += NODE + get_egde(width + 1);\n if (col === col_num - 1) {\n border += NODE + (no_line_break ? EMPTY : '\\n');\n }\n else {\n border += EMPTY;\n }\n });\n return border;\n}\nfunction get_space(width) {\n var space = '';\n for (var i = 0; i <= width; i++) {\n space += SPACE;\n }\n return space;\n}\nfunction wirte_data(widths, data) {\n var col_num = widths.length;\n var content = '';\n widths.forEach(function (width, col) {\n var col_data = data[col];\n var _content = '';\n if (!isNaN(+col_data)) {\n _content += get_space(width - get_string_width(col_data.toString())) + col_data + SPACE;\n }\n else {\n _content += SPACE + (col_data !== null && col_data !== void 0 ? col_data : '') + get_space(width - get_string_width((col_data !== null && col_data !== void 0 ? col_data : '').toString()));\n }\n content += HIGH + _content;\n if (col === col_num - 1) {\n content += HIGH + '\\n';\n }\n else {\n content += EMPTY;\n }\n });\n return content;\n}\nfunction get_max_widths(data) {\n var max_widths = Object.keys(data[0]).map(function (v) { return +v; });\n for (var _i = 0, data_1 = data; _i < data_1.length; _i++) {\n var row_data = data_1[_i];\n row_data.forEach(function (col_data, idx) {\n var width = get_string_width(col_data.toString());\n max_widths[idx] = Math.max(width, max_widths[idx]);\n });\n }\n return max_widths;\n}\nfunction console_table(data, callBack) {\n var row_num = data.length;\n var max_widths = get_max_widths(data);\n var table = '';\n data.forEach(function (row_data, row) {\n if (row <= 1) {\n table += get_edge(max_widths);\n }\n table += wirte_data(max_widths, row_data);\n if (row === row_num - 1) {\n table += get_edge(max_widths, true);\n }\n });\n console.log(table);\n if (callBack) {\n callBack(table);\n }\n}\nexports[\"default\"] = console_table;\n\n\n//# sourceURL=webpack://hsu-utils/./tools/ConsoleTable/index.ts?");
|
59
59
|
|
60
60
|
/***/ }),
|
61
61
|
|
@@ -65,7 +65,7 @@ eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexpo
|
|
65
65
|
\*********************************/
|
66
66
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
67
67
|
|
68
|
-
eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\
|
68
|
+
eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nvar __1 = __webpack_require__(/*! .. */ \"./tools/index.ts\");\nfunction deepCopy(data) {\n if ((0, __1.Typeof)(data) === 'date') {\n return new Date(data.toISOString());\n }\n else if ((0, __1.Typeof)(data) === 'formdata') {\n var _data = data;\n var _formData_1 = new FormData();\n _data.forEach(function (value, key) {\n _formData_1.append(key, value);\n });\n return _formData_1;\n }\n else if (Array.isArray(data)) {\n var newData = data.map(function (item) {\n if (typeof item === 'object') {\n return deepCopy(item);\n }\n else {\n return item;\n }\n });\n return newData;\n }\n else if (data && (0, __1.Typeof)(data) === 'object') {\n var _data_1 = data;\n var newData_1 = {};\n Object.keys(_data_1).forEach(function (key) {\n var _item = _data_1[key];\n if (typeof _item === 'object') {\n newData_1[key] = deepCopy(_item);\n }\n else {\n newData_1[key] = _item;\n }\n });\n return newData_1;\n }\n return data;\n}\nexports[\"default\"] = deepCopy;\n\n\n//# sourceURL=webpack://hsu-utils/./tools/DeepCopy/index.ts?");
|
69
69
|
|
70
70
|
/***/ }),
|
71
71
|
|
@@ -75,7 +75,7 @@ eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexpo
|
|
75
75
|
\******************************/
|
76
76
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
77
77
|
|
78
|
-
eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.ObjEqual = exports.ValEqual = exports.TypeEqual = void 0;\nvar
|
78
|
+
eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.ObjEqual = exports.ValEqual = exports.TypeEqual = void 0;\nvar __1 = __webpack_require__(/*! .. */ \"./tools/index.ts\");\nfunction TypeEqual(obj1, obj2) {\n var isEqual = false;\n if ((0, __1.Typeof)(obj1) !== (0, __1.Typeof)(obj2)) {\n isEqual = false;\n }\n else {\n isEqual = true;\n }\n return isEqual;\n}\nexports.TypeEqual = TypeEqual;\nfunction ValEqual(obj1, obj2) {\n var isEqual = false;\n if ((obj1 === null && obj2 === undefined) || (obj1 === undefined && obj2 === null)) {\n isEqual = true;\n }\n else {\n if (typeof obj1 === 'object' && typeof obj2 === 'object') {\n isEqual = ObjEqual(obj1, obj2);\n }\n else if (typeof obj1 === 'function' && typeof obj2 === 'function') {\n isEqual = JSON.stringify(obj1) === JSON.stringify(obj2);\n }\n else {\n isEqual = obj1 === obj2;\n }\n }\n return isEqual;\n}\nexports.ValEqual = ValEqual;\nfunction ObjEqual(obj1, obj2) {\n var isEqual = false;\n if (obj1 !== null && obj2 !== null) {\n if (Array.isArray(obj1) && Array.isArray(obj2)) {\n obj1.sort();\n obj2.sort();\n if (obj1.length !== obj2.length) {\n isEqual = false;\n }\n else {\n for (var i = 0; i < obj1.length; i++) {\n isEqual = ValEqual(obj1[i], obj2[i]);\n if (!isEqual)\n break;\n }\n }\n }\n else if (typeof obj1 === 'object' && typeof obj2 === 'object') {\n if (Object.keys(obj1).length !== Object.keys(obj2).length) {\n isEqual = false;\n }\n else {\n for (var key in obj1) {\n isEqual = ValEqual(obj1[key], obj2[key]);\n if (!isEqual)\n break;\n }\n }\n }\n }\n else if (obj1 === null && obj2 === null) {\n isEqual = true;\n }\n return isEqual;\n}\nexports.ObjEqual = ObjEqual;\nvar Equal = {\n ValEqual: ValEqual,\n TypeEqual: TypeEqual,\n ObjEqual: ObjEqual\n};\nexports[\"default\"] = Equal;\n\n\n//# sourceURL=webpack://hsu-utils/./tools/Equal/index.ts?");
|
79
79
|
|
80
80
|
/***/ }),
|
81
81
|
|
@@ -85,7 +85,7 @@ eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexpo
|
|
85
85
|
\*******************************/
|
86
86
|
/***/ ((__unused_webpack_module, exports) => {
|
87
87
|
|
88
|
-
eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\
|
88
|
+
eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nfunction Typeof(value) {\n var object_type = Object.prototype.toString.call(value);\n var reg = new RegExp(' (.+?)]');\n var type = object_type.match(reg)[1];\n return type.toLowerCase();\n}\nexports[\"default\"] = Typeof;\n\n\n//# sourceURL=webpack://hsu-utils/./tools/Typeof/index.ts?");
|
89
89
|
|
90
90
|
/***/ }),
|
91
91
|
|
@@ -93,9 +93,9 @@ eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexpo
|
|
93
93
|
/*!************************!*\
|
94
94
|
!*** ./tools/index.ts ***!
|
95
95
|
\************************/
|
96
|
-
/***/ ((__unused_webpack_module, exports, __webpack_require__)
|
96
|
+
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
97
97
|
|
98
|
-
eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.Typeof = exports.
|
98
|
+
eval("\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.Typeof = exports.Equal = exports.deepCopy = exports.console_table = void 0;\nvar ConsoleTable_1 = __importDefault(__webpack_require__(/*! ./ConsoleTable */ \"./tools/ConsoleTable/index.ts\"));\nexports.console_table = ConsoleTable_1.default;\nvar DeepCopy_1 = __importDefault(__webpack_require__(/*! ./DeepCopy */ \"./tools/DeepCopy/index.ts\"));\nexports.deepCopy = DeepCopy_1.default;\nvar Equal_1 = __importDefault(__webpack_require__(/*! ./Equal */ \"./tools/Equal/index.ts\"));\nexports.Equal = Equal_1.default;\nvar Typeof_1 = __importDefault(__webpack_require__(/*! ./Typeof */ \"./tools/Typeof/index.ts\"));\nexports.Typeof = Typeof_1.default;\n\n\n//# sourceURL=webpack://hsu-utils/./tools/index.ts?");
|
99
99
|
|
100
100
|
/***/ })
|
101
101
|
|
@@ -119,7 +119,7 @@ eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexpo
|
|
119
119
|
/******/ };
|
120
120
|
/******/
|
121
121
|
/******/ // Execute the module function
|
122
|
-
/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
|
122
|
+
/******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
123
123
|
/******/
|
124
124
|
/******/ // Return the exports of the module
|
125
125
|
/******/ return module.exports;
|
@@ -129,7 +129,7 @@ eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexpo
|
|
129
129
|
/******/
|
130
130
|
/******/ // startup
|
131
131
|
/******/ // Load entry module and return exports
|
132
|
-
/******/ // This entry module
|
132
|
+
/******/ // This entry module is referenced by other modules so it can't be inlined
|
133
133
|
/******/ var __webpack_exports__ = __webpack_require__("./tools/index.ts");
|
134
134
|
/******/
|
135
135
|
/******/ return __webpack_exports__;
|
package/dist/hsu-utils.min.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1
1
|
/*! For license information please see hsu-utils.min.js.LICENSE.txt */
|
2
|
-
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["hsu-utils"]=t():e["hsu-utils"]=t()}(this,(()=>(()=>{"use strict";var e={442:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})
|
2
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["hsu-utils"]=t():e["hsu-utils"]=t()}(this,(()=>(()=>{"use strict";var e={442:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0});var r="+",o="-",n="|",u=" ",a="";function f(e){for(var t=0,r=0,o=e;r<o.length;r++){var n=o[r];t+=n.charCodeAt(0)<128&&n.charCodeAt(0)>=0?1:2}return t}function l(e,t){void 0===t&&(t=!1);var n=e.length,u="";return e.forEach((function(e,f){u+=r+function(e){for(var t="",r=0;r<=e;r++)t+=o;return t}(e+1),u+=f===n-1?r+(t?a:"\n"):a})),u}function i(e){for(var t="",r=0;r<=e;r++)t+=u;return t}t.default=function(e,t){var r=e.length,o=function(e){for(var t=Object.keys(e[0]).map((function(e){return+e})),r=0,o=e;r<o.length;r++)o[r].forEach((function(e,r){var o=f(e.toString());t[r]=Math.max(o,t[r])}));return t}(e),c="";e.forEach((function(e,t){t<=1&&(c+=l(o)),c+=function(e,t){var r=e.length,o="";return e.forEach((function(e,l){var c=t[l],p="";isNaN(+c)?p+=u+(null!=c?c:"")+i(e-f((null!=c?c:"").toString())):p+=i(e-f(c.toString()))+c+u,o+=n+p,o+=l===r-1?n+"\n":a})),o}(o,e),t===r-1&&(c+=l(o,!0))})),console.log(c),t&&t(c)}},819:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});var o=r(243);t.default=function e(t){if("date"===(0,o.Typeof)(t))return new Date(t.toISOString());if("formdata"===(0,o.Typeof)(t)){var r=t,n=new FormData;return r.forEach((function(e,t){n.append(t,e)})),n}if(Array.isArray(t))return t.map((function(t){return"object"==typeof t?e(t):t}));if(t&&"object"===(0,o.Typeof)(t)){var u=t,a={};return Object.keys(u).forEach((function(t){var r=u[t];a[t]="object"==typeof r?e(r):r})),a}return t}},962:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ObjEqual=t.ValEqual=t.TypeEqual=void 0;var o=r(243);function n(e,t){return(0,o.Typeof)(e)===(0,o.Typeof)(t)}function u(e,t){return null===e&&void 0===t||void 0===e&&null===t||("object"==typeof e&&"object"==typeof t?a(e,t):"function"==typeof e&&"function"==typeof t?JSON.stringify(e)===JSON.stringify(t):e===t)}function a(e,t){var r=!1;if(null!==e&&null!==t){if(Array.isArray(e)&&Array.isArray(t))if(e.sort(),t.sort(),e.length!==t.length)r=!1;else for(var o=0;o<e.length&&(r=u(e[o],t[o]));o++);else if("object"==typeof e&&"object"==typeof t)if(Object.keys(e).length!==Object.keys(t).length)r=!1;else for(var n in e)if(!(r=u(e[n],t[n])))break}else null===e&&null===t&&(r=!0);return r}t.TypeEqual=n,t.ValEqual=u,t.ObjEqual=a;var f={ValEqual:u,TypeEqual:n,ObjEqual:a};t.default=f},332:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){var t=Object.prototype.toString.call(e),r=new RegExp(" (.+?)]");return t.match(r)[1].toLowerCase()}},243:function(e,t,r){var o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.Typeof=t.Equal=t.deepCopy=t.console_table=void 0;var n=o(r(442));t.console_table=n.default;var u=o(r(819));t.deepCopy=u.default;var a=o(r(962));t.Equal=a.default;var f=o(r(332));t.Typeof=f.default}},t={};var r=function r(o){var n=t[o];if(void 0!==n)return n.exports;var u=t[o]={exports:{}};return e[o].call(u.exports,u,u.exports,r),u.exports}(243);return r})()));
|
@@ -1,2 +1,2 @@
|
|
1
1
|
export type ConsoleData = Array<Array<string | number>>;
|
2
|
-
export
|
2
|
+
export default function console_table(data: ConsoleData, callBack?: (str: string) => void): void;
|
package/es/ConsoleTable/index.js
CHANGED
@@ -70,7 +70,7 @@ function get_max_widths(data) {
|
|
70
70
|
}
|
71
71
|
return max_widths;
|
72
72
|
}
|
73
|
-
export function console_table(data, callBack) {
|
73
|
+
export default function console_table(data, callBack) {
|
74
74
|
const row_num = data.length;
|
75
75
|
const max_widths = get_max_widths(data);
|
76
76
|
let table = '';
|
package/es/DeepCopy/index.d.ts
CHANGED
@@ -1 +1 @@
|
|
1
|
-
export
|
1
|
+
export default function deepCopy<T = unknown>(data: T): T;
|
package/es/DeepCopy/index.js
CHANGED
package/es/Equal/index.d.ts
CHANGED
@@ -1,3 +1,9 @@
|
|
1
1
|
export declare function TypeEqual<T = unknown>(obj1: T, obj2: T): boolean;
|
2
2
|
export declare function ValEqual<T = unknown>(obj1: T, obj2: T): boolean;
|
3
3
|
export declare function ObjEqual<T = object>(obj1: T, obj2: T): boolean;
|
4
|
+
declare const Equal: {
|
5
|
+
ValEqual: typeof ValEqual;
|
6
|
+
TypeEqual: typeof TypeEqual;
|
7
|
+
ObjEqual: typeof ObjEqual;
|
8
|
+
};
|
9
|
+
export default Equal;
|
package/es/Equal/index.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import { Typeof } from '
|
1
|
+
import { Typeof } from '..';
|
2
2
|
export function TypeEqual(obj1, obj2) {
|
3
3
|
let isEqual = false;
|
4
4
|
if (Typeof(obj1) !== Typeof(obj2)) {
|
@@ -62,3 +62,9 @@ export function ObjEqual(obj1, obj2) {
|
|
62
62
|
}
|
63
63
|
return isEqual;
|
64
64
|
}
|
65
|
+
const Equal = {
|
66
|
+
ValEqual,
|
67
|
+
TypeEqual,
|
68
|
+
ObjEqual
|
69
|
+
};
|
70
|
+
export default Equal;
|
package/es/Typeof/index.d.ts
CHANGED
package/es/Typeof/index.js
CHANGED
package/es/index.d.ts
CHANGED
@@ -1,7 +1,7 @@
|
|
1
|
-
import
|
2
|
-
import
|
3
|
-
import
|
4
|
-
import
|
5
|
-
export { console_table, deepCopy,
|
1
|
+
import console_table from './ConsoleTable';
|
2
|
+
import deepCopy from './DeepCopy';
|
3
|
+
import Equal from './Equal';
|
4
|
+
import Typeof from './Typeof';
|
5
|
+
export { console_table, deepCopy, Equal, Typeof };
|
6
6
|
import { ConsoleData } from './ConsoleTable';
|
7
7
|
export type { ConsoleData };
|
package/es/index.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
import
|
2
|
-
import
|
3
|
-
import
|
4
|
-
import
|
5
|
-
export { console_table, deepCopy,
|
1
|
+
import console_table from './ConsoleTable';
|
2
|
+
import deepCopy from './DeepCopy';
|
3
|
+
import Equal from './Equal';
|
4
|
+
import Typeof from './Typeof';
|
5
|
+
export { console_table, deepCopy, Equal, Typeof };
|
@@ -1,2 +1,2 @@
|
|
1
1
|
export type ConsoleData = Array<Array<string | number>>;
|
2
|
-
export
|
2
|
+
export default function console_table(data: ConsoleData, callBack?: (str: string) => void): void;
|
@@ -1,6 +1,5 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.console_table = void 0;
|
4
3
|
var NODE = '+';
|
5
4
|
var EDGE = '-';
|
6
5
|
var HIGH = '|';
|
@@ -94,4 +93,4 @@ function console_table(data, callBack) {
|
|
94
93
|
callBack(table);
|
95
94
|
}
|
96
95
|
}
|
97
|
-
exports.
|
96
|
+
exports.default = console_table;
|
package/lib/DeepCopy/index.d.ts
CHANGED
@@ -1 +1 @@
|
|
1
|
-
export
|
1
|
+
export default function deepCopy<T = unknown>(data: T): T;
|
package/lib/DeepCopy/index.js
CHANGED
@@ -1,12 +1,11 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
|
4
|
-
var Typeof_1 = require("../Typeof");
|
3
|
+
var __1 = require("..");
|
5
4
|
function deepCopy(data) {
|
6
|
-
if ((0,
|
5
|
+
if ((0, __1.Typeof)(data) === 'date') {
|
7
6
|
return new Date(data.toISOString());
|
8
7
|
}
|
9
|
-
else if ((0,
|
8
|
+
else if ((0, __1.Typeof)(data) === 'formdata') {
|
10
9
|
var _data = data;
|
11
10
|
var _formData_1 = new FormData();
|
12
11
|
_data.forEach(function (value, key) {
|
@@ -25,7 +24,7 @@ function deepCopy(data) {
|
|
25
24
|
});
|
26
25
|
return newData;
|
27
26
|
}
|
28
|
-
else if (data && (0,
|
27
|
+
else if (data && (0, __1.Typeof)(data) === 'object') {
|
29
28
|
var _data_1 = data;
|
30
29
|
var newData_1 = {};
|
31
30
|
Object.keys(_data_1).forEach(function (key) {
|
@@ -41,4 +40,4 @@ function deepCopy(data) {
|
|
41
40
|
}
|
42
41
|
return data;
|
43
42
|
}
|
44
|
-
exports.
|
43
|
+
exports.default = deepCopy;
|
package/lib/Equal/index.d.ts
CHANGED
@@ -1,3 +1,9 @@
|
|
1
1
|
export declare function TypeEqual<T = unknown>(obj1: T, obj2: T): boolean;
|
2
2
|
export declare function ValEqual<T = unknown>(obj1: T, obj2: T): boolean;
|
3
3
|
export declare function ObjEqual<T = object>(obj1: T, obj2: T): boolean;
|
4
|
+
declare const Equal: {
|
5
|
+
ValEqual: typeof ValEqual;
|
6
|
+
TypeEqual: typeof TypeEqual;
|
7
|
+
ObjEqual: typeof ObjEqual;
|
8
|
+
};
|
9
|
+
export default Equal;
|
package/lib/Equal/index.js
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.ObjEqual = exports.ValEqual = exports.TypeEqual = void 0;
|
4
|
-
var
|
4
|
+
var __1 = require("..");
|
5
5
|
function TypeEqual(obj1, obj2) {
|
6
6
|
var isEqual = false;
|
7
|
-
if ((0,
|
7
|
+
if ((0, __1.Typeof)(obj1) !== (0, __1.Typeof)(obj2)) {
|
8
8
|
isEqual = false;
|
9
9
|
}
|
10
10
|
else {
|
@@ -68,3 +68,9 @@ function ObjEqual(obj1, obj2) {
|
|
68
68
|
return isEqual;
|
69
69
|
}
|
70
70
|
exports.ObjEqual = ObjEqual;
|
71
|
+
var Equal = {
|
72
|
+
ValEqual: ValEqual,
|
73
|
+
TypeEqual: TypeEqual,
|
74
|
+
ObjEqual: ObjEqual
|
75
|
+
};
|
76
|
+
exports.default = Equal;
|
package/lib/Typeof/index.d.ts
CHANGED
package/lib/Typeof/index.js
CHANGED
@@ -1,10 +1,9 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.Typeof = void 0;
|
4
3
|
function Typeof(value) {
|
5
4
|
var object_type = Object.prototype.toString.call(value);
|
6
5
|
var reg = new RegExp(' (.+?)]');
|
7
6
|
var type = object_type.match(reg)[1];
|
8
7
|
return type.toLowerCase();
|
9
8
|
}
|
10
|
-
exports.
|
9
|
+
exports.default = Typeof;
|
package/lib/index.d.ts
CHANGED
@@ -1,7 +1,7 @@
|
|
1
|
-
import
|
2
|
-
import
|
3
|
-
import
|
4
|
-
import
|
5
|
-
export { console_table, deepCopy,
|
1
|
+
import console_table from './ConsoleTable';
|
2
|
+
import deepCopy from './DeepCopy';
|
3
|
+
import Equal from './Equal';
|
4
|
+
import Typeof from './Typeof';
|
5
|
+
export { console_table, deepCopy, Equal, Typeof };
|
6
6
|
import { ConsoleData } from './ConsoleTable';
|
7
7
|
export type { ConsoleData };
|
package/lib/index.js
CHANGED
@@ -1,13 +1,14 @@
|
|
1
1
|
"use strict";
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
+
};
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.Typeof = exports.
|
4
|
-
var ConsoleTable_1 = require("./ConsoleTable");
|
5
|
-
|
6
|
-
var DeepCopy_1 = require("./DeepCopy");
|
7
|
-
|
8
|
-
var Equal_1 = require("./Equal");
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
var Typeof_1 = require("./Typeof");
|
13
|
-
Object.defineProperty(exports, "Typeof", { enumerable: true, get: function () { return Typeof_1.Typeof; } });
|
6
|
+
exports.Typeof = exports.Equal = exports.deepCopy = exports.console_table = void 0;
|
7
|
+
var ConsoleTable_1 = __importDefault(require("./ConsoleTable"));
|
8
|
+
exports.console_table = ConsoleTable_1.default;
|
9
|
+
var DeepCopy_1 = __importDefault(require("./DeepCopy"));
|
10
|
+
exports.deepCopy = DeepCopy_1.default;
|
11
|
+
var Equal_1 = __importDefault(require("./Equal"));
|
12
|
+
exports.Equal = Equal_1.default;
|
13
|
+
var Typeof_1 = __importDefault(require("./Typeof"));
|
14
|
+
exports.Typeof = Typeof_1.default;
|