rregex 1.10.6 → 1.10.8

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,1213 +0,0 @@
1
- let wasm;
2
- export function __wbg_set_wasm(val) {
3
- wasm = val;
4
- }
5
-
6
-
7
- const lTextDecoder = typeof TextDecoder === 'undefined' ? (0, module.require)('util').TextDecoder : TextDecoder;
8
-
9
- let cachedTextDecoder = new lTextDecoder('utf-8', { ignoreBOM: true, fatal: true });
10
-
11
- cachedTextDecoder.decode();
12
-
13
- let cachedUint8Memory0 = null;
14
-
15
- function getUint8Memory0() {
16
- if (cachedUint8Memory0 === null || cachedUint8Memory0.byteLength === 0) {
17
- cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer);
18
- }
19
- return cachedUint8Memory0;
20
- }
21
-
22
- function getStringFromWasm0(ptr, len) {
23
- ptr = ptr >>> 0;
24
- return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
25
- }
26
-
27
- const heap = new Array(128).fill(undefined);
28
-
29
- heap.push(undefined, null, true, false);
30
-
31
- let heap_next = heap.length;
32
-
33
- function addHeapObject(obj) {
34
- if (heap_next === heap.length) heap.push(heap.length + 1);
35
- const idx = heap_next;
36
- heap_next = heap[idx];
37
-
38
- heap[idx] = obj;
39
- return idx;
40
- }
41
-
42
- function getObject(idx) { return heap[idx]; }
43
-
44
- function dropObject(idx) {
45
- if (idx < 132) return;
46
- heap[idx] = heap_next;
47
- heap_next = idx;
48
- }
49
-
50
- function takeObject(idx) {
51
- const ret = getObject(idx);
52
- dropObject(idx);
53
- return ret;
54
- }
55
-
56
- let WASM_VECTOR_LEN = 0;
57
-
58
- const lTextEncoder = typeof TextEncoder === 'undefined' ? (0, module.require)('util').TextEncoder : TextEncoder;
59
-
60
- let cachedTextEncoder = new lTextEncoder('utf-8');
61
-
62
- const encodeString = (typeof cachedTextEncoder.encodeInto === 'function'
63
- ? function (arg, view) {
64
- return cachedTextEncoder.encodeInto(arg, view);
65
- }
66
- : function (arg, view) {
67
- const buf = cachedTextEncoder.encode(arg);
68
- view.set(buf);
69
- return {
70
- read: arg.length,
71
- written: buf.length
72
- };
73
- });
74
-
75
- function passStringToWasm0(arg, malloc, realloc) {
76
-
77
- if (realloc === undefined) {
78
- const buf = cachedTextEncoder.encode(arg);
79
- const ptr = malloc(buf.length, 1) >>> 0;
80
- getUint8Memory0().subarray(ptr, ptr + buf.length).set(buf);
81
- WASM_VECTOR_LEN = buf.length;
82
- return ptr;
83
- }
84
-
85
- let len = arg.length;
86
- let ptr = malloc(len, 1) >>> 0;
87
-
88
- const mem = getUint8Memory0();
89
-
90
- let offset = 0;
91
-
92
- for (; offset < len; offset++) {
93
- const code = arg.charCodeAt(offset);
94
- if (code > 0x7F) break;
95
- mem[ptr + offset] = code;
96
- }
97
-
98
- if (offset !== len) {
99
- if (offset !== 0) {
100
- arg = arg.slice(offset);
101
- }
102
- ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
103
- const view = getUint8Memory0().subarray(ptr + offset, ptr + len);
104
- const ret = encodeString(arg, view);
105
-
106
- offset += ret.written;
107
- ptr = realloc(ptr, len, offset, 1) >>> 0;
108
- }
109
-
110
- WASM_VECTOR_LEN = offset;
111
- return ptr;
112
- }
113
-
114
- function isLikeNone(x) {
115
- return x === undefined || x === null;
116
- }
117
-
118
- let cachedInt32Memory0 = null;
119
-
120
- function getInt32Memory0() {
121
- if (cachedInt32Memory0 === null || cachedInt32Memory0.byteLength === 0) {
122
- cachedInt32Memory0 = new Int32Array(wasm.memory.buffer);
123
- }
124
- return cachedInt32Memory0;
125
- }
126
-
127
- let cachedUint32Memory0 = null;
128
-
129
- function getUint32Memory0() {
130
- if (cachedUint32Memory0 === null || cachedUint32Memory0.byteLength === 0) {
131
- cachedUint32Memory0 = new Uint32Array(wasm.memory.buffer);
132
- }
133
- return cachedUint32Memory0;
134
- }
135
-
136
- function getArrayJsValueFromWasm0(ptr, len) {
137
- ptr = ptr >>> 0;
138
- const mem = getUint32Memory0();
139
- const slice = mem.subarray(ptr / 4, ptr / 4 + len);
140
- const result = [];
141
- for (let i = 0; i < slice.length; i++) {
142
- result.push(takeObject(slice[i]));
143
- }
144
- return result;
145
- }
146
-
147
- let stack_pointer = 128;
148
-
149
- function addBorrowedObject(obj) {
150
- if (stack_pointer == 1) throw new Error('out of js stack');
151
- heap[--stack_pointer] = obj;
152
- return stack_pointer;
153
- }
154
- /**
155
- * Escapes all regular expression meta characters in `text`.
156
- *
157
- * The string returned may be safely used as a literal in a regular
158
- * expression.
159
- * @param {string} text
160
- * @returns {string}
161
- */
162
- export function escape(text) {
163
- let deferred2_0;
164
- let deferred2_1;
165
- try {
166
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
167
- const ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
168
- const len0 = WASM_VECTOR_LEN;
169
- wasm.escape(retptr, ptr0, len0);
170
- var r0 = getInt32Memory0()[retptr / 4 + 0];
171
- var r1 = getInt32Memory0()[retptr / 4 + 1];
172
- deferred2_0 = r0;
173
- deferred2_1 = r1;
174
- return getStringFromWasm0(r0, r1);
175
- } finally {
176
- wasm.__wbindgen_add_to_stack_pointer(16);
177
- wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
178
- }
179
- }
180
-
181
- function handleError(f, args) {
182
- try {
183
- return f.apply(this, args);
184
- } catch (e) {
185
- wasm.__wbindgen_exn_store(addHeapObject(e));
186
- }
187
- }
188
-
189
- const RRegexFinalization = (typeof FinalizationRegistry === 'undefined')
190
- ? { register: () => {}, unregister: () => {} }
191
- : new FinalizationRegistry(ptr => wasm.__wbg_rregex_free(ptr >>> 0));
192
- /**
193
- * A compiled regular expression for matching Unicode strings.
194
- *
195
- * A `RRegex` can be used to search haystacks, split haystacks into substrings
196
- * or replace substrings in a haystack with a different substring. All
197
- * searching is done with an implicit `(?s:.)*?` at the beginning and end of
198
- * an pattern. To force an expression to match the whole string (or a prefix
199
- * or a suffix), you must use an anchor like `^` or `$` (or `\A` and `\z`).
200
- *
201
- * While this library will handle Unicode strings (whether in the regular
202
- * expression or in the haystack), all positions returned are **byte
203
- * offsets**. Every byte offset is guaranteed to be at a Unicode code point
204
- * boundary. That is, all offsets returned by the `RRegex` API are guaranteed
205
- * to be ranges that can slice an `Uint8Array` created with a TextEncoder.
206
- *
207
- * # Example: slicing over UTF strings
208
- *
209
- * ```typescript
210
- * import { RRegex } from "rregex"
211
- *
212
- * const re = new RRegex("ä")
213
- * const m = re.find("äöü") // { start: 0, end: 2 }
214
- *
215
- * const buff = new TextEncoder().encode("äöü")
216
- * const slice = buff.slice(m.start, m.end)
217
- * expect(new TextDecoder().decode(slice)).toBe("ä")
218
- * ```
219
- *
220
- * # Example: find the offsets of a US phone number:
221
- *
222
- * ```typescript
223
- * import { RRegex } from "rregex"
224
- *
225
- * const re = new RRegex("[0-9]{3}-[0-9]{3}-[0-9]{4}");
226
- * const m = re.find("phone: 111-222-3333");
227
- * expect(m.start).toBe(7);
228
- * expect(m.end).toBe(19);
229
- * ```
230
- *
231
- * @see https://docs.rs/regex/latest/regex/
232
- */
233
- export class RRegex {
234
-
235
- __destroy_into_raw() {
236
- const ptr = this.__wbg_ptr;
237
- this.__wbg_ptr = 0;
238
- RRegexFinalization.unregister(this);
239
- return ptr;
240
- }
241
-
242
- free() {
243
- const ptr = this.__destroy_into_raw();
244
- wasm.__wbg_rregex_free(ptr);
245
- }
246
- /**
247
- * Compiles a regular expression. Once compiled, it can be used repeatedly
248
- * to search, split or replace text in a string.
249
- *
250
- * If an invalid expression is given, then an error is returned.
251
- * @param {string} re
252
- */
253
- constructor(re) {
254
- try {
255
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
256
- const ptr0 = passStringToWasm0(re, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
257
- const len0 = WASM_VECTOR_LEN;
258
- wasm.rregex_new(retptr, ptr0, len0);
259
- var r0 = getInt32Memory0()[retptr / 4 + 0];
260
- var r1 = getInt32Memory0()[retptr / 4 + 1];
261
- var r2 = getInt32Memory0()[retptr / 4 + 2];
262
- if (r2) {
263
- throw takeObject(r1);
264
- }
265
- this.__wbg_ptr = r0 >>> 0;
266
- return this;
267
- } finally {
268
- wasm.__wbindgen_add_to_stack_pointer(16);
269
- }
270
- }
271
- /**
272
- * Returns true if and only if there is a match for the regex in the
273
- * string given.
274
- *
275
- * It is recommended to use this method if all you need to do is test
276
- * a match, since the underlying matching engine may be able to do less
277
- * work.
278
- *
279
- * # Example
280
- *
281
- * Test if some text contains at least one word with exactly 13
282
- * Unicode word characters:
283
- *
284
- * ```typescript
285
- * import { RRegex } from "rregex"
286
- *
287
- * const text = "I categorically deny having triskaidekaphobia."
288
- * expect(new RRegex("\\b\\w{13}\\b").is_match(text)).toBe(true)
289
- * ```
290
- *
291
- * @see https://docs.rs/regex/latest/regex/struct.Regex.html#method.is_match
292
- * @param {string} text - The string against which to match the regular expression
293
- * @return {boolean}
294
- */
295
- isMatch(text) {
296
- const ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
297
- const len0 = WASM_VECTOR_LEN;
298
- const ret = wasm.rregex_isMatch(this.__wbg_ptr, ptr0, len0);
299
- return ret !== 0;
300
- }
301
- /**
302
- * Returns the same as is_match, but starts the search at the given offset.
303
- * The significance of the starting point is that it takes the surrounding
304
- * context into consideration. For example, the `\A` anchor can only match
305
- * when `start == 0`.
306
- *
307
- * @see https://docs.rs/regex/latest/regex/struct.Regex.html#method.is_match_at
308
- * @param {string} text - The string against which to match the regular expression
309
- * @param {number} start - Zero-based index at which to start matching
310
- * @return {boolean}
311
- */
312
- isMatchAt(text, start) {
313
- const ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
314
- const len0 = WASM_VECTOR_LEN;
315
- const ret = wasm.rregex_isMatchAt(this.__wbg_ptr, ptr0, len0, start);
316
- return ret !== 0;
317
- }
318
- /**
319
- * Returns the start and end byte range of the leftmost-first match in
320
- * `text`. If no match exists, then `undefined` is returned.
321
- *
322
- * Note that this should only be used if you want to discover the position
323
- * of the match. Testing the existence of a match is faster if you use
324
- * `isMatch`.
325
- *
326
- * # Example
327
- *
328
- * Find the start and end location of the first word with exactly 13
329
- * Unicode word characters:
330
- *
331
- * ```typescript
332
- * import { RRegex } from "rregex"
333
- *
334
- * const text = "I categorically deny having triskaidekaphobia."
335
- * const m = new RRegex("\\b\\w{13}\\b").find(text)
336
- * expect(m.start).toBe(2)
337
- * expect(m.end).toBe(15)
338
- * ```
339
- *
340
- * @see https://docs.rs/regex/latest/regex/struct.Regex.html#method.find
341
- * @param {string} text - The string against which to match the regular expression
342
- * @return {Match}
343
- */
344
- find(text) {
345
- try {
346
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
347
- const ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
348
- const len0 = WASM_VECTOR_LEN;
349
- wasm.rregex_find(retptr, this.__wbg_ptr, ptr0, len0);
350
- var r0 = getInt32Memory0()[retptr / 4 + 0];
351
- var r1 = getInt32Memory0()[retptr / 4 + 1];
352
- var r2 = getInt32Memory0()[retptr / 4 + 2];
353
- if (r2) {
354
- throw takeObject(r1);
355
- }
356
- return takeObject(r0);
357
- } finally {
358
- wasm.__wbindgen_add_to_stack_pointer(16);
359
- }
360
- }
361
- /**
362
- * Returns the same as find, but starts the search at the given
363
- * offset.
364
- *
365
- * The significance of the starting point is that it takes the surrounding
366
- * context into consideration. For example, the `\A` anchor can only
367
- * match when `start == 0`.
368
- *
369
- * @see https://docs.rs/regex/latest/regex/struct.Regex.html#method.find_at
370
- * @param {string} text - The string against which to match the regular expression
371
- * @param {number} start - Zero-based index at which to start matching
372
- * @returns {Match}
373
- */
374
- findAt(text, start) {
375
- try {
376
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
377
- const ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
378
- const len0 = WASM_VECTOR_LEN;
379
- wasm.rregex_findAt(retptr, this.__wbg_ptr, ptr0, len0, start);
380
- var r0 = getInt32Memory0()[retptr / 4 + 0];
381
- var r1 = getInt32Memory0()[retptr / 4 + 1];
382
- var r2 = getInt32Memory0()[retptr / 4 + 2];
383
- if (r2) {
384
- throw takeObject(r1);
385
- }
386
- return takeObject(r0);
387
- } finally {
388
- wasm.__wbindgen_add_to_stack_pointer(16);
389
- }
390
- }
391
- /**
392
- * Returns an array for each successive non-overlapping match in `text``,
393
- * returning the start and end byte indices with respect to `text`.
394
- *
395
- * # Example
396
- *
397
- * Find the start and end location of every word with exactly 13 Unicode
398
- * word characters:
399
- *
400
- * ```typescript
401
- * import { RRegex } from "rregex"
402
- *
403
- * const text = "Retroactively relinquishing remunerations is reprehensible."
404
- * const matches = new RRegex("\\b\\w{13}\\b").findAll(text)
405
- * ```
406
- *
407
- * @see https://docs.rs/regex/latest/regex/struct.Regex.html#method.find_iter
408
- * @param {string} text - The string against which to match the regular expression
409
- * @returns {Match}
410
- */
411
- findAll(text) {
412
- try {
413
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
414
- const ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
415
- const len0 = WASM_VECTOR_LEN;
416
- wasm.rregex_findAll(retptr, this.__wbg_ptr, ptr0, len0);
417
- var r0 = getInt32Memory0()[retptr / 4 + 0];
418
- var r1 = getInt32Memory0()[retptr / 4 + 1];
419
- var r2 = getInt32Memory0()[retptr / 4 + 2];
420
- if (r2) {
421
- throw takeObject(r1);
422
- }
423
- return takeObject(r0);
424
- } finally {
425
- wasm.__wbindgen_add_to_stack_pointer(16);
426
- }
427
- }
428
- /**
429
- * Returns a list of the capture names in this regex.
430
- *
431
- * @see https://docs.rs/regex/latest/regex/struct.Regex.html#method.capture_names
432
- */
433
- captureNames() {
434
- try {
435
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
436
- wasm.rregex_captureNames(retptr, this.__wbg_ptr);
437
- var r0 = getInt32Memory0()[retptr / 4 + 0];
438
- var r1 = getInt32Memory0()[retptr / 4 + 1];
439
- var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
440
- wasm.__wbindgen_free(r0, r1 * 4, 4);
441
- return v1;
442
- } finally {
443
- wasm.__wbindgen_add_to_stack_pointer(16);
444
- }
445
- }
446
- /**
447
- * Returns the capture groups corresponding to the leftmost-first
448
- * match in `text`. Capture group `0` always corresponds to the entire
449
- * match. If no match is found, then `undefined` is returned.
450
- *
451
- * You should only use `captures` if you need access to the location of
452
- * capturing group matches. Otherwise, `find` is faster for discovering
453
- * the location of the overall match.
454
- *
455
- * # Examples
456
- *
457
- * Say you have some text with movie names and their release years,
458
- * like "'Citizen Kane' (1941)". It'd be nice if we could search for text
459
- * looking like that, while also extracting the movie name and its release
460
- * year separately.
461
- *
462
- * ```typescript
463
- * import { RRegex } from "rregex"
464
- *
465
- * const re = new RRegex("'([^']+)'\\s+\\((\\d{4})\)")
466
- * const text = "Not my favorite movie: 'Citizen Kane' (1941)."
467
- * const caps = re.captures(text)
468
- * expect(caps.get[1].value).toBe("Citizen Kane")
469
- * expect(caps.get[2].value).toBe("1941")
470
- * expect(caps.get[0].value).toBe("'Citizen Kane' (1941)")
471
- * ```
472
- *
473
- * Note that the full match is at capture group `0`. Each subsequent
474
- * capture group is indexed by the order of its opening `(`.
475
- *
476
- * We can make this example a bit clearer by using *named* capture groups:
477
- *
478
- * ```typescript
479
- * import { RRegex } from "rregex"
480
- *
481
- * const re = new RRegex("'(?P<title>[^']+)'\\s+\\((?P<year>\\d{4})\)")
482
- * const text = "Not my favorite movie: 'Citizen Kane' (1941)."
483
- * const caps = re.captures(text)
484
- * expect(caps.name["title"].value).toBe("Citizen Kane")
485
- * expect(caps.name["year"].value).toBe("1941")
486
- * expect(caps.get[0].value).toBe("'Citizen Kane' (1941)")
487
- * ```
488
- *
489
- * @see https://docs.rs/regex/latest/regex/struct.Regex.html#method.captures
490
- * @param {string} text - The string against which to match the regular expression
491
- * @returns {Captures|undefined}
492
- */
493
- captures(text) {
494
- try {
495
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
496
- const ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
497
- const len0 = WASM_VECTOR_LEN;
498
- wasm.rregex_captures(retptr, this.__wbg_ptr, ptr0, len0);
499
- var r0 = getInt32Memory0()[retptr / 4 + 0];
500
- var r1 = getInt32Memory0()[retptr / 4 + 1];
501
- var r2 = getInt32Memory0()[retptr / 4 + 2];
502
- if (r2) {
503
- throw takeObject(r1);
504
- }
505
- return takeObject(r0);
506
- } finally {
507
- wasm.__wbindgen_add_to_stack_pointer(16);
508
- }
509
- }
510
- /**
511
- * Returns a list with all the non-overlapping capture groups matched
512
- * in `text`. This is operationally the same as `findAll`, except it
513
- * returns information about capturing group matches.
514
- *
515
- * # Example
516
- *
517
- * We can use this to find all movie titles and their release years in
518
- * some text, where the movie is formatted like "'Title' (xxxx)":
519
- *
520
- * ```typescript
521
- * import { RRegex } from "rregex"
522
- *
523
- * const re = new RRegex("'(?P<title>[^']+)'\\s+\\((?P<year>\\d{4})\\)")
524
- * const text = "'Citizen Kane' (1941), 'The Wizard of Oz' (1939), 'M' (1931)."
525
- * for caps of re.captures_iter(text) {
526
- * console.log(
527
- * "Movie:", caps.name["title"].value, ","
528
- * "Released:", caps.name["year"].value
529
- * );
530
- * }
531
- * // Output:
532
- * // Movie: Citizen Kane, Released: 1941
533
- * // Movie: The Wizard of Oz, Released: 1939
534
- * // Movie: M, Released: 1931
535
- * ```
536
- *
537
- * @see https://docs.rs/regex/latest/regex/struct.Regex.html#method.captures_iter
538
- * @param {string} text - The string against which to match the regular expression
539
- * @returns {Captures[]}
540
- */
541
- capturesAll(text) {
542
- try {
543
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
544
- const ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
545
- const len0 = WASM_VECTOR_LEN;
546
- wasm.rregex_capturesAll(retptr, this.__wbg_ptr, ptr0, len0);
547
- var r0 = getInt32Memory0()[retptr / 4 + 0];
548
- var r1 = getInt32Memory0()[retptr / 4 + 1];
549
- var r2 = getInt32Memory0()[retptr / 4 + 2];
550
- if (r2) {
551
- throw takeObject(r1);
552
- }
553
- return takeObject(r0);
554
- } finally {
555
- wasm.__wbindgen_add_to_stack_pointer(16);
556
- }
557
- }
558
- /**
559
- * Returns the number of captures.
560
- *
561
- * This includes all named and unnamed groups, including the implicit
562
- * unnamed group that is always present and corresponds to the entire match.
563
- *
564
- * Since the implicit unnamed group is always included in this length, the
565
- * length returned is guaranteed to be greater than zero.
566
- *
567
- * ## Example
568
- *
569
- * ```typescript
570
- * import { RRegex } from "rregex"
571
- *
572
- * const re1 = new RRegex("(?P<y>\\d{4})-(?P<m>\\d{2})-(?P<d>\\d{2})")
573
- * expect(re1.capturesLength()).toEqual(4)
574
- *
575
- * const re2 = new RRegex("foo")
576
- * expect(re2.capturesLength()).toEqual(1)
577
- *
578
- * const re3 = new RRegex("(foo)")
579
- * expect(re3.capturesLength()).toEqual(2)
580
- *
581
- * const re4 = new RRegex("(?<a>.(?<b>.))(.)(?:.)(?<c>.)")
582
- * expect(re4.capturesLength()).toEqual(5)
583
- *
584
- * const re5 = new RRegex("[a&&b]")
585
- * expect(re5.capturesLength()).toEqual(1)
586
- * ```
587
- *
588
- * @see https://docs.rs/regex/latest/regex/struct.Regex.html#method.captures_len
589
- * @returns {number}
590
- */
591
- capturesLength() {
592
- const ret = wasm.rregex_capturesLength(this.__wbg_ptr);
593
- return ret >>> 0;
594
- }
595
- /**
596
- * Replaces the leftmost-first match with the replacement provided.
597
- * The replacement can be a regular string (where `$N` and `$name` are
598
- * expanded to match capture groups) or a function that takes the matches'
599
- * `Captures` and returns the replaced string.
600
- *
601
- * If no match is found, then a copy of the string is returned unchanged.
602
- *
603
- * # Replacement string syntax
604
- *
605
- * All instances of `$name` in the replacement text is replaced with the
606
- * corresponding capture group `name`.
607
- *
608
- * `name` may be an integer corresponding to the index of the
609
- * capture group (counted by order of opening parenthesis where `0` is the
610
- * entire match) or it can be a name (consisting of letters, digits or
611
- * underscores) corresponding to a named capture group.
612
- *
613
- * If `name` isn't a valid capture group (whether the name doesn't exist
614
- * or isn't a valid index), then it is replaced with the empty string.
615
- *
616
- * The longest possible name is used. e.g., `$1a` looks up the capture
617
- * group named `1a` and not the capture group at index `1`. To exert more
618
- * precise control over the name, use braces, e.g., `${1}a`.
619
- *
620
- * To write a literal `$` use `$$`.
621
- *
622
- * # Examples
623
- *
624
- * Note that this function is polymorphic with respect to the replacement.
625
- * In typical usage, this can just be a normal string:
626
- *
627
- * ```typescript
628
- * import { RRegex } from "rregex"
629
- *
630
- * const re = new RRegex("[^01]+")
631
- * expect(re.replace("1078910", "").toBe("1010")
632
- * ```
633
- *
634
- * Here's the example using this expansion technique with named capture
635
- * groups:
636
- *
637
- * ```typescript
638
- * import { RRegex } from "rregex"
639
- *
640
- * const re = new RRegex("(?P<last>[^,\\s]+),\\s+(?P<first>\\S+)")
641
- * const result = re.replace("Springsteen, Bruce", "$first $last")
642
- * expect(result).toBe("Bruce Springsteen")
643
- * ```
644
- *
645
- * Note that using `$2` instead of `$first` or `$1` instead of `$last`
646
- * would produce the same result. To write a literal `$` use `$$`.
647
- *
648
- * Sometimes the replacement string requires use of curly braces to
649
- * delineate a capture group replacement and surrounding literal text.
650
- * For example, if we wanted to join two words together with an
651
- * underscore:
652
- *
653
- * ```typescript
654
- * import { RRegex } from "rregex"
655
- *
656
- * const re = new RRegex("(?P<first>\\w+)\\s+(?P<second>\\w+)")
657
- * const result = re.replace("deep fried", "${first}_$second")
658
- * expect(result).toBe("deep_fried")
659
- * ```
660
- *
661
- * Without the curly braces, the capture group name `first_` would be
662
- * used, and since it doesn't exist, it would be replaced with the empty
663
- * string.
664
- *
665
- * @see https://docs.rs/regex/latest/regex/struct.Regex.html#method.replace
666
- * @param {string} text - The string against which to match the regular expression
667
- * @param {string} rep - It's a string, it will replace the substring matched by `pattern`.
668
- * @returns {string}
669
- */
670
- replace(text, rep) {
671
- let deferred3_0;
672
- let deferred3_1;
673
- try {
674
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
675
- const ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
676
- const len0 = WASM_VECTOR_LEN;
677
- const ptr1 = passStringToWasm0(rep, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
678
- const len1 = WASM_VECTOR_LEN;
679
- wasm.rregex_replace(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1);
680
- var r0 = getInt32Memory0()[retptr / 4 + 0];
681
- var r1 = getInt32Memory0()[retptr / 4 + 1];
682
- deferred3_0 = r0;
683
- deferred3_1 = r1;
684
- return getStringFromWasm0(r0, r1);
685
- } finally {
686
- wasm.__wbindgen_add_to_stack_pointer(16);
687
- wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
688
- }
689
- }
690
- /**
691
- * Replaces at most `limit` non-overlapping matches in `text` with the
692
- * replacement provided. If `limit` is 0, then all non-overlapping matches
693
- * are replaced.
694
- *
695
- * See the documentation for `replace` for details on how to access
696
- * capturing group matches in the replacement string.
697
- *
698
- * @see https://docs.rs/regex/latest/regex/struct.Regex.html#method.replacen
699
- * @param {string} text - The string against which to match the regular expression
700
- * @param {number} limit - Max number of replacement
701
- * @param {string} rep - It's a string, it will replace the substring matched by `pattern`.
702
- * @returns {string}
703
- */
704
- replacen(text, limit, rep) {
705
- let deferred3_0;
706
- let deferred3_1;
707
- try {
708
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
709
- const ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
710
- const len0 = WASM_VECTOR_LEN;
711
- const ptr1 = passStringToWasm0(rep, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
712
- const len1 = WASM_VECTOR_LEN;
713
- wasm.rregex_replacen(retptr, this.__wbg_ptr, ptr0, len0, limit, ptr1, len1);
714
- var r0 = getInt32Memory0()[retptr / 4 + 0];
715
- var r1 = getInt32Memory0()[retptr / 4 + 1];
716
- deferred3_0 = r0;
717
- deferred3_1 = r1;
718
- return getStringFromWasm0(r0, r1);
719
- } finally {
720
- wasm.__wbindgen_add_to_stack_pointer(16);
721
- wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
722
- }
723
- }
724
- /**
725
- * Replaces all non-overlapping matches in `text` with the replacement
726
- * provided. This is the same as calling `replacen` with `limit` set to
727
- * `0`.
728
- *
729
- * See the documentation for `replace` for details on how to access
730
- * capturing group matches in the replacement string.
731
- *
732
- * See the documentation for `replace` for details on how to access capturing group matches in the replacement string.
733
- * @see https://docs.rs/regex/latest/regex/struct.Regex.html#method.replace_all
734
- * @param {string} text - The string against which to match the regular expression
735
- * @param {string} rep - It's a string, it will replace the substring matched by `pattern`.
736
- * @returns {string}
737
- */
738
- replaceAll(text, rep) {
739
- let deferred3_0;
740
- let deferred3_1;
741
- try {
742
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
743
- const ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
744
- const len0 = WASM_VECTOR_LEN;
745
- const ptr1 = passStringToWasm0(rep, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
746
- const len1 = WASM_VECTOR_LEN;
747
- wasm.rregex_replaceAll(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1);
748
- var r0 = getInt32Memory0()[retptr / 4 + 0];
749
- var r1 = getInt32Memory0()[retptr / 4 + 1];
750
- deferred3_0 = r0;
751
- deferred3_1 = r1;
752
- return getStringFromWasm0(r0, r1);
753
- } finally {
754
- wasm.__wbindgen_add_to_stack_pointer(16);
755
- wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
756
- }
757
- }
758
- /**
759
- * Returns an iterator of substrings of `text` delimited by a match of the
760
- * regular expression. Namely, each element of the iterator corresponds to
761
- * text that *isn't* matched by the regular expression.
762
- *
763
- * This method will *not* copy the text given.
764
- *
765
- * # Example
766
- *
767
- * To split a string delimited by arbitrary amounts of spaces or tabs:
768
- *
769
- * ```typescript
770
- * import { RRegex } from "rregex"
771
- *
772
- * const re = new RRegex(r"[ \\t]+")
773
- * const fields = re.split("a b \t c\td e")
774
- * expect(fields).toEqual(["a", "b", "c", "d", "e"])
775
- * ```
776
- *
777
- * @see https://docs.rs/regex/latest/regex/struct.Regex.html#method.split
778
- * @param {string} text - The string against which to match the regular expression
779
- * @returns {string[]}
780
- */
781
- split(text) {
782
- try {
783
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
784
- const ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
785
- const len0 = WASM_VECTOR_LEN;
786
- wasm.rregex_split(retptr, this.__wbg_ptr, ptr0, len0);
787
- var r0 = getInt32Memory0()[retptr / 4 + 0];
788
- var r1 = getInt32Memory0()[retptr / 4 + 1];
789
- var v2 = getArrayJsValueFromWasm0(r0, r1).slice();
790
- wasm.__wbindgen_free(r0, r1 * 4, 4);
791
- return v2;
792
- } finally {
793
- wasm.__wbindgen_add_to_stack_pointer(16);
794
- }
795
- }
796
- /**
797
- * Returns an iterator of at most `limit` substrings of `text` delimited
798
- * by a match of the regular expression. (A `limit` of `0` will return no
799
- * substrings.) Namely, each element of the iterator corresponds to text
800
- * that *isn't* matched by the regular expression. The remainder of the
801
- * string that is not split will be the last element in the iterator.
802
- *
803
- * This method will *not* copy the text given.
804
- *
805
- * # Example
806
- *
807
- * Get the first two words in some text:
808
- *
809
- * ```typescript
810
- * import { RRegex } from "rregex"
811
- *
812
- * const re = new RRegex(r"\\W+")
813
- * const fields = re.splitn("Hey! How are you?", 3)
814
- * expect(fields).toEqual(["Hey", "How", "are you?"])
815
- * ```
816
- * @see https://docs.rs/regex/latest/regex/struct.Regex.html#method.splitn
817
- * @param {string} text - The string against which to match the regular expression
818
- * @param {number} limit - Max number result elements
819
- * @returns {string[]}
820
- */
821
- splitn(text, limit) {
822
- try {
823
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
824
- const ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
825
- const len0 = WASM_VECTOR_LEN;
826
- wasm.rregex_splitn(retptr, this.__wbg_ptr, ptr0, len0, limit);
827
- var r0 = getInt32Memory0()[retptr / 4 + 0];
828
- var r1 = getInt32Memory0()[retptr / 4 + 1];
829
- var v2 = getArrayJsValueFromWasm0(r0, r1).slice();
830
- wasm.__wbindgen_free(r0, r1 * 4, 4);
831
- return v2;
832
- } finally {
833
- wasm.__wbindgen_add_to_stack_pointer(16);
834
- }
835
- }
836
- /**
837
- * Returns the end location of a match in the text given.
838
- *
839
- * This method may have the same performance characteristics as
840
- * `isMatch`, except it provides an end location for a match. In
841
- * particular, the location returned *may be shorter* than the proper end
842
- * of the leftmost-first match that you would find via `Regex.find`.
843
- *
844
- * Note that it is not guaranteed that this routine finds the shortest or
845
- * "earliest" possible match. Instead, the main idea of this API is that
846
- * it returns the offset at the point at which the internal regex engine
847
- * has determined that a match has occurred. This may vary depending on
848
- * which internal regex engine is used, and thus, the offset itself may
849
- * change.
850
- *
851
- * # Example
852
- *
853
- * Typically, `a+` would match the entire first sequence of `a` in some
854
- * text, but `shortest_match` can give up as soon as it sees the first
855
- * `a`.
856
- *
857
- * ```typescript
858
- * import { RRegex } from "rregex"
859
- *
860
- * const text = "aaaaa"
861
- * const = new RRegex("a+").shortest_match(text)
862
- * expect(pos).toBe(1)
863
- * ```
864
- *
865
- * @see https://docs.rs/regex/latest/regex/struct.Regex.html#method.shortest_match
866
- * @param {string} text - The string against which to match the regular expression
867
- * @returns {number|undefined}
868
- */
869
- shortestMatch(text) {
870
- try {
871
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
872
- const ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
873
- const len0 = WASM_VECTOR_LEN;
874
- wasm.rregex_shortestMatch(retptr, this.__wbg_ptr, ptr0, len0);
875
- var r0 = getInt32Memory0()[retptr / 4 + 0];
876
- var r1 = getInt32Memory0()[retptr / 4 + 1];
877
- return r0 === 0 ? undefined : r1 >>> 0;
878
- } finally {
879
- wasm.__wbindgen_add_to_stack_pointer(16);
880
- }
881
- }
882
- /**
883
- * Returns the same as `shortest_match`, but starts the search at the
884
- * given offset.
885
- *
886
- * The significance of the starting point is that it takes the surrounding
887
- * context into consideration. For example, the `\A` anchor can only match
888
- * when `start == 0`.
889
- * @see https://docs.rs/regex/latest/regex/struct.Regex.html#method.shortest_match_at
890
- * @param {string} text - The string against which to match the regular expression
891
- * @param {number} start - Zero-based index at which to start matching
892
- * @returns {number|undefined}
893
- */
894
- shortestMatchAt(text, start) {
895
- try {
896
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
897
- const ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
898
- const len0 = WASM_VECTOR_LEN;
899
- wasm.rregex_shortestMatchAt(retptr, this.__wbg_ptr, ptr0, len0, start);
900
- var r0 = getInt32Memory0()[retptr / 4 + 0];
901
- var r1 = getInt32Memory0()[retptr / 4 + 1];
902
- return r0 === 0 ? undefined : r1 >>> 0;
903
- } finally {
904
- wasm.__wbindgen_add_to_stack_pointer(16);
905
- }
906
- }
907
- /**
908
- * Returns the regular expression into a high level intermediate
909
- * representation.
910
- * @returns {any}
911
- */
912
- syntax() {
913
- try {
914
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
915
- wasm.rregex_syntax(retptr, this.__wbg_ptr);
916
- var r0 = getInt32Memory0()[retptr / 4 + 0];
917
- var r1 = getInt32Memory0()[retptr / 4 + 1];
918
- var r2 = getInt32Memory0()[retptr / 4 + 2];
919
- if (r2) {
920
- throw takeObject(r1);
921
- }
922
- return takeObject(r0);
923
- } finally {
924
- wasm.__wbindgen_add_to_stack_pointer(16);
925
- }
926
- }
927
- /**
928
- * Returns a string representing the regular expression
929
- * @returns {string}
930
- */
931
- toString() {
932
- let deferred1_0;
933
- let deferred1_1;
934
- try {
935
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
936
- wasm.rregex_toString(retptr, this.__wbg_ptr);
937
- var r0 = getInt32Memory0()[retptr / 4 + 0];
938
- var r1 = getInt32Memory0()[retptr / 4 + 1];
939
- deferred1_0 = r0;
940
- deferred1_1 = r1;
941
- return getStringFromWasm0(r0, r1);
942
- } finally {
943
- wasm.__wbindgen_add_to_stack_pointer(16);
944
- wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
945
- }
946
- }
947
- }
948
-
949
- const RRegexSetFinalization = (typeof FinalizationRegistry === 'undefined')
950
- ? { register: () => {}, unregister: () => {} }
951
- : new FinalizationRegistry(ptr => wasm.__wbg_rregexset_free(ptr >>> 0));
952
- /**
953
- * Match multiple (possibly overlapping) regular expressions in a single scan.
954
- * A regex set corresponds to the union of two or more regular expressions.
955
- *
956
- * That is, a regex set will match text where at least one of its constituent
957
- * regular expressions matches. A regex set as its formulated here provides a
958
- * touch more power: it will also report which regular expressions in the set match.
959
- * Indeed, this is the key difference between regex sets and a single `Regex`
960
- * with many alternates, since only one alternate can match at a time.
961
- *
962
- * @see https://docs.rs/regex/latest/regex/struct.RegexSet.html#method.empty
963
- */
964
- export class RRegexSet {
965
-
966
- __destroy_into_raw() {
967
- const ptr = this.__wbg_ptr;
968
- this.__wbg_ptr = 0;
969
- RRegexSetFinalization.unregister(this);
970
- return ptr;
971
- }
972
-
973
- free() {
974
- const ptr = this.__destroy_into_raw();
975
- wasm.__wbg_rregexset_free(ptr);
976
- }
977
- /**
978
- * Create a new regex set with the given regular expressions.
979
- *
980
- * This takes an of strings, if any item in the list is not a valid regular
981
- * expressions, then an error is returned.
982
- *
983
- * # Example
984
- *
985
- * Create a new regex set from an iterator of strings:
986
- *
987
- * ```typescript
988
- * import { RegexSet } from "rregex"
989
- *
990
- * const set = new RegexSet(["\\w+", "\\d+"])
991
- * expect(set.is_match("foo")).toBe(true)
992
- * ```
993
- * @param {Array<any>} list
994
- */
995
- constructor(list) {
996
- try {
997
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
998
- wasm.rregexset_new(retptr, addBorrowedObject(list));
999
- var r0 = getInt32Memory0()[retptr / 4 + 0];
1000
- var r1 = getInt32Memory0()[retptr / 4 + 1];
1001
- var r2 = getInt32Memory0()[retptr / 4 + 2];
1002
- if (r2) {
1003
- throw takeObject(r1);
1004
- }
1005
- this.__wbg_ptr = r0 >>> 0;
1006
- return this;
1007
- } finally {
1008
- wasm.__wbindgen_add_to_stack_pointer(16);
1009
- heap[stack_pointer++] = undefined;
1010
- }
1011
- }
1012
- /**
1013
- * Returns true if and only if one of the regexes in this set matches
1014
- * the text given.
1015
- *
1016
- * This method should be preferred if you only need to test whether any
1017
- * of the regexes in the set should match, but don't care about *which*
1018
- * regexes matched. This is because the underlying matching engine will
1019
- * quit immediately after seeing the first match instead of continuing to
1020
- * find all matches.
1021
- *
1022
- * Note that as with searches using `Regex`, the expression is unanchored
1023
- * by default. That is, if the regex does not start with `^` or `\A`, or
1024
- * end with `$` or `\z`, then it is permitted to match anywhere in the
1025
- * text.
1026
- *
1027
- * # Example
1028
- *
1029
- * Tests whether a set matches some text:
1030
- *
1031
- * ```typescript
1032
- * import { RegexSet } from "rregex"
1033
- *
1034
- * const set = new RegexSet(["\\w+", "\\d+"])
1035
- * expect(set.is_match("foo")).toBe(true)
1036
- * expect(!set.is_match("☃")).toBe(false)
1037
- * ```
1038
- *
1039
- * @see https://docs.rs/regex/latest/regex/struct.RegexSet.html#method.is_match
1040
- * @param {string} text - The string against which to match the regular expression
1041
- * @return {boolean}
1042
- */
1043
- isMatch(text) {
1044
- const ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1045
- const len0 = WASM_VECTOR_LEN;
1046
- const ret = wasm.rregexset_isMatch(this.__wbg_ptr, ptr0, len0);
1047
- return ret !== 0;
1048
- }
1049
- /**
1050
- * Returns the set of regular expressions that match in the given text.
1051
- *
1052
- * The set returned contains the index of each regular expression that
1053
- * matches in the given text. The index is in correspondence with the
1054
- * order of regular expressions given to `RegexSet`'s constructor.
1055
- *
1056
- * The set can also be used to iterate over the matched indices.
1057
- *
1058
- * Note that as with searches using `Regex`, the expression is unanchored
1059
- * by default. That is, if the regex does not start with `^` or `\A`, or
1060
- * end with `$` or `\z`, then it is permitted to match anywhere in the
1061
- * text.
1062
- *
1063
- * # Example
1064
- *
1065
- * Tests which regular expressions match the given text:
1066
- *
1067
- * ```typescript
1068
- * import { RegexSet } from "rregex"
1069
- *
1070
- * const set = new RegexSet([
1071
- * "\\w+",
1072
- * "\\d+",
1073
- * "\\pL+",
1074
- * "foo",
1075
- * "bar",
1076
- * "barfoo",
1077
- * "foobar",
1078
- * ])
1079
- * const matches = set.matches("foobar")
1080
- * expect(matches).toBe([0, 2, 3, 4, 6])
1081
- * ```
1082
- *
1083
- * @see https://docs.rs/regex/latest/regex/struct.RegexSet.html#method.matches
1084
- * @param {string} text - The string against which to match the regular expression
1085
- * @return {number[]}
1086
- */
1087
- matches(text) {
1088
- try {
1089
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1090
- const ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1091
- const len0 = WASM_VECTOR_LEN;
1092
- wasm.rregexset_matches(retptr, this.__wbg_ptr, ptr0, len0);
1093
- var r0 = getInt32Memory0()[retptr / 4 + 0];
1094
- var r1 = getInt32Memory0()[retptr / 4 + 1];
1095
- var v2 = getArrayJsValueFromWasm0(r0, r1).slice();
1096
- wasm.__wbindgen_free(r0, r1 * 4, 4);
1097
- return v2;
1098
- } finally {
1099
- wasm.__wbindgen_add_to_stack_pointer(16);
1100
- }
1101
- }
1102
- }
1103
-
1104
- export function __wbindgen_string_new(arg0, arg1) {
1105
- const ret = getStringFromWasm0(arg0, arg1);
1106
- return addHeapObject(ret);
1107
- };
1108
-
1109
- export function __wbindgen_number_new(arg0) {
1110
- const ret = arg0;
1111
- return addHeapObject(ret);
1112
- };
1113
-
1114
- export function __wbindgen_object_drop_ref(arg0) {
1115
- takeObject(arg0);
1116
- };
1117
-
1118
- export function __wbindgen_string_get(arg0, arg1) {
1119
- const obj = getObject(arg1);
1120
- const ret = typeof(obj) === 'string' ? obj : undefined;
1121
- var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1122
- var len1 = WASM_VECTOR_LEN;
1123
- getInt32Memory0()[arg0 / 4 + 1] = len1;
1124
- getInt32Memory0()[arg0 / 4 + 0] = ptr1;
1125
- };
1126
-
1127
- export function __wbindgen_error_new(arg0, arg1) {
1128
- const ret = new Error(getStringFromWasm0(arg0, arg1));
1129
- return addHeapObject(ret);
1130
- };
1131
-
1132
- export function __wbindgen_bigint_from_u64(arg0) {
1133
- const ret = BigInt.asUintN(64, arg0);
1134
- return addHeapObject(ret);
1135
- };
1136
-
1137
- export function __wbindgen_object_clone_ref(arg0) {
1138
- const ret = getObject(arg0);
1139
- return addHeapObject(ret);
1140
- };
1141
-
1142
- export function __wbg_set_f975102236d3c502(arg0, arg1, arg2) {
1143
- getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
1144
- };
1145
-
1146
- export function __wbg_get_bd8e338fbd5f5cc8(arg0, arg1) {
1147
- const ret = getObject(arg0)[arg1 >>> 0];
1148
- return addHeapObject(ret);
1149
- };
1150
-
1151
- export function __wbg_length_cd7af8117672b8b8(arg0) {
1152
- const ret = getObject(arg0).length;
1153
- return ret;
1154
- };
1155
-
1156
- export function __wbg_new_16b304a2cfa7ff4a() {
1157
- const ret = new Array();
1158
- return addHeapObject(ret);
1159
- };
1160
-
1161
- export function __wbg_new_72fb9a18b5ae2624() {
1162
- const ret = new Object();
1163
- return addHeapObject(ret);
1164
- };
1165
-
1166
- export function __wbg_set_d4638f722068f043(arg0, arg1, arg2) {
1167
- getObject(arg0)[arg1 >>> 0] = takeObject(arg2);
1168
- };
1169
-
1170
- export function __wbg_from_89e3fc3ba5e6fb48(arg0) {
1171
- const ret = Array.from(getObject(arg0));
1172
- return addHeapObject(ret);
1173
- };
1174
-
1175
- export function __wbg_push_a5b05aedc7234f9f(arg0, arg1) {
1176
- const ret = getObject(arg0).push(getObject(arg1));
1177
- return ret;
1178
- };
1179
-
1180
- export function __wbg_fromCodePoint_cedd7612a2ff688f() { return handleError(function (arg0) {
1181
- const ret = String.fromCodePoint(arg0 >>> 0);
1182
- return addHeapObject(ret);
1183
- }, arguments) };
1184
-
1185
- export function __wbg_buffer_12d079cc21e14bdb(arg0) {
1186
- const ret = getObject(arg0).buffer;
1187
- return addHeapObject(ret);
1188
- };
1189
-
1190
- export function __wbg_newwithbyteoffsetandlength_aa4a17c33a06e5cb(arg0, arg1, arg2) {
1191
- const ret = new Uint8Array(getObject(arg0), arg1 >>> 0, arg2 >>> 0);
1192
- return addHeapObject(ret);
1193
- };
1194
-
1195
- export function __wbg_new_63b92bc8671ed464(arg0) {
1196
- const ret = new Uint8Array(getObject(arg0));
1197
- return addHeapObject(ret);
1198
- };
1199
-
1200
- export function __wbg_set_1f9b04f170055d33() { return handleError(function (arg0, arg1, arg2) {
1201
- const ret = Reflect.set(getObject(arg0), getObject(arg1), getObject(arg2));
1202
- return ret;
1203
- }, arguments) };
1204
-
1205
- export function __wbindgen_throw(arg0, arg1) {
1206
- throw new Error(getStringFromWasm0(arg0, arg1));
1207
- };
1208
-
1209
- export function __wbindgen_memory() {
1210
- const ret = wasm.memory;
1211
- return addHeapObject(ret);
1212
- };
1213
-