m-bus-parser-wasm-pack 0.4.2 → 0.5.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.
package/README.md CHANGED
@@ -18,7 +18,8 @@ Browser bindings for the wired and wireless M-Bus parser.
18
18
  import init, { m_bus_decode, m_bus_highlight, m_bus_render } from 'm-bus-parser-wasm-pack'
19
19
 
20
20
  await init()
21
- const decoded = m_bus_decode('68 3D 3D 68 ...')
22
- const narrowTable = m_bus_render('68 3D 3D 68 ...', 'table', undefined, 48)
21
+ const telegram = '68 3D 3D 68 08 01 72 00 51 20 02 82 4D 02 04 00 88 00 00 04 07 00 00 00 00 0C 15 03 00 00 00 0B 2E 00 00 00 0B 3B 00 00 00 0A 5A 88 12 0A 5E 16 05 0B 61 23 77 00 02 6C 8C 11 02 27 37 0D 0F 60 00 67 16'
22
+ const decoded = m_bus_decode(telegram)
23
+ const narrowTable = m_bus_render(telegram, 'table', undefined, 48)
23
24
  const highlighted = m_bus_highlight(JSON.stringify(decoded, null, 2), 'json')
24
25
  ```
@@ -1,29 +1,23 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
-
3
+ export function version(): string;
4
+ /**
5
+ * Highlight JSON, YAML, CSV, XML, or plaintext with the bundled Rust grammar set.
6
+ */
7
+ export function m_bus_highlight(source: string, language: string): string;
4
8
  /**
5
9
  * Decode into the canonical schema as a native JavaScript object.
6
10
  */
7
11
  export function m_bus_decode(data: string, key_hex?: string | null, include_enrichment?: boolean | null): any;
8
-
9
12
  /**
10
- * Highlight JSON, YAML, CSV, XML, or plaintext with the bundled Rust grammar set.
13
+ * Render with the shared Rust/Python/CLI output contract.
11
14
  */
12
- export function m_bus_highlight(source: string, language: string): string;
13
-
15
+ export function m_bus_render(data: string, format: string, key_hex?: string | null, width?: number | null, include_enrichment?: boolean | null): string;
14
16
  /**
15
17
  * Compatibility wrapper returning errors as text. Prefer `m_bus_render`.
16
18
  */
17
19
  export function m_bus_parse(data: string, format: string): string;
18
-
19
20
  /**
20
21
  * Compatibility wrapper returning errors as text. Prefer `m_bus_render`.
21
22
  */
22
23
  export function m_bus_parse_with_key(data: string, format: string, key_hex: string): string;
23
-
24
- /**
25
- * Render with the shared Rust/Python/CLI output contract.
26
- */
27
- export function m_bus_render(data: string, format: string, key_hex?: string | null, width?: number | null, include_enrichment?: boolean | null): string;
28
-
29
- export function version(): string;
@@ -1,9 +1,5 @@
1
- /* @ts-self-types="./m_bus_parser_wasm_pack.d.ts" */
2
1
  import * as wasm from "./m_bus_parser_wasm_pack_bg.wasm";
2
+ export * from "./m_bus_parser_wasm_pack_bg.js";
3
3
  import { __wbg_set_wasm } from "./m_bus_parser_wasm_pack_bg.js";
4
-
5
4
  __wbg_set_wasm(wasm);
6
5
  wasm.__wbindgen_start();
7
- export {
8
- m_bus_decode, m_bus_highlight, m_bus_parse, m_bus_parse_with_key, m_bus_render, version
9
- } from "./m_bus_parser_wasm_pack_bg.js";
@@ -1,22 +1,135 @@
1
+ let wasm;
2
+ export function __wbg_set_wasm(val) {
3
+ wasm = val;
4
+ }
5
+
6
+
7
+ let WASM_VECTOR_LEN = 0;
8
+
9
+ let cachedUint8ArrayMemory0 = null;
10
+
11
+ function getUint8ArrayMemory0() {
12
+ if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
13
+ cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
14
+ }
15
+ return cachedUint8ArrayMemory0;
16
+ }
17
+
18
+ const lTextEncoder = typeof TextEncoder === 'undefined' ? (0, module.require)('util').TextEncoder : TextEncoder;
19
+
20
+ let cachedTextEncoder = new lTextEncoder('utf-8');
21
+
22
+ const encodeString = (typeof cachedTextEncoder.encodeInto === 'function'
23
+ ? function (arg, view) {
24
+ return cachedTextEncoder.encodeInto(arg, view);
25
+ }
26
+ : function (arg, view) {
27
+ const buf = cachedTextEncoder.encode(arg);
28
+ view.set(buf);
29
+ return {
30
+ read: arg.length,
31
+ written: buf.length
32
+ };
33
+ });
34
+
35
+ function passStringToWasm0(arg, malloc, realloc) {
36
+
37
+ if (realloc === undefined) {
38
+ const buf = cachedTextEncoder.encode(arg);
39
+ const ptr = malloc(buf.length, 1) >>> 0;
40
+ getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
41
+ WASM_VECTOR_LEN = buf.length;
42
+ return ptr;
43
+ }
44
+
45
+ let len = arg.length;
46
+ let ptr = malloc(len, 1) >>> 0;
47
+
48
+ const mem = getUint8ArrayMemory0();
49
+
50
+ let offset = 0;
51
+
52
+ for (; offset < len; offset++) {
53
+ const code = arg.charCodeAt(offset);
54
+ if (code > 0x7F) break;
55
+ mem[ptr + offset] = code;
56
+ }
57
+
58
+ if (offset !== len) {
59
+ if (offset !== 0) {
60
+ arg = arg.slice(offset);
61
+ }
62
+ ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
63
+ const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
64
+ const ret = encodeString(arg, view);
65
+
66
+ offset += ret.written;
67
+ ptr = realloc(ptr, len, offset, 1) >>> 0;
68
+ }
69
+
70
+ WASM_VECTOR_LEN = offset;
71
+ return ptr;
72
+ }
73
+
74
+ let cachedDataViewMemory0 = null;
75
+
76
+ function getDataViewMemory0() {
77
+ if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
78
+ cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
79
+ }
80
+ return cachedDataViewMemory0;
81
+ }
82
+
83
+ const lTextDecoder = typeof TextDecoder === 'undefined' ? (0, module.require)('util').TextDecoder : TextDecoder;
84
+
85
+ let cachedTextDecoder = new lTextDecoder('utf-8', { ignoreBOM: true, fatal: true });
86
+
87
+ cachedTextDecoder.decode();
88
+
89
+ function getStringFromWasm0(ptr, len) {
90
+ ptr = ptr >>> 0;
91
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
92
+ }
93
+
94
+ function addToExternrefTable0(obj) {
95
+ const idx = wasm.__externref_table_alloc();
96
+ wasm.__wbindgen_export_4.set(idx, obj);
97
+ return idx;
98
+ }
99
+
100
+ function handleError(f, args) {
101
+ try {
102
+ return f.apply(this, args);
103
+ } catch (e) {
104
+ const idx = addToExternrefTable0(e);
105
+ wasm.__wbindgen_exn_store(idx);
106
+ }
107
+ }
108
+
109
+ function isLikeNone(x) {
110
+ return x === undefined || x === null;
111
+ }
1
112
  /**
2
- * Decode into the canonical schema as a native JavaScript object.
3
- * @param {string} data
4
- * @param {string | null} [key_hex]
5
- * @param {boolean | null} [include_enrichment]
6
- * @returns {any}
113
+ * @returns {string}
7
114
  */
8
- export function m_bus_decode(data, key_hex, include_enrichment) {
9
- const ptr0 = passStringToWasm0(data, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
10
- const len0 = WASM_VECTOR_LEN;
11
- var ptr1 = isLikeNone(key_hex) ? 0 : passStringToWasm0(key_hex, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
12
- var len1 = WASM_VECTOR_LEN;
13
- const ret = wasm.m_bus_decode(ptr0, len0, ptr1, len1, isLikeNone(include_enrichment) ? 0xFFFFFF : include_enrichment ? 1 : 0);
14
- if (ret[2]) {
15
- throw takeFromExternrefTable0(ret[1]);
115
+ export function version() {
116
+ let deferred1_0;
117
+ let deferred1_1;
118
+ try {
119
+ const ret = wasm.version();
120
+ deferred1_0 = ret[0];
121
+ deferred1_1 = ret[1];
122
+ return getStringFromWasm0(ret[0], ret[1]);
123
+ } finally {
124
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
16
125
  }
17
- return takeFromExternrefTable0(ret[0]);
18
126
  }
19
127
 
128
+ function takeFromExternrefTable0(idx) {
129
+ const value = wasm.__wbindgen_export_4.get(idx);
130
+ wasm.__externref_table_dealloc(idx);
131
+ return value;
132
+ }
20
133
  /**
21
134
  * Highlight JSON, YAML, CSV, XML, or plaintext with the bundled Rust grammar set.
22
135
  * @param {string} source
@@ -46,6 +159,59 @@ export function m_bus_highlight(source, language) {
46
159
  }
47
160
  }
48
161
 
162
+ /**
163
+ * Decode into the canonical schema as a native JavaScript object.
164
+ * @param {string} data
165
+ * @param {string | null} [key_hex]
166
+ * @param {boolean | null} [include_enrichment]
167
+ * @returns {any}
168
+ */
169
+ export function m_bus_decode(data, key_hex, include_enrichment) {
170
+ const ptr0 = passStringToWasm0(data, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
171
+ const len0 = WASM_VECTOR_LEN;
172
+ var ptr1 = isLikeNone(key_hex) ? 0 : passStringToWasm0(key_hex, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
173
+ var len1 = WASM_VECTOR_LEN;
174
+ const ret = wasm.m_bus_decode(ptr0, len0, ptr1, len1, isLikeNone(include_enrichment) ? 0xFFFFFF : include_enrichment ? 1 : 0);
175
+ if (ret[2]) {
176
+ throw takeFromExternrefTable0(ret[1]);
177
+ }
178
+ return takeFromExternrefTable0(ret[0]);
179
+ }
180
+
181
+ /**
182
+ * Render with the shared Rust/Python/CLI output contract.
183
+ * @param {string} data
184
+ * @param {string} format
185
+ * @param {string | null} [key_hex]
186
+ * @param {number | null} [width]
187
+ * @param {boolean | null} [include_enrichment]
188
+ * @returns {string}
189
+ */
190
+ export function m_bus_render(data, format, key_hex, width, include_enrichment) {
191
+ let deferred5_0;
192
+ let deferred5_1;
193
+ try {
194
+ const ptr0 = passStringToWasm0(data, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
195
+ const len0 = WASM_VECTOR_LEN;
196
+ const ptr1 = passStringToWasm0(format, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
197
+ const len1 = WASM_VECTOR_LEN;
198
+ var ptr2 = isLikeNone(key_hex) ? 0 : passStringToWasm0(key_hex, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
199
+ var len2 = WASM_VECTOR_LEN;
200
+ const ret = wasm.m_bus_render(ptr0, len0, ptr1, len1, ptr2, len2, isLikeNone(width) ? 0x100000001 : (width) >>> 0, isLikeNone(include_enrichment) ? 0xFFFFFF : include_enrichment ? 1 : 0);
201
+ var ptr4 = ret[0];
202
+ var len4 = ret[1];
203
+ if (ret[3]) {
204
+ ptr4 = 0; len4 = 0;
205
+ throw takeFromExternrefTable0(ret[2]);
206
+ }
207
+ deferred5_0 = ptr4;
208
+ deferred5_1 = len4;
209
+ return getStringFromWasm0(ptr4, len4);
210
+ } finally {
211
+ wasm.__wbindgen_free(deferred5_0, deferred5_1, 1);
212
+ }
213
+ }
214
+
49
215
  /**
50
216
  * Compatibility wrapper returning errors as text. Prefer `m_bus_render`.
51
217
  * @param {string} data
@@ -95,260 +261,112 @@ export function m_bus_parse_with_key(data, format, key_hex) {
95
261
  }
96
262
  }
97
263
 
98
- /**
99
- * Render with the shared Rust/Python/CLI output contract.
100
- * @param {string} data
101
- * @param {string} format
102
- * @param {string | null} [key_hex]
103
- * @param {number | null} [width]
104
- * @param {boolean | null} [include_enrichment]
105
- * @returns {string}
106
- */
107
- export function m_bus_render(data, format, key_hex, width, include_enrichment) {
108
- let deferred5_0;
109
- let deferred5_1;
110
- try {
111
- const ptr0 = passStringToWasm0(data, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
112
- const len0 = WASM_VECTOR_LEN;
113
- const ptr1 = passStringToWasm0(format, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
114
- const len1 = WASM_VECTOR_LEN;
115
- var ptr2 = isLikeNone(key_hex) ? 0 : passStringToWasm0(key_hex, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
116
- var len2 = WASM_VECTOR_LEN;
117
- const ret = wasm.m_bus_render(ptr0, len0, ptr1, len1, ptr2, len2, isLikeNone(width) ? Number.MAX_SAFE_INTEGER : (width) >>> 0, isLikeNone(include_enrichment) ? 0xFFFFFF : include_enrichment ? 1 : 0);
118
- var ptr4 = ret[0];
119
- var len4 = ret[1];
120
- if (ret[3]) {
121
- ptr4 = 0; len4 = 0;
122
- throw takeFromExternrefTable0(ret[2]);
123
- }
124
- deferred5_0 = ptr4;
125
- deferred5_1 = len4;
126
- return getStringFromWasm0(ptr4, len4);
127
- } finally {
128
- wasm.__wbindgen_free(deferred5_0, deferred5_1, 1);
129
- }
130
- }
131
-
132
- /**
133
- * @returns {string}
134
- */
135
- export function version() {
136
- let deferred1_0;
137
- let deferred1_1;
138
- try {
139
- const ret = wasm.version();
140
- deferred1_0 = ret[0];
141
- deferred1_1 = ret[1];
142
- return getStringFromWasm0(ret[0], ret[1]);
143
- } finally {
144
- wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
145
- }
146
- }
147
- export function __wbg_Error_408e67f47ca7b58b(arg0, arg1) {
148
- const ret = Error(getStringFromWasm0(arg0, arg1));
149
- return ret;
150
- }
151
- export function __wbg_String_8564e559799eccda(arg0, arg1) {
264
+ export function __wbg_String_8f0eb39a4a4c2f66(arg0, arg1) {
152
265
  const ret = String(arg1);
153
266
  const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
154
267
  const len1 = WASM_VECTOR_LEN;
155
268
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
156
269
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
157
- }
158
- export function __wbg___wbindgen_is_string_e6f02f0ea5f20a32(arg0) {
159
- const ret = typeof(arg0) === 'string';
270
+ };
271
+
272
+ export function __wbg_new_405e22f390576ce2() {
273
+ const ret = new Object();
160
274
  return ret;
161
- }
162
- export function __wbg___wbindgen_string_get_d154f1e671052120(arg0, arg1) {
163
- const obj = arg1;
164
- const ret = typeof(obj) === 'string' ? obj : undefined;
165
- var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
166
- var len1 = WASM_VECTOR_LEN;
167
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
168
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
169
- }
170
- export function __wbg___wbindgen_throw_bb96b2010945f0bc(arg0, arg1) {
171
- throw new Error(getStringFromWasm0(arg0, arg1));
172
- }
173
- export function __wbg_new_116be93542d39019() {
275
+ };
276
+
277
+ export function __wbg_new_5e0be73521bc8c17() {
278
+ const ret = new Map();
279
+ return ret;
280
+ };
281
+
282
+ export function __wbg_new_78feb108b6472713() {
174
283
  const ret = new Array();
175
284
  return ret;
176
- }
177
- export function __wbg_new_358857d90afd5a2d(arg0, arg1) {
285
+ };
286
+
287
+ export function __wbg_new_c68d7209be747379(arg0, arg1) {
178
288
  const ret = new Error(getStringFromWasm0(arg0, arg1));
179
289
  return ret;
180
- }
181
- export function __wbg_new_cdf041679ded4c5f() {
182
- const ret = new Map();
183
- return ret;
184
- }
185
- export function __wbg_new_ebe3e0f6837f0879() {
186
- const ret = new Object();
187
- return ret;
188
- }
189
- export function __wbg_set_014226dfeca53178(arg0, arg1, arg2) {
290
+ };
291
+
292
+ export function __wbg_set_37837023f3d740e8(arg0, arg1, arg2) {
293
+ arg0[arg1 >>> 0] = arg2;
294
+ };
295
+
296
+ export function __wbg_set_3f1d0b984ed272ed(arg0, arg1, arg2) {
297
+ arg0[arg1] = arg2;
298
+ };
299
+
300
+ export function __wbg_set_8fc6bf8a5b1071d1(arg0, arg1, arg2) {
190
301
  const ret = arg0.set(arg1, arg2);
191
302
  return ret;
192
- }
193
- export function __wbg_set_6be42768c690e380(arg0, arg1, arg2) {
194
- arg0[arg1] = arg2;
195
- }
196
- export function __wbg_set_8155bb79a948541b() { return handleError(function (arg0, arg1, arg2) {
303
+ };
304
+
305
+ export function __wbg_set_bb8cecf6a62b9f46() { return handleError(function (arg0, arg1, arg2) {
197
306
  const ret = Reflect.set(arg0, arg1, arg2);
198
307
  return ret;
199
- }, arguments); }
200
- export function __wbg_set_a80955eb93b145c6(arg0, arg1, arg2) {
201
- arg0[arg1 >>> 0] = arg2;
202
- }
203
- export function __wbg_set_name_7a2a05b77a392440(arg0, arg1, arg2) {
308
+ }, arguments) };
309
+
310
+ export function __wbg_setname_6df54b7ebf9404a9(arg0, arg1, arg2) {
204
311
  arg0.name = getStringFromWasm0(arg1, arg2);
205
- }
206
- export function __wbg_stringify_f93a4ebae9231922() { return handleError(function (arg0) {
312
+ };
313
+
314
+ export function __wbg_stringify_f7ed6987935b4a24() { return handleError(function (arg0) {
207
315
  const ret = JSON.stringify(arg0);
208
316
  return ret;
209
- }, arguments); }
210
- export function __wbindgen_cast_0000000000000001(arg0) {
211
- // Cast intrinsic for `F64 -> Externref`.
212
- const ret = arg0;
213
- return ret;
214
- }
215
- export function __wbindgen_cast_0000000000000002(arg0) {
216
- // Cast intrinsic for `I64 -> Externref`.
317
+ }, arguments) };
318
+
319
+ export function __wbindgen_bigint_from_i64(arg0) {
217
320
  const ret = arg0;
218
321
  return ret;
219
- }
220
- export function __wbindgen_cast_0000000000000003(arg0, arg1) {
221
- // Cast intrinsic for `Ref(String) -> Externref`.
222
- const ret = getStringFromWasm0(arg0, arg1);
223
- return ret;
224
- }
225
- export function __wbindgen_cast_0000000000000004(arg0) {
226
- // Cast intrinsic for `U64 -> Externref`.
322
+ };
323
+
324
+ export function __wbindgen_bigint_from_u64(arg0) {
227
325
  const ret = BigInt.asUintN(64, arg0);
228
326
  return ret;
229
- }
327
+ };
328
+
329
+ export function __wbindgen_error_new(arg0, arg1) {
330
+ const ret = new Error(getStringFromWasm0(arg0, arg1));
331
+ return ret;
332
+ };
333
+
230
334
  export function __wbindgen_init_externref_table() {
231
- const table = wasm.__wbindgen_externrefs;
335
+ const table = wasm.__wbindgen_export_4;
232
336
  const offset = table.grow(4);
233
337
  table.set(0, undefined);
234
338
  table.set(offset + 0, undefined);
235
339
  table.set(offset + 1, null);
236
340
  table.set(offset + 2, true);
237
341
  table.set(offset + 3, false);
238
- }
239
- function addToExternrefTable0(obj) {
240
- const idx = wasm.__externref_table_alloc();
241
- wasm.__wbindgen_externrefs.set(idx, obj);
242
- return idx;
243
- }
342
+ ;
343
+ };
244
344
 
245
- let cachedDataViewMemory0 = null;
246
- function getDataViewMemory0() {
247
- if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
248
- cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
249
- }
250
- return cachedDataViewMemory0;
251
- }
252
-
253
- function getStringFromWasm0(ptr, len) {
254
- return decodeText(ptr >>> 0, len);
255
- }
256
-
257
- let cachedUint8ArrayMemory0 = null;
258
- function getUint8ArrayMemory0() {
259
- if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
260
- cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
261
- }
262
- return cachedUint8ArrayMemory0;
263
- }
264
-
265
- function handleError(f, args) {
266
- try {
267
- return f.apply(this, args);
268
- } catch (e) {
269
- const idx = addToExternrefTable0(e);
270
- wasm.__wbindgen_exn_store(idx);
271
- }
272
- }
273
-
274
- function isLikeNone(x) {
275
- return x === undefined || x === null;
276
- }
277
-
278
- function passStringToWasm0(arg, malloc, realloc) {
279
- if (realloc === undefined) {
280
- const buf = cachedTextEncoder.encode(arg);
281
- const ptr = malloc(buf.length, 1) >>> 0;
282
- getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
283
- WASM_VECTOR_LEN = buf.length;
284
- return ptr;
285
- }
286
-
287
- let len = arg.length;
288
- let ptr = malloc(len, 1) >>> 0;
289
-
290
- const mem = getUint8ArrayMemory0();
291
-
292
- let offset = 0;
293
-
294
- for (; offset < len; offset++) {
295
- const code = arg.charCodeAt(offset);
296
- if (code > 0x7F) break;
297
- mem[ptr + offset] = code;
298
- }
299
- if (offset !== len) {
300
- if (offset !== 0) {
301
- arg = arg.slice(offset);
302
- }
303
- ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
304
- const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
305
- const ret = cachedTextEncoder.encodeInto(arg, view);
306
-
307
- offset += ret.written;
308
- ptr = realloc(ptr, len, offset, 1) >>> 0;
309
- }
310
-
311
- WASM_VECTOR_LEN = offset;
312
- return ptr;
313
- }
314
-
315
- function takeFromExternrefTable0(idx) {
316
- const value = wasm.__wbindgen_externrefs.get(idx);
317
- wasm.__externref_table_dealloc(idx);
318
- return value;
319
- }
320
-
321
- let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
322
- cachedTextDecoder.decode();
323
- const MAX_SAFARI_DECODE_BYTES = 2146435072;
324
- let numBytesDecoded = 0;
325
- function decodeText(ptr, len) {
326
- numBytesDecoded += len;
327
- if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
328
- cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
329
- cachedTextDecoder.decode();
330
- numBytesDecoded = len;
331
- }
332
- return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
333
- }
345
+ export function __wbindgen_is_string(arg0) {
346
+ const ret = typeof(arg0) === 'string';
347
+ return ret;
348
+ };
334
349
 
335
- const cachedTextEncoder = new TextEncoder();
350
+ export function __wbindgen_number_new(arg0) {
351
+ const ret = arg0;
352
+ return ret;
353
+ };
336
354
 
337
- if (!('encodeInto' in cachedTextEncoder)) {
338
- cachedTextEncoder.encodeInto = function (arg, view) {
339
- const buf = cachedTextEncoder.encode(arg);
340
- view.set(buf);
341
- return {
342
- read: arg.length,
343
- written: buf.length
344
- };
345
- };
346
- }
355
+ export function __wbindgen_string_get(arg0, arg1) {
356
+ const obj = arg1;
357
+ const ret = typeof(obj) === 'string' ? obj : undefined;
358
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
359
+ var len1 = WASM_VECTOR_LEN;
360
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
361
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
362
+ };
347
363
 
348
- let WASM_VECTOR_LEN = 0;
364
+ export function __wbindgen_string_new(arg0, arg1) {
365
+ const ret = getStringFromWasm0(arg0, arg1);
366
+ return ret;
367
+ };
349
368
 
369
+ export function __wbindgen_throw(arg0, arg1) {
370
+ throw new Error(getStringFromWasm0(arg0, arg1));
371
+ };
350
372
 
351
- let wasm;
352
- export function __wbg_set_wasm(val) {
353
- wasm = val;
354
- }
Binary file
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "Michael Aebli"
6
6
  ],
7
7
  "description": "A wasm-pack to use the library for parsing M-Bus frames",
8
- "version": "0.4.2",
8
+ "version": "0.5.0",
9
9
  "license": "MIT",
10
10
  "repository": {
11
11
  "type": "git",