@bhsd/common 2.1.0 → 2.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/dist/index.d.ts +6 -0
- package/dist/index.js +6 -0
- package/package.json +7 -9
package/dist/index.d.ts
CHANGED
|
@@ -71,4 +71,10 @@ export declare const lintJSON: (str: string) => JsonError[];
|
|
|
71
71
|
* @param str JSONC字符串
|
|
72
72
|
*/
|
|
73
73
|
export declare const lintJSONC: (str: string) => JsonError[];
|
|
74
|
+
/**
|
|
75
|
+
* 获取字符串开头的空白字符数量
|
|
76
|
+
* @param str 字符串
|
|
77
|
+
* @param re 其他正则表达式,默认为匹配非空白字符的正则表达式
|
|
78
|
+
*/
|
|
79
|
+
export declare const numLeadingSpaces: (str: string, re?: RegExp) => number;
|
|
74
80
|
export {};
|
package/dist/index.js
CHANGED
|
@@ -168,3 +168,9 @@ export const lintJSON = (str) => {
|
|
|
168
168
|
* @param str JSONC字符串
|
|
169
169
|
*/
|
|
170
170
|
export const lintJSONC = (str) => str.trim() ? lintJSONBase(str, jsonc_parse) : [];
|
|
171
|
+
/**
|
|
172
|
+
* 获取字符串开头的空白字符数量
|
|
173
|
+
* @param str 字符串
|
|
174
|
+
* @param re 其他正则表达式,默认为匹配非空白字符的正则表达式
|
|
175
|
+
*/
|
|
176
|
+
export const numLeadingSpaces = (str, re = /\S|$/u) => str.search(re);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bhsd/common",
|
|
3
|
-
"version": "2.1
|
|
3
|
+
"version": "2.2.1",
|
|
4
4
|
"homepage": "https://github.com/bhsd-harry/common#readme",
|
|
5
5
|
"bugs": {
|
|
6
6
|
"url": "https://github.com/bhsd-harry/common/issues"
|
|
@@ -24,26 +24,24 @@
|
|
|
24
24
|
"test": "mocha"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
|
-
"@bhsd/code-standard": "^2.
|
|
27
|
+
"@bhsd/code-standard": "^2.4.1",
|
|
28
28
|
"@eslint-community/eslint-plugin-eslint-comments": "^4.7.1",
|
|
29
29
|
"@stylistic/eslint-plugin": "^5.10.0",
|
|
30
30
|
"@types/mocha": "^10.0.10",
|
|
31
|
-
"@typescript-eslint/eslint-plugin": "^8.59.
|
|
32
|
-
"@typescript-eslint/parser": "^8.59.
|
|
31
|
+
"@typescript-eslint/eslint-plugin": "^8.59.1",
|
|
32
|
+
"@typescript-eslint/parser": "^8.59.1",
|
|
33
33
|
"esbuild": "^0.28.0",
|
|
34
|
-
"eslint": "^10.
|
|
34
|
+
"eslint": "^10.3.0",
|
|
35
35
|
"eslint-plugin-es-x": "^9.6.0",
|
|
36
36
|
"eslint-plugin-jsdoc": "^62.9.0",
|
|
37
37
|
"eslint-plugin-jsonc": "^3.1.2",
|
|
38
|
-
"eslint-plugin-promise": "^7.
|
|
38
|
+
"eslint-plugin-promise": "^7.3.0",
|
|
39
39
|
"eslint-plugin-regexp": "^3.1.0",
|
|
40
40
|
"eslint-plugin-unicorn": "^64.0.0",
|
|
41
|
+
"eslint-plugin-yml": "^3.3.2",
|
|
41
42
|
"mocha": "^11.7.5",
|
|
42
43
|
"typescript": "^6.0.3"
|
|
43
44
|
},
|
|
44
|
-
"overrides": {
|
|
45
|
-
"eslint": "^10.2.1"
|
|
46
|
-
},
|
|
47
45
|
"engines": {
|
|
48
46
|
"node": "^20.19.0 || ^22.13.0 || >=24.11.0"
|
|
49
47
|
}
|