rechrome 1.12.1 → 1.12.2

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.
Files changed (3) hide show
  1. package/package.json +1 -1
  2. package/rech.js +6 -3
  3. package/rech.ts +6 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rechrome",
3
- "version": "1.12.1",
3
+ "version": "1.12.2",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/snomiao/rechrome.git"
package/rech.js CHANGED
@@ -687,9 +687,12 @@ async function setup(opts: { profile?: string } = {}): Promise<void> {
687
687
  );
688
688
  if (opts.profile !== undefined) {
689
689
  const num = parseInt(opts.profile);
690
- if (!isNaN(num)) return available[num - 1] ?? null;
691
- return available.find(([, info]) =>
692
- (info.user_name ?? "").toLowerCase().includes(opts.profile!.toLowerCase())
690
+ if (!isNaN(num) && String(num) === opts.profile.trim()) return available[num - 1] ?? null;
691
+ const needle = opts.profile.toLowerCase();
692
+ return available.find(([dir, info]) =>
693
+ dir.toLowerCase() === needle
694
+ || (info.name ?? "").toLowerCase() === needle
695
+ || (info.user_name ?? "").toLowerCase().includes(needle)
693
696
  ) ?? null;
694
697
  }
695
698
  if (available.length === 1) {
package/rech.ts CHANGED
@@ -687,9 +687,12 @@ async function setup(opts: { profile?: string } = {}): Promise<void> {
687
687
  );
688
688
  if (opts.profile !== undefined) {
689
689
  const num = parseInt(opts.profile);
690
- if (!isNaN(num)) return available[num - 1] ?? null;
691
- return available.find(([, info]) =>
692
- (info.user_name ?? "").toLowerCase().includes(opts.profile!.toLowerCase())
690
+ if (!isNaN(num) && String(num) === opts.profile.trim()) return available[num - 1] ?? null;
691
+ const needle = opts.profile.toLowerCase();
692
+ return available.find(([dir, info]) =>
693
+ dir.toLowerCase() === needle
694
+ || (info.name ?? "").toLowerCase() === needle
695
+ || (info.user_name ?? "").toLowerCase().includes(needle)
693
696
  ) ?? null;
694
697
  }
695
698
  if (available.length === 1) {