@bhsd/common 2.1.0 → 2.2.0

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 CHANGED
@@ -71,4 +71,9 @@ 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
+ */
78
+ export declare const numLeadingSpaces: (str: string) => number;
74
79
  export {};
package/dist/index.js CHANGED
@@ -168,3 +168,8 @@ 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
+ */
175
+ export const numLeadingSpaces = (str) => str.search(/\S|$/u);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bhsd/common",
3
- "version": "2.1.0",
3
+ "version": "2.2.0",
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.3.0",
27
+ "@bhsd/code-standard": "^2.4.0",
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.0",
32
- "@typescript-eslint/parser": "^8.59.0",
31
+ "@typescript-eslint/eslint-plugin": "^8.59.1",
32
+ "@typescript-eslint/parser": "^8.59.1",
33
33
  "esbuild": "^0.28.0",
34
- "eslint": "^10.2.1",
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.2.1",
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
  }