@pawover/kit 0.2.0 → 0.2.1
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/package.json +5 -5
- package/packages/hooks/dist/react.d.ts +1 -1
- package/packages/hooks/dist/react.js +18 -1
- package/packages/utils/dist/index.d.ts +15 -0
- package/packages/utils/dist/index.js +3 -4
- package/packages/utils/dist/math.js +1 -1
- package/packages/utils/dist/{stringUtil-CaY_wCS-.js → stringUtil-DbYpnL4l.js} +17 -0
package/package.json
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
"url": "https://github.com/pawover"
|
|
7
7
|
},
|
|
8
8
|
"description": "一个基于 TypeScript 的开发工具包",
|
|
9
|
-
"version": "0.2.
|
|
9
|
+
"version": "0.2.1",
|
|
10
10
|
"type": "module",
|
|
11
11
|
"engines": {
|
|
12
12
|
"node": ">=22.20.0"
|
|
@@ -53,10 +53,10 @@
|
|
|
53
53
|
"devDependencies": {
|
|
54
54
|
"@commitlint/cli": "^21.1.0",
|
|
55
55
|
"@commitlint/config-conventional": "^21.1.0",
|
|
56
|
-
"@eslint-react/eslint-plugin": "^5.
|
|
57
|
-
"@pawover/eslint-rules": "^0.2.
|
|
56
|
+
"@eslint-react/eslint-plugin": "^5.10.0",
|
|
57
|
+
"@pawover/eslint-rules": "^0.2.1",
|
|
58
58
|
"@playwright/test": "^1.61.1",
|
|
59
|
-
"@stylistic/eslint-plugin": "^
|
|
59
|
+
"@stylistic/eslint-plugin": "^6.0.0-beta.5",
|
|
60
60
|
"@types/fs-extra": "^11.0.4",
|
|
61
61
|
"@types/node": "^26.0.1",
|
|
62
62
|
"@vitejs/plugin-react": "^6.0.3",
|
|
@@ -77,7 +77,7 @@
|
|
|
77
77
|
"tsdown": "^0.22.3",
|
|
78
78
|
"turbo": "^2.10.0",
|
|
79
79
|
"typescript": "^6.0.3",
|
|
80
|
-
"typescript-eslint": "^8.62.
|
|
80
|
+
"typescript-eslint": "^8.62.1",
|
|
81
81
|
"vitest": "^4.1.9"
|
|
82
82
|
},
|
|
83
83
|
"peerDependencies": {
|
|
@@ -8,7 +8,7 @@ import { EffectCallback, RefObject } from "react";
|
|
|
8
8
|
*/
|
|
9
9
|
declare function useLatest<T>(value: T): RefObject<T>;
|
|
10
10
|
//#endregion
|
|
11
|
-
//#region ../../node_modules/.pnpm/@pawover+types@0.0.
|
|
11
|
+
//#region ../../node_modules/.pnpm/@pawover+types@0.0.4_@types+react@19.2.15_typescript@6.0.3/node_modules/@pawover/types/dist/index.d.ts
|
|
12
12
|
/** 描述函数类型 */
|
|
13
13
|
type AnyFunction<P extends any[] = any[], R = any> = (...arg: P) => R;
|
|
14
14
|
/** 描述异步函数类型 */
|
|
@@ -11,7 +11,7 @@ function useLatest(value) {
|
|
|
11
11
|
return ref;
|
|
12
12
|
}
|
|
13
13
|
//#endregion
|
|
14
|
-
//#region ../utils/dist/stringUtil-
|
|
14
|
+
//#region ../utils/dist/stringUtil-DbYpnL4l.js
|
|
15
15
|
/**
|
|
16
16
|
* 类型工具类
|
|
17
17
|
*/
|
|
@@ -368,6 +368,23 @@ var TypeUtil = class {
|
|
|
368
368
|
return prototypeCheck ? check && Object.getPrototypeOf(value) === Object.prototype : check;
|
|
369
369
|
}
|
|
370
370
|
/**
|
|
371
|
+
* 判断是否为广义对象类型
|
|
372
|
+
*
|
|
373
|
+
* @param value 待检查值
|
|
374
|
+
* @returns 是否为对象
|
|
375
|
+
* @example
|
|
376
|
+
* ```ts
|
|
377
|
+
* TypeUtil.isObject({}); // true
|
|
378
|
+
* TypeUtil.isObject([]); // true
|
|
379
|
+
* TypeUtil.isObject(new Date()); // true
|
|
380
|
+
* TypeUtil.isObject(null); // false
|
|
381
|
+
* TypeUtil.isObject("string"); // false
|
|
382
|
+
* ```
|
|
383
|
+
*/
|
|
384
|
+
static isObject(value) {
|
|
385
|
+
return typeof value === "object" && value !== null;
|
|
386
|
+
}
|
|
387
|
+
/**
|
|
371
388
|
* 判断一个对象是否为有效的枚举
|
|
372
389
|
* - 枚举成员不能为空
|
|
373
390
|
* - 枚举成员的键不能具有数值名
|
|
@@ -4371,6 +4371,21 @@ declare class TypeUtil {
|
|
|
4371
4371
|
* ```
|
|
4372
4372
|
*/
|
|
4373
4373
|
static isPlainObject(value: unknown, prototypeCheck?: boolean): value is Record<PropertyKey, unknown>;
|
|
4374
|
+
/**
|
|
4375
|
+
* 判断是否为广义对象类型
|
|
4376
|
+
*
|
|
4377
|
+
* @param value 待检查值
|
|
4378
|
+
* @returns 是否为对象
|
|
4379
|
+
* @example
|
|
4380
|
+
* ```ts
|
|
4381
|
+
* TypeUtil.isObject({}); // true
|
|
4382
|
+
* TypeUtil.isObject([]); // true
|
|
4383
|
+
* TypeUtil.isObject(new Date()); // true
|
|
4384
|
+
* TypeUtil.isObject(null); // false
|
|
4385
|
+
* TypeUtil.isObject("string"); // false
|
|
4386
|
+
* ```
|
|
4387
|
+
*/
|
|
4388
|
+
static isObject(value: unknown): value is object;
|
|
4374
4389
|
/**
|
|
4375
4390
|
* 判断一个对象是否为有效的枚举
|
|
4376
4391
|
* - 枚举成员不能为空
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as TypeUtil, t as StringUtil } from "./stringUtil-
|
|
1
|
+
import { n as TypeUtil, t as StringUtil } from "./stringUtil-DbYpnL4l.js";
|
|
2
2
|
//#region src/array/arrayUtil.ts
|
|
3
3
|
/**
|
|
4
4
|
* 数组工具类
|
|
@@ -667,9 +667,8 @@ var FunctionUtil = class {
|
|
|
667
667
|
* ```
|
|
668
668
|
*/
|
|
669
669
|
static toArgs(args, start) {
|
|
670
|
-
if (args === null) throw new TypeError(`function [toArgs] Expected parameter [args] to be a arguments object, got ${typeof args}`);
|
|
671
|
-
|
|
672
|
-
return TypeUtil.isNumber(start) ? array.slice(start) : array;
|
|
670
|
+
if (args === null || args === void 0) throw new TypeError(`function [toArgs] Expected parameter [args] to be a arguments object, got ${typeof args}`);
|
|
671
|
+
return Array.prototype.slice.call(args, start);
|
|
673
672
|
}
|
|
674
673
|
/**
|
|
675
674
|
* 将同步或异步函数统一包装为 Promise
|
|
@@ -355,6 +355,23 @@ var TypeUtil = class {
|
|
|
355
355
|
return prototypeCheck ? check && Object.getPrototypeOf(value) === Object.prototype : check;
|
|
356
356
|
}
|
|
357
357
|
/**
|
|
358
|
+
* 判断是否为广义对象类型
|
|
359
|
+
*
|
|
360
|
+
* @param value 待检查值
|
|
361
|
+
* @returns 是否为对象
|
|
362
|
+
* @example
|
|
363
|
+
* ```ts
|
|
364
|
+
* TypeUtil.isObject({}); // true
|
|
365
|
+
* TypeUtil.isObject([]); // true
|
|
366
|
+
* TypeUtil.isObject(new Date()); // true
|
|
367
|
+
* TypeUtil.isObject(null); // false
|
|
368
|
+
* TypeUtil.isObject("string"); // false
|
|
369
|
+
* ```
|
|
370
|
+
*/
|
|
371
|
+
static isObject(value) {
|
|
372
|
+
return typeof value === "object" && value !== null;
|
|
373
|
+
}
|
|
374
|
+
/**
|
|
358
375
|
* 判断一个对象是否为有效的枚举
|
|
359
376
|
* - 枚举成员不能为空
|
|
360
377
|
* - 枚举成员的键不能具有数值名
|