@ctrl/magnet-link 3.1.0 → 3.1.1

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/src/bep53.js CHANGED
@@ -1,13 +1,10 @@
1
- /* eslint-disable @typescript-eslint/restrict-plus-operands */
2
1
  export function composeRange(range) {
3
2
  return range
4
3
  .reduce((acc, cur, idx, arr) => {
5
- // @ts-expect-error
6
4
  if (idx === 0 || cur !== arr[idx - 1] + 1) {
7
5
  acc.push([]);
8
6
  }
9
- // @ts-expect-error
10
- acc[acc.length - 1].push(cur);
7
+ acc[acc.length - 1].push(`${cur}`);
11
8
  return acc;
12
9
  }, [])
13
10
  .map(cur => {
@@ -1,4 +1,4 @@
1
- /// <reference types="node" />
1
+ /// <reference types="node" resolution-mode="require"/>
2
2
  export interface MagnetData {
3
3
  /**
4
4
  * Is the info-hash hex encoded, for a total of 40 characters. For compatability with existing links in the wild, clients should also support the 32 character base32 encoded info-hash.
package/dist/src/index.js CHANGED
@@ -51,9 +51,8 @@ export function magnetDecode(uri) {
51
51
  let m;
52
52
  const xss = Array.isArray(result.xs) ? result.xs : [result.xs];
53
53
  xss.forEach(xs => {
54
- var _a;
55
54
  if ((m = /^urn:btpk:(.{64})/.exec(xs))) {
56
- result.publicKey = (_a = m[1]) === null || _a === void 0 ? void 0 : _a.toLowerCase();
55
+ result.publicKey = m[1]?.toLowerCase();
57
56
  }
58
57
  });
59
58
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ctrl/magnet-link",
3
- "version": "3.1.0",
3
+ "version": "3.1.1",
4
4
  "description": "Parse a magnet URI into an object",
5
5
  "author": "Scott Cooper <scttcper@gmail.com>",
6
6
  "homepage": "https://magnet-link.vercel.app",
@@ -26,33 +26,21 @@
26
26
  "lint:fix": "eslint --fix --ext .ts .",
27
27
  "prepare": "npm run build",
28
28
  "build": "tsc",
29
- "test": "ava",
30
- "test:watch": "ava --watch",
31
- "test:ci": "c8 --reporter=text --reporter=lcov ava"
29
+ "test": "vitest run",
30
+ "test:watch": "vitest",
31
+ "test:ci": "vitest run --coverage --reporter=junit --outputFile=./junit.xml"
32
32
  },
33
33
  "dependencies": {
34
34
  "@ctrl/ts-base32": "^2.1.1"
35
35
  },
36
36
  "devDependencies": {
37
- "@ctrl/eslint-config": "3.3.1",
38
- "@sindresorhus/tsconfig": "2.0.0",
39
- "@types/node": "17.0.9",
40
- "ava": "4.0.1",
37
+ "@ctrl/eslint-config": "3.4.4",
38
+ "@sindresorhus/tsconfig": "3.0.1",
39
+ "@types/node": "17.0.39",
41
40
  "buffer": "6.0.3",
42
- "c8": "7.11.0",
43
- "ts-node": "10.4.0",
44
- "typescript": "4.5.4"
45
- },
46
- "ava": {
47
- "files": [
48
- "test/**/*.spec.ts"
49
- ],
50
- "extensions": {
51
- "ts": "module"
52
- },
53
- "nodeArguments": [
54
- "--loader=ts-node/esm"
55
- ]
41
+ "c8": "7.11.3",
42
+ "typescript": "4.7.3",
43
+ "vitest": "0.13.1"
56
44
  },
57
45
  "workspaces": [
58
46
  "demo"
@@ -61,7 +49,9 @@
61
49
  "access": "public"
62
50
  },
63
51
  "release": {
64
- "branch": "master"
52
+ "branches": [
53
+ "master"
54
+ ]
65
55
  },
66
56
  "engines": {
67
57
  "node": ">=14.16"