xshell 1.1.11 → 1.1.12

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xshell",
3
- "version": "1.1.11",
3
+ "version": "1.1.12",
4
4
  "type": "module",
5
5
  "main": "./index.js",
6
6
  "bin": {
@@ -343,21 +343,22 @@ Object.defineProperties(String.prototype, {
343
343
  return fp.endsWith('/') ? fp : `${fp}/`;
344
344
  },
345
345
  fdir() {
346
- return this.strip_end(this.fname);
346
+ return this.fp.strip_end(this.fname);
347
347
  },
348
348
  fname() {
349
- const ilast = this.lastIndexOf('/');
349
+ const { fp } = this;
350
+ const ilast = fp.lastIndexOf('/');
350
351
  if (ilast === -1)
351
- return this; // 没有斜杠时返回整个字符串
352
+ return fp; // 没有斜杠时返回整个字符串
352
353
  // 以斜杠结尾的情况
353
- if (ilast === this.length - 1) {
354
- const iprev = this.lastIndexOf('/', ilast - 1);
354
+ if (ilast === fp.length - 1) {
355
+ const iprev = fp.lastIndexOf('/', ilast - 1);
355
356
  return iprev === -1
356
- ? this // 只有一个斜杠且在末尾
357
- : this.slice(iprev + 1);
357
+ ? fp // 只有一个斜杠且在末尾
358
+ : fp.slice(iprev + 1);
358
359
  }
359
360
  // 返回最后一个斜杠后的内容
360
- return this.slice(ilast + 1);
361
+ return fp.slice(ilast + 1);
361
362
  },
362
363
  fext() {
363
364
  const { fname } = this;
package/prototype.js CHANGED
@@ -380,21 +380,22 @@ if (!globalThis.my_prototype_defined) {
380
380
  return fp.endsWith('/') ? fp : `${fp}/`;
381
381
  },
382
382
  fdir() {
383
- return this.strip_end(this.fname);
383
+ return this.fp.strip_end(this.fname);
384
384
  },
385
385
  fname() {
386
- const ilast = this.lastIndexOf('/');
386
+ const { fp } = this;
387
+ const ilast = fp.lastIndexOf('/');
387
388
  if (ilast === -1)
388
- return this; // 没有斜杠时返回整个字符串
389
+ return fp; // 没有斜杠时返回整个字符串
389
390
  // 以斜杠结尾的情况
390
- if (ilast === this.length - 1) {
391
- const iprev = this.lastIndexOf('/', ilast - 1);
391
+ if (ilast === fp.length - 1) {
392
+ const iprev = fp.lastIndexOf('/', ilast - 1);
392
393
  return iprev === -1
393
- ? this // 只有一个斜杠且在末尾
394
- : this.slice(iprev + 1);
394
+ ? fp // 只有一个斜杠且在末尾
395
+ : fp.slice(iprev + 1);
395
396
  }
396
397
  // 返回最后一个斜杠后的内容
397
- return this.slice(ilast + 1);
398
+ return fp.slice(ilast + 1);
398
399
  },
399
400
  fext() {
400
401
  const { fname } = this;