rregex 1.8.1 → 1.8.2

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