@quentinadam/base64 0.1.4 → 0.1.5

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 (2) hide show
  1. package/dist/base64.js +3 -3
  2. package/package.json +3 -3
package/dist/base64.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import assert from '@quentinadam/assert';
2
- import require from '@quentinadam/require';
2
+ import ensure from '@quentinadam/ensure';
3
3
  function convert({ input, inputBase, outputBase, convertRemainingBits }) {
4
4
  const output = new Array();
5
5
  let accumulator = 0;
@@ -48,7 +48,7 @@ export function encode(buffer, options) {
48
48
  output.push(64);
49
49
  }
50
50
  }
51
- return output.map((digit) => require(alphabet[digit])).join('');
51
+ return output.map((digit) => ensure(alphabet[digit])).join('');
52
52
  }
53
53
  /**
54
54
  * Decodes a base64 encoded string into a Uint8Array buffer.
@@ -60,6 +60,6 @@ export function encode(buffer, options) {
60
60
  export function decode(string, options) {
61
61
  const alphabet = getAlphabet(options?.alphabet);
62
62
  const map = new Map(Array.from(alphabet).map((character, index) => [character, index]));
63
- const input = Array.from(string, (character) => require(map.get(character), `Invalid character ${character}`));
63
+ const input = Array.from(string, (character) => ensure(map.get(character), `Invalid character ${character}`));
64
64
  return new Uint8Array(convert({ input, inputBase: 6, outputBase: 8, convertRemainingBits: false }));
65
65
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quentinadam/base64",
3
- "version": "0.1.4",
3
+ "version": "0.1.5",
4
4
  "description": "A simple library to encode and decode base64 strings",
5
5
  "license": "MIT",
6
6
  "author": "Quentin Adam",
@@ -15,7 +15,7 @@
15
15
  "README.md"
16
16
  ],
17
17
  "dependencies": {
18
- "@quentinadam/assert": "^0.1.10",
19
- "@quentinadam/require": "^0.1.4"
18
+ "@quentinadam/assert": "^0.1.11",
19
+ "@quentinadam/ensure": "^0.1.0"
20
20
  }
21
21
  }