hsu-utils 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
package/dist/hsu-utils.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  *
3
- * hsu-utils v0.0.5
3
+ * hsu-utils v0.0.6
4
4
  *
5
5
  * some front-end utils
6
6
  *
@@ -79,6 +79,16 @@ eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexpo
79
79
 
80
80
  /***/ }),
81
81
 
82
+ /***/ "./tools/GetStrWidth/index.ts":
83
+ /*!************************************!*\
84
+ !*** ./tools/GetStrWidth/index.ts ***!
85
+ \************************************/
86
+ /***/ ((__unused_webpack_module, exports) => {
87
+
88
+ eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\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 ? 0.5 : 1;\n }\n return width;\n}\nexports[\"default\"] = get_string_width;\n\n\n//# sourceURL=webpack://hsu-utils/./tools/GetStrWidth/index.ts?");
89
+
90
+ /***/ }),
91
+
82
92
  /***/ "./tools/Typeof/index.ts":
83
93
  /*!*******************************!*\
84
94
  !*** ./tools/Typeof/index.ts ***!
@@ -95,7 +105,7 @@ eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nfunc
95
105
  \************************/
96
106
  /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
97
107
 
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?");
108
+ eval("\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.get_string_width = exports.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;\nvar GetStrWidth_1 = __importDefault(__webpack_require__(/*! ./GetStrWidth */ \"./tools/GetStrWidth/index.ts\"));\nexports.get_string_width = GetStrWidth_1.default;\n\n\n//# sourceURL=webpack://hsu-utils/./tools/index.ts?");
99
109
 
100
110
  /***/ })
101
111
 
@@ -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});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,n=(0,o.deepCopy)(e),a=(0,o.deepCopy)(t);if(null!==n&&null!==a){if(Array.isArray(n)&&Array.isArray(a))if(n.sort(),a.sort(),n.length!==a.length)r=!1;else for(var f=0;f<n.length&&(r=u(n[f],a[f]));f++);else if("object"==typeof n&&"object"==typeof a)if(Object.keys(n).length!==Object.keys(a).length)r=!1;else for(var l in n)if(!(r=u(n[l],a[l])))break}else null===n&&null===a&&(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})()));
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="|",a=" ",u="";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,a="";return e.forEach((function(e,f){a+=r+function(e){for(var t="",r=0;r<=e;r++)t+=o;return t}(e+1),a+=f===n-1?r+(t?u:"\n"):u})),a}function i(e){for(var t="",r=0;r<=e;r++)t+=a;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+=a+(null!=c?c:"")+i(e-f((null!=c?c:"").toString())):p+=i(e-f(c.toString()))+c+a,o+=n+p,o+=l===r-1?n+"\n":u})),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 a=t,u={};return Object.keys(a).forEach((function(t){var r=a[t];u[t]="object"==typeof r?e(r):r})),u}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 a(e,t){return null===e&&void 0===t||void 0===e&&null===t||("object"==typeof e&&"object"==typeof t?u(e,t):"function"==typeof e&&"function"==typeof t?JSON.stringify(e)===JSON.stringify(t):e===t)}function u(e,t){var r=!1,n=(0,o.deepCopy)(e),u=(0,o.deepCopy)(t);if(null!==n&&null!==u){if(Array.isArray(n)&&Array.isArray(u))if(n.sort(),u.sort(),n.length!==u.length)r=!1;else for(var f=0;f<n.length&&(r=a(n[f],u[f]));f++);else if("object"==typeof n&&"object"==typeof u)if(Object.keys(n).length!==Object.keys(u).length)r=!1;else for(var l in n)if(!(r=a(n[l],u[l])))break}else null===n&&null===u&&(r=!0);return r}t.TypeEqual=n,t.ValEqual=a,t.ObjEqual=u;var f={ValEqual:a,TypeEqual:n,ObjEqual:u};t.default=f},285:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(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?.5:1}return t}},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.get_string_width=t.Typeof=t.Equal=t.deepCopy=t.console_table=void 0;var n=o(r(442));t.console_table=n.default;var a=o(r(819));t.deepCopy=a.default;var u=o(r(962));t.Equal=u.default;var f=o(r(332));t.Typeof=f.default;var l=o(r(285));t.get_string_width=l.default}},t={};var r=function r(o){var n=t[o];if(void 0!==n)return n.exports;var a=t[o]={exports:{}};return e[o].call(a.exports,a,a.exports,r),a.exports}(243);return r})()));
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  *
3
- * hsu-utils v0.0.5
3
+ * hsu-utils v0.0.6
4
4
  *
5
5
  * some front-end utils
6
6
  *
@@ -0,0 +1 @@
1
+ export default function get_string_width(str: string): number;
@@ -0,0 +1,7 @@
1
+ export default function get_string_width(str) {
2
+ let width = 0;
3
+ for (const char of str) {
4
+ width += char.charCodeAt(0) < 128 && char.charCodeAt(0) >= 0 ? 0.5 : 1;
5
+ }
6
+ return width;
7
+ }
package/es/index.d.ts CHANGED
@@ -2,6 +2,7 @@ import console_table from './ConsoleTable';
2
2
  import deepCopy from './DeepCopy';
3
3
  import Equal from './Equal';
4
4
  import Typeof from './Typeof';
5
- export { console_table, deepCopy, Equal, Typeof };
5
+ import get_string_width from './GetStrWidth';
6
+ export { console_table, deepCopy, Equal, Typeof, get_string_width };
6
7
  import { ConsoleData } from './ConsoleTable';
7
8
  export type { ConsoleData };
package/es/index.js CHANGED
@@ -2,4 +2,5 @@ import console_table from './ConsoleTable';
2
2
  import deepCopy from './DeepCopy';
3
3
  import Equal from './Equal';
4
4
  import Typeof from './Typeof';
5
- export { console_table, deepCopy, Equal, Typeof };
5
+ import get_string_width from './GetStrWidth';
6
+ export { console_table, deepCopy, Equal, Typeof, get_string_width };
@@ -0,0 +1 @@
1
+ export default function get_string_width(str: string): number;
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ function get_string_width(str) {
4
+ var width = 0;
5
+ for (var _i = 0, str_1 = str; _i < str_1.length; _i++) {
6
+ var char = str_1[_i];
7
+ width += char.charCodeAt(0) < 128 && char.charCodeAt(0) >= 0 ? 0.5 : 1;
8
+ }
9
+ return width;
10
+ }
11
+ exports.default = get_string_width;
package/lib/index.d.ts CHANGED
@@ -2,6 +2,7 @@ import console_table from './ConsoleTable';
2
2
  import deepCopy from './DeepCopy';
3
3
  import Equal from './Equal';
4
4
  import Typeof from './Typeof';
5
- export { console_table, deepCopy, Equal, Typeof };
5
+ import get_string_width from './GetStrWidth';
6
+ export { console_table, deepCopy, Equal, Typeof, get_string_width };
6
7
  import { ConsoleData } from './ConsoleTable';
7
8
  export type { ConsoleData };
package/lib/index.js CHANGED
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.Typeof = exports.Equal = exports.deepCopy = exports.console_table = void 0;
6
+ exports.get_string_width = exports.Typeof = exports.Equal = exports.deepCopy = exports.console_table = void 0;
7
7
  var ConsoleTable_1 = __importDefault(require("./ConsoleTable"));
8
8
  exports.console_table = ConsoleTable_1.default;
9
9
  var DeepCopy_1 = __importDefault(require("./DeepCopy"));
@@ -12,3 +12,5 @@ var Equal_1 = __importDefault(require("./Equal"));
12
12
  exports.Equal = Equal_1.default;
13
13
  var Typeof_1 = __importDefault(require("./Typeof"));
14
14
  exports.Typeof = Typeof_1.default;
15
+ var GetStrWidth_1 = __importDefault(require("./GetStrWidth"));
16
+ exports.get_string_width = GetStrWidth_1.default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hsu-utils",
3
- "version": "0.0.6",
3
+ "version": "0.0.7",
4
4
  "description": "some front-end utils",
5
5
  "repository": "git@github.com:VitaTsui/hsu-utils.git",
6
6
  "author": "VitaHsu <vitahsu7@gmail.com>",