hsu-utils 0.0.13 → 0.0.15
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +32 -30
- package/dist/hsu-utils.js +2 -2
- package/dist/hsu-utils.min.js +1 -1
- package/dist/hsu-utils.min.js.LICENSE.txt +1 -1
- package/es/GetStrWidth/index.d.ts +1 -1
- package/es/GetStrWidth/index.js +4 -2
- package/lib/GetStrWidth/index.d.ts +1 -1
- package/lib/GetStrWidth/index.js +4 -1
- package/package.json +59 -59
package/README.md
CHANGED
@@ -1,30 +1,32 @@
|
|
1
|
-
# [Hsu Utils](https://github.com/VitaTsui/hsu-utils#hsu-utils)
|
2
|
-
|
3
|
-
## 前言
|
4
|
-
|
5
|
-
`hsu-utils` 一些前端的工具集
|
6
|
-
|
7
|
-
## 安装
|
8
|
-
|
9
|
-
```sh
|
10
|
-
npm install --save hsu-utils
|
11
|
-
# 或
|
12
|
-
yarn add hsu-utils
|
13
|
-
```
|
14
|
-
|
15
|
-
## 功能
|
16
|
-
|
17
|
-
- `console_table` 在控制台打印像 MySql 一样的表格
|
18
|
-
- `deepCopy` 深拷贝
|
19
|
-
- `Equal`
|
20
|
-
|
21
|
-
> `ValEqual` 判断值相等,`TypeEqual` 判断类型相同,`ObjEqual` 判断对象相等
|
22
|
-
|
23
|
-
- `Typeof` 获取类型或判断类型
|
24
|
-
|
25
|
-
>
|
26
|
-
|
27
|
-
- `get_string_width` 获取字符串长度
|
28
|
-
> 根据字体属性进行计算,默认 size 为 12,family 为 微软雅黑
|
29
|
-
- `loadImage` 异步加载图片
|
30
|
-
> 确保相同的图片只加载一次
|
1
|
+
# [Hsu Utils](https://github.com/VitaTsui/hsu-utils#hsu-utils)
|
2
|
+
|
3
|
+
## 前言
|
4
|
+
|
5
|
+
`hsu-utils` 一些前端的工具集
|
6
|
+
|
7
|
+
## 安装
|
8
|
+
|
9
|
+
```sh
|
10
|
+
npm install --save hsu-utils
|
11
|
+
# 或
|
12
|
+
yarn add hsu-utils
|
13
|
+
```
|
14
|
+
|
15
|
+
## 功能
|
16
|
+
|
17
|
+
- `console_table` 在控制台打印像 MySql 一样的表格
|
18
|
+
- `deepCopy` 深拷贝
|
19
|
+
- `Equal`
|
20
|
+
|
21
|
+
> `ValEqual` 判断值相等,`TypeEqual` 判断类型相同,`ObjEqual` 判断对象相等
|
22
|
+
|
23
|
+
- `Typeof` 获取类型或判断类型
|
24
|
+
|
25
|
+
> string、number、boolean、undefined、function、symbol、bigint、object、array、null、date、formdata、set、map、regexp、arraybuffer、blob
|
26
|
+
|
27
|
+
- `get_string_width` 获取字符串长度
|
28
|
+
> 根据字体属性进行计算,默认 size 为 12,family 为 微软雅黑
|
29
|
+
- `loadImage` 异步加载图片
|
30
|
+
> 确保相同的图片只加载一次
|
31
|
+
- `renderPDF` 渲染 PDF
|
32
|
+
- `downloadFile` 下载文件
|
package/dist/hsu-utils.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
/*!
|
2
2
|
*
|
3
|
-
* hsu-utils v0.0.
|
3
|
+
* hsu-utils v0.0.14
|
4
4
|
*
|
5
5
|
* some front-end utils
|
6
6
|
*
|
@@ -120,7 +120,7 @@ eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexpo
|
|
120
120
|
/***/ ((__unused_webpack_module, exports) => {
|
121
121
|
|
122
122
|
"use strict";
|
123
|
-
eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nfunction get_string_width(str, font) {\n if (font === void 0) { font = {}; }\n var _a = font.style, style = _a === void 0 ? 'normal' : _a, _b = font.variant, variant = _b === void 0 ? 'normal' : _b, _c = font.weight, weight = _c === void 0 ? 'normal' : _c, _d = font.size, size = _d === void 0 ? 12 : _d, _e = font.lineHeight, lineHeight = _e === void 0 ? 1 : _e, _f = font.family, fontFamily = _f === void 0 ? '微软雅黑' : _f;\n var canvas = document.createElement('canvas');\n var ctx = canvas.getContext('2d');\n ctx.font = \"\".concat(style, \" \").concat(variant, \" \").concat(weight, \" \").concat(size, \"px/\").concat(lineHeight, \" \").concat(fontFamily);\n var metrics = ctx.measureText(str);\n var width = +(+metrics.width.toFixed(2) + 0.01).toFixed(2);\n return width;\n}\nexports[\"default\"] = get_string_width;\n\n\n//# sourceURL=webpack://hsu-utils/./tools/GetStrWidth/index.ts?");
|
123
|
+
eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nfunction get_string_width(str, font, letterSpacing) {\n if (font === void 0) { font = {}; }\n if (letterSpacing === void 0) { letterSpacing = 0; }\n var _a = font.style, style = _a === void 0 ? 'normal' : _a, _b = font.variant, variant = _b === void 0 ? 'normal' : _b, _c = font.weight, weight = _c === void 0 ? 'normal' : _c, _d = font.size, size = _d === void 0 ? 12 : _d, _e = font.lineHeight, lineHeight = _e === void 0 ? 1 : _e, _f = font.family, fontFamily = _f === void 0 ? '微软雅黑' : _f;\n var canvas = document.createElement('canvas');\n var ctx = canvas.getContext('2d');\n ctx.font = \"\".concat(style, \" \").concat(variant, \" \").concat(weight, \" \").concat(size, \"px/\").concat(lineHeight, \" \").concat(fontFamily);\n var metrics = ctx.measureText(str);\n var width = +(+metrics.width.toFixed(2) + 0.01).toFixed(2);\n var _letterSpacing = (str.length > 0 ? str.length - 1 : 0) * letterSpacing;\n width += _letterSpacing;\n return width;\n}\nexports[\"default\"] = get_string_width;\n\n\n//# sourceURL=webpack://hsu-utils/./tools/GetStrWidth/index.ts?");
|
124
124
|
|
125
125
|
/***/ }),
|
126
126
|
|