xshell 1.2.68 → 1.2.69

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/file.d.ts CHANGED
@@ -25,7 +25,7 @@ export declare const binary_encoding: {
25
25
  };
26
26
  export declare const ramdisk: boolean;
27
27
  /** fp 所指向的 文件/ 文件夹 是否存在
28
- Does the file/folder pointed to by fp exist? */
28
+ - print?: `true` */
29
29
  export declare function fexists(fp: string, { print }?: {
30
30
  print?: boolean;
31
31
  }): boolean;
package/file.js CHANGED
@@ -14,7 +14,7 @@ export const print_info_options = { print: print_info };
14
14
  export const binary_encoding = { encoding: 'binary' };
15
15
  export const ramdisk = fexists('T:/TEMP/', noprint);
16
16
  /** fp 所指向的 文件/ 文件夹 是否存在
17
- Does the file/folder pointed to by fp exist? */
17
+ - print?: `true` */
18
18
  export function fexists(fp, { print = true } = {}) {
19
19
  const exists = fs.existsSync(fp);
20
20
  if (print)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xshell",
3
- "version": "1.2.68",
3
+ "version": "1.2.69",
4
4
  "type": "module",
5
5
  "main": "./index.js",
6
6
  "bin": {
@@ -101,7 +101,7 @@
101
101
  "@types/babel__traverse": "^7.20.7",
102
102
  "@types/eslint": "^9.6.1",
103
103
  "@types/estree": "^1.0.8",
104
- "@types/koa": "^2.15.0",
104
+ "@types/koa": "^3.0.0",
105
105
  "@types/koa-compress": "^4.0.6",
106
106
  "@types/mime-types": "^3.0.1",
107
107
  "@types/node": "^24.0.12",
@@ -23,6 +23,7 @@ declare global {
23
23
  }): string;
24
24
  to_regexp(this: string, preservations?: string, flags?: string): RegExp;
25
25
  to_snake_case(this: string): string;
26
+ to_space_case(this: string): string;
26
27
  /** 字符串模式替换
27
28
  - pattern: 匹配部分的格式
28
29
  - pattern_: 替换后的格式
@@ -148,13 +149,17 @@ declare global {
148
149
  /** 格式化为 早上 09:00:00 这样的十二小时制可读友好的时间
149
150
  - ms?: `false` 显示到 ms */
150
151
  to_time_str(this: Date, ms?: boolean): string;
151
- /** 格式化为 17.00.00 这样的时间 */
152
+ /** 格式化为 17.00.00 这样的时间
153
+ - ms?: `false` */
152
154
  to_dot_time_str(this: Date, ms?: boolean): string;
153
- /** 格式化为 2024.01.01 17.00.00 这样的时间 */
155
+ /** 格式化为 2024.01.01 17.00.00 这样的时间
156
+ - ms?: `false` */
154
157
  to_dot_str(this: Date, ms?: boolean): string;
155
- /** 格式化为 17:00:00 这样的时间 */
158
+ /** 格式化为 17:00:00 这样的时间
159
+ - ms?: `false` */
156
160
  to_formal_time_str(this: Date, ms?: boolean): string;
157
- /** 格式化为 2024.01.01 17:00:00 这样的时间 */
161
+ /** 格式化为 2024.01.01 17:00:00 这样的时间
162
+ - ms?: `false` */
158
163
  to_formal_str(this: Date, ms?: boolean): string;
159
164
  }
160
165
  interface Number {
@@ -228,6 +233,7 @@ export declare const is_key_type: IsKeyType;
228
233
  type IsKeyType = (key: any) => key is string | number | symbol;
229
234
  export declare function rethrow(error: Error): void;
230
235
  export declare function to_snake_case(str: string): string;
236
+ export declare function to_space_case(str: string): string;
231
237
  export declare function to_method_property_descriptors(methods: {
232
238
  [name: string]: Function;
233
239
  }): PropertyDescriptorMap;
@@ -18,6 +18,12 @@ export function to_snake_case(str) {
18
18
  .replace('-', '_')
19
19
  .strip_if_start('_');
20
20
  }
21
+ export function to_space_case(str) {
22
+ return str.replace(/([A-Z])/g, ' $1')
23
+ .toLowerCase()
24
+ .replaceAll('_', ' ')
25
+ .strip_if_start(' ');
26
+ }
21
27
  export function to_method_property_descriptors(methods) {
22
28
  return Object.fromEntries(Object.entries(methods)
23
29
  .map(([name, value]) => ([name, {
@@ -75,6 +81,9 @@ if (!globalThis.my_prototype_defined) {
75
81
  to_snake_case() {
76
82
  return to_snake_case(this);
77
83
  },
84
+ to_space_case() {
85
+ return to_space_case(this);
86
+ },
78
87
  refmt(pattern, pattern_, preservations = '', flags = '', transformer = (name, value) => value || '', pattern_placeholder = /\{.*?\}/g) {
79
88
  // --- 转换 pattern 为 pattern_regx
80
89
  let last_end = 0;