@ctrl/ts-base32 2.1.1 → 2.1.3

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.
@@ -1,4 +1,4 @@
1
- declare type Variant = 'RFC3548' | 'RFC4648' | 'RFC4648-HEX' | 'Crockford';
1
+ type Variant = 'RFC3548' | 'RFC4648' | 'RFC4648-HEX' | 'Crockford';
2
2
  export declare function base32Encode(buffer: ArrayBuffer, variant?: Variant, options?: Partial<{
3
3
  padding: boolean;
4
4
  }>): string;
package/dist/src/index.js CHANGED
@@ -21,7 +21,7 @@ export function base32Encode(buffer, variant = 'RFC4648', options = {}) {
21
21
  default:
22
22
  throw new Error(`Unknown base32 variant: ${variant}`);
23
23
  }
24
- const padding = options.padding === undefined ? defaultPadding : options.padding;
24
+ const padding = options.padding ?? defaultPadding;
25
25
  const length = buffer.byteLength;
26
26
  const view = new Uint8Array(buffer);
27
27
  let bits = 0;
@@ -59,13 +59,11 @@ export function base32Decode(input, variant = 'RFC4648') {
59
59
  case 'RFC3548':
60
60
  case 'RFC4648':
61
61
  alphabet = RFC4648;
62
- // eslint-disable-next-line no-useless-escape
63
- cleanedInput = input.toUpperCase().replace(/\=+$/, '');
62
+ cleanedInput = input.toUpperCase().replace(/=+$/, '');
64
63
  break;
65
64
  case 'RFC4648-HEX':
66
65
  alphabet = RFC4648_HEX;
67
- // eslint-disable-next-line no-useless-escape
68
- cleanedInput = input.toUpperCase().replace(/\=+$/, '');
66
+ cleanedInput = input.toUpperCase().replace(/=+$/, '');
69
67
  break;
70
68
  case 'Crockford':
71
69
  alphabet = CROCKFORD;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ctrl/ts-base32",
3
- "version": "2.1.1",
3
+ "version": "2.1.3",
4
4
  "description": "Base32 encoder/decoder with support for multiple variants",
5
5
  "author": "Scott Cooper <scttcper@gmail.com>",
6
6
  "license": "MIT",
@@ -21,56 +21,37 @@
21
21
  ],
22
22
  "sideEffects": false,
23
23
  "scripts": {
24
- "demo:build": "rollup -c rollup.demo.js",
25
- "demo:watch": "rollup -c rollup.demo.js -w",
24
+ "demo:build": "npm run build --workspace=demo",
25
+ "demo:watch": "npm run dev --workspace=demo",
26
26
  "lint": "eslint --ext .ts .",
27
27
  "lint:fix": "eslint --fix --ext .ts .",
28
28
  "prepare": "npm run build",
29
29
  "build": "tsc",
30
- "test": "jest",
31
- "test:watch": "jest --watch",
32
- "test:ci": "jest --ci --reporters=default --reporters=jest-junit --coverage"
30
+ "test": "vitest run",
31
+ "test:watch": "vitest",
32
+ "test:ci": "vitest run --coverage --reporter=junit --outputFile=./junit.xml"
33
33
  },
34
34
  "devDependencies": {
35
- "@ctrl/eslint-config": "2.0.9",
36
- "@jest/globals": "27.0.6",
37
- "@sindresorhus/tsconfig": "1.0.2",
38
- "@types/node": "16.4.3",
35
+ "@ctrl/eslint-config": "3.7.0",
36
+ "@sindresorhus/tsconfig": "3.0.1",
37
+ "@types/node": "20.1.0",
38
+ "@vitest/coverage-c8": "0.31.0",
39
39
  "buffer": "6.0.3",
40
- "jest": "27.0.6",
41
- "jest-junit": "12.2.0",
42
- "rollup": "2.54.0",
43
- "rollup-plugin-livereload": "2.0.5",
44
- "rollup-plugin-node-builtins": "2.1.2",
45
- "rollup-plugin-node-globals": "1.4.0",
46
- "rollup-plugin-serve": "1.1.0",
47
- "rollup-plugin-terser": "7.0.2",
48
- "rollup-plugin-typescript2": "0.30.0",
49
- "ts-jest": "27.0.4",
50
- "typescript": "4.3.5"
51
- },
52
- "jest": {
53
- "testEnvironment": "node",
54
- "collectCoverageFrom": [
55
- "src/**/**.ts"
56
- ],
57
- "testMatch": [
58
- "**/test/**/**.spec.ts"
59
- ],
60
- "coverageProvider": "v8",
61
- "preset": "ts-jest/presets/default-esm",
62
- "globals": {
63
- "ts-jest": {
64
- "useESM": true,
65
- "isolatedModules": true
66
- }
67
- }
40
+ "c8": "7.13.0",
41
+ "typescript": "5.0.4",
42
+ "vitest": "0.31.0"
68
43
  },
44
+ "workspaces": [
45
+ "demo"
46
+ ],
69
47
  "publishConfig": {
70
- "access": "public"
48
+ "access": "public",
49
+ "provenance": true
71
50
  },
72
51
  "release": {
73
- "branch": "master"
52
+ "branches": [
53
+ "master"
54
+ ]
74
55
  },
75
56
  "engines": {
76
57
  "node": ">=14.16"