xshell 1.0.184 → 1.0.185
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 +1 -1
- package/path.d.ts +2 -2
- package/prototype.browser.d.ts +14 -5
- package/prototype.browser.js +4 -4
- package/prototype.d.ts +13 -5
- package/prototype.js +4 -4
package/package.json
CHANGED
package/path.d.ts
CHANGED
|
@@ -55,7 +55,7 @@ export declare function extname(path: string): string;
|
|
|
55
55
|
/** `/` */
|
|
56
56
|
export declare const sep = "/";
|
|
57
57
|
/** The platform-specific file delimiter. ';' or ':'. */
|
|
58
|
-
export declare const delimiter: "
|
|
58
|
+
export declare const delimiter: ":" | ";";
|
|
59
59
|
/** Returns an object from a path string - the opposite of format().
|
|
60
60
|
@param path path to evaluate.
|
|
61
61
|
@throws {TypeError} if `path` is not a string. */
|
|
@@ -83,7 +83,7 @@ export declare let path: {
|
|
|
83
83
|
basename: typeof basename;
|
|
84
84
|
extname: typeof extname;
|
|
85
85
|
sep: string;
|
|
86
|
-
delimiter: "
|
|
86
|
+
delimiter: ":" | ";";
|
|
87
87
|
parse: typeof parse;
|
|
88
88
|
format: typeof format;
|
|
89
89
|
toNamespacedPath: typeof toNamespacedPath;
|
package/prototype.browser.d.ts
CHANGED
|
@@ -88,11 +88,15 @@ declare global {
|
|
|
88
88
|
/** 返回去掉 suffix 结尾的字符串,如果没有以 suffix 结尾则返回原字符串 */
|
|
89
89
|
strip_if_end(this: string, suffix: string): string;
|
|
90
90
|
/** 从 search 字符串出现的位置开始截取到最后
|
|
91
|
-
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
91
|
+
- options?:
|
|
92
|
+
- include?: `false` 传 true 时包括 search 部分
|
|
93
|
+
- last?: `false` true 时从最后一次出现的地方开始截取,否则默认从第一次出现的地方开始截取 */
|
|
94
|
+
slice_from(this: string, search: string, options?: SliceOptions): string;
|
|
95
|
+
/** 从 search 字符串最后出现的位置开始截断,去掉尾部
|
|
96
|
+
- options?:
|
|
97
|
+
- include?: `false` 传 true 时包括 search 部分
|
|
98
|
+
- last?: `false` true 时截取到最后一次出现的地方,否则默认截取到第一次出现的地方 */
|
|
99
|
+
slice_to(this: string, search: string, options?: SliceOptions): string;
|
|
96
100
|
/** 等价于 .endsWith('/') */
|
|
97
101
|
isdir: boolean;
|
|
98
102
|
/** 以 `/` 分割的路径,可能以 / 结尾 */
|
|
@@ -161,6 +165,10 @@ declare global {
|
|
|
161
165
|
map<TResult>(mapfn: (value: T, index: number) => TResult): TResult[];
|
|
162
166
|
}
|
|
163
167
|
}
|
|
168
|
+
interface SliceOptions {
|
|
169
|
+
include?: boolean;
|
|
170
|
+
last?: boolean;
|
|
171
|
+
}
|
|
164
172
|
export declare const emoji_regex: RegExp;
|
|
165
173
|
export declare function to_method_property_descriptors(methods: {
|
|
166
174
|
[name: string]: Function;
|
|
@@ -185,3 +193,4 @@ export declare const brackets: {
|
|
|
185
193
|
};
|
|
186
194
|
export declare function to_json(obj: any, replacer?: any): string;
|
|
187
195
|
export declare function is_codepoint_fullwidth(codepoint: number): boolean;
|
|
196
|
+
export {};
|
package/prototype.browser.js
CHANGED
|
@@ -275,15 +275,15 @@ Object.defineProperties(String.prototype, {
|
|
|
275
275
|
strip_if_end(suffix) {
|
|
276
276
|
return this.endsWith(suffix) ? this.slice(0, -suffix.length) : this;
|
|
277
277
|
},
|
|
278
|
-
slice_from(search, include = false) {
|
|
279
|
-
const i = this.indexOf(search);
|
|
278
|
+
slice_from(search, { include = false, last = false } = {}) {
|
|
279
|
+
const i = last ? this.lastIndexOf(search) : this.indexOf(search);
|
|
280
280
|
if (i === -1)
|
|
281
281
|
throw new Error(`slice_from 在字符串 ${this} 中找不到 search: ${search}`);
|
|
282
282
|
else
|
|
283
283
|
return this.slice(include ? i : i + search.length);
|
|
284
284
|
},
|
|
285
|
-
slice_to(search, include) {
|
|
286
|
-
const i = this.lastIndexOf(search);
|
|
285
|
+
slice_to(search, { include = false, last = false } = {}) {
|
|
286
|
+
const i = last ? this.lastIndexOf(search) : this.indexOf(search);
|
|
287
287
|
if (i === -1)
|
|
288
288
|
throw new Error(`slice_to 在字符串 ${this} 中找不到 search: ${search}`);
|
|
289
289
|
else
|
package/prototype.d.ts
CHANGED
|
@@ -110,11 +110,15 @@ declare global {
|
|
|
110
110
|
/** 返回去掉 suffix 结尾的字符串,如果没有以 suffix 结尾则返回原字符串 */
|
|
111
111
|
strip_if_end(this: string, suffix: string): string;
|
|
112
112
|
/** 从 search 字符串出现的位置开始截取到最后
|
|
113
|
-
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
113
|
+
- options?:
|
|
114
|
+
- include?: `false` 传 true 时包括 search 部分
|
|
115
|
+
- last?: `false` true 时从最后一次出现的地方开始截取,否则默认从第一次出现的地方开始截取 */
|
|
116
|
+
slice_from(this: string, search: string, options?: SliceOptions): string;
|
|
117
|
+
/** 从 search 字符串最后出现的位置开始截断,去掉尾部
|
|
118
|
+
- options?:
|
|
119
|
+
- include?: `false` 传 true 时包括 search 部分
|
|
120
|
+
- last?: `false` true 时截取到最后一次出现的地方,否则默认截取到第一次出现的地方 */
|
|
121
|
+
slice_to(this: string, search: string, options?: SliceOptions): string;
|
|
118
122
|
/** 等价于 .endsWith('/') */
|
|
119
123
|
isdir: boolean;
|
|
120
124
|
/** 以 `/` 分割的路径,可能以 / 结尾 */
|
|
@@ -191,6 +195,10 @@ declare global {
|
|
|
191
195
|
map<TResult>(mapfn: (value: T, index: number) => TResult): TResult[];
|
|
192
196
|
}
|
|
193
197
|
}
|
|
198
|
+
interface SliceOptions {
|
|
199
|
+
include?: boolean;
|
|
200
|
+
last?: boolean;
|
|
201
|
+
}
|
|
194
202
|
import chalk from 'chalk';
|
|
195
203
|
export declare const emoji_regex: RegExp;
|
|
196
204
|
export { chalk };
|
package/prototype.js
CHANGED
|
@@ -294,15 +294,15 @@ if (!globalThis.my_prototype_defined) {
|
|
|
294
294
|
strip_if_end(suffix) {
|
|
295
295
|
return this.endsWith(suffix) ? this.slice(0, -suffix.length) : this;
|
|
296
296
|
},
|
|
297
|
-
slice_from(search, include = false) {
|
|
298
|
-
const i = this.indexOf(search);
|
|
297
|
+
slice_from(search, { include = false, last = false } = {}) {
|
|
298
|
+
const i = last ? this.lastIndexOf(search) : this.indexOf(search);
|
|
299
299
|
if (i === -1)
|
|
300
300
|
throw new Error(`slice_from 在字符串 ${this} 中找不到 search: ${search}`);
|
|
301
301
|
else
|
|
302
302
|
return this.slice(include ? i : i + search.length);
|
|
303
303
|
},
|
|
304
|
-
slice_to(search, include) {
|
|
305
|
-
const i = this.lastIndexOf(search);
|
|
304
|
+
slice_to(search, { include = false, last = false } = {}) {
|
|
305
|
+
const i = last ? this.lastIndexOf(search) : this.indexOf(search);
|
|
306
306
|
if (i === -1)
|
|
307
307
|
throw new Error(`slice_to 在字符串 ${this} 中找不到 search: ${search}`);
|
|
308
308
|
else
|