wpd-codec 3.0.9 → 3.1.0

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,6 +1,7 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_stream_character_sets = require("./character-sets.cjs");
2
3
  //#region src/stream/characters.ts
3
- const DEFAULT_EXTENDED_INTERNATIONAL = [
4
+ const SINGLE_BYTE_SHORTHAND = new Map([
4
5
  [
5
6
  1,
6
7
  35,
@@ -161,9 +162,7 @@ const DEFAULT_EXTENDED_INTERNATIONAL = [
161
162
  23,
162
163
  "ß"
163
164
  ]
164
- ];
165
- const SINGLE_BYTE_SHORTHAND = new Map(DEFAULT_EXTENDED_INTERNATIONAL.map(([byteValue, , glyph]) => [byteValue, glyph]));
166
- const CHARACTER_SET_MULTINATIONAL_1 = new Map(DEFAULT_EXTENDED_INTERNATIONAL.map(([, characterNumber, glyph]) => [characterNumber, glyph]));
165
+ ].map(([byteValue, , glyph]) => [byteValue, glyph]));
167
166
  const FIRST_ASCII_CHARACTER = 33;
168
167
  const LAST_CHARACTER = 127;
169
168
  const UNMAPPED_CHARACTER = "�";
@@ -173,7 +172,7 @@ function decodeAsciiSet(characterNumber) {
173
172
  }
174
173
  function decodeWpCharacter(characterSet, characterNumber) {
175
174
  if (characterSet === 0) return decodeAsciiSet(characterNumber);
176
- if (characterSet === 1) return CHARACTER_SET_MULTINATIONAL_1.get(characterNumber);
175
+ return require_stream_character_sets.WP6_CHARACTER_SETS.get(characterSet)?.get(characterNumber);
177
176
  }
178
177
  function decodeSingleByteCharacter(byte) {
179
178
  const shorthand = SINGLE_BYTE_SHORTHAND.get(byte);
@@ -1,5 +1,6 @@
1
+ import { WP6_CHARACTER_SETS } from "./character-sets.js";
1
2
  //#region src/stream/characters.ts
2
- const DEFAULT_EXTENDED_INTERNATIONAL = [
3
+ const SINGLE_BYTE_SHORTHAND = new Map([
3
4
  [
4
5
  1,
5
6
  35,
@@ -160,9 +161,7 @@ const DEFAULT_EXTENDED_INTERNATIONAL = [
160
161
  23,
161
162
  "ß"
162
163
  ]
163
- ];
164
- const SINGLE_BYTE_SHORTHAND = new Map(DEFAULT_EXTENDED_INTERNATIONAL.map(([byteValue, , glyph]) => [byteValue, glyph]));
165
- const CHARACTER_SET_MULTINATIONAL_1 = new Map(DEFAULT_EXTENDED_INTERNATIONAL.map(([, characterNumber, glyph]) => [characterNumber, glyph]));
164
+ ].map(([byteValue, , glyph]) => [byteValue, glyph]));
166
165
  const FIRST_ASCII_CHARACTER = 33;
167
166
  const LAST_CHARACTER = 127;
168
167
  const UNMAPPED_CHARACTER = "�";
@@ -172,7 +171,7 @@ function decodeAsciiSet(characterNumber) {
172
171
  }
173
172
  function decodeWpCharacter(characterSet, characterNumber) {
174
173
  if (characterSet === 0) return decodeAsciiSet(characterNumber);
175
- if (characterSet === 1) return CHARACTER_SET_MULTINATIONAL_1.get(characterNumber);
174
+ return WP6_CHARACTER_SETS.get(characterSet)?.get(characterNumber);
176
175
  }
177
176
  function decodeSingleByteCharacter(byte) {
178
177
  const shorthand = SINGLE_BYTE_SHORTHAND.get(byte);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wpd-codec",
3
- "version": "3.0.9",
3
+ "version": "3.1.0",
4
4
  "description": "Hand-written read-only WordPerfect 6.x-X6 (.wpd) reader over document-schema.js's ContentDocument",
5
5
  "type": "module",
6
6
  "repository": {