rregex 1.7.1 → 1.7.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/commonjs.js DELETED
@@ -1,675 +0,0 @@
1
- let imports = {};
2
- imports['wbg'] = module.exports;
3
- let wasm;
4
- const { TextDecoder, TextEncoder } = require(`util`);
5
-
6
- const heap = new Array(128).fill(undefined);
7
-
8
- heap.push(undefined, null, true, false);
9
-
10
- function getObject(idx) { return heap[idx]; }
11
-
12
- let heap_next = heap.length;
13
-
14
- function dropObject(idx) {
15
- if (idx < 132) return;
16
- heap[idx] = heap_next;
17
- heap_next = idx;
18
- }
19
-
20
- function takeObject(idx) {
21
- const ret = getObject(idx);
22
- dropObject(idx);
23
- return ret;
24
- }
25
-
26
- let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
27
-
28
- cachedTextDecoder.decode();
29
-
30
- let cachedUint8Memory0 = null;
31
-
32
- function getUint8Memory0() {
33
- if (cachedUint8Memory0 === null || cachedUint8Memory0.byteLength === 0) {
34
- cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer);
35
- }
36
- return cachedUint8Memory0;
37
- }
38
-
39
- function getStringFromWasm0(ptr, len) {
40
- ptr = ptr >>> 0;
41
- return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
42
- }
43
-
44
- function addHeapObject(obj) {
45
- if (heap_next === heap.length) heap.push(heap.length + 1);
46
- const idx = heap_next;
47
- heap_next = heap[idx];
48
-
49
- heap[idx] = obj;
50
- return idx;
51
- }
52
-
53
- let WASM_VECTOR_LEN = 0;
54
-
55
- let cachedTextEncoder = new TextEncoder('utf-8');
56
-
57
- const encodeString = (typeof cachedTextEncoder.encodeInto === 'function'
58
- ? function (arg, view) {
59
- return cachedTextEncoder.encodeInto(arg, view);
60
- }
61
- : function (arg, view) {
62
- const buf = cachedTextEncoder.encode(arg);
63
- view.set(buf);
64
- return {
65
- read: arg.length,
66
- written: buf.length
67
- };
68
- });
69
-
70
- function passStringToWasm0(arg, malloc, realloc) {
71
-
72
- if (realloc === undefined) {
73
- const buf = cachedTextEncoder.encode(arg);
74
- const ptr = malloc(buf.length, 1) >>> 0;
75
- getUint8Memory0().subarray(ptr, ptr + buf.length).set(buf);
76
- WASM_VECTOR_LEN = buf.length;
77
- return ptr;
78
- }
79
-
80
- let len = arg.length;
81
- let ptr = malloc(len, 1) >>> 0;
82
-
83
- const mem = getUint8Memory0();
84
-
85
- let offset = 0;
86
-
87
- for (; offset < len; offset++) {
88
- const code = arg.charCodeAt(offset);
89
- if (code > 0x7F) break;
90
- mem[ptr + offset] = code;
91
- }
92
-
93
- if (offset !== len) {
94
- if (offset !== 0) {
95
- arg = arg.slice(offset);
96
- }
97
- ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
98
- const view = getUint8Memory0().subarray(ptr + offset, ptr + len);
99
- const ret = encodeString(arg, view);
100
-
101
- offset += ret.written;
102
- }
103
-
104
- WASM_VECTOR_LEN = offset;
105
- return ptr;
106
- }
107
-
108
- function isLikeNone(x) {
109
- return x === undefined || x === null;
110
- }
111
-
112
- let cachedInt32Memory0 = null;
113
-
114
- function getInt32Memory0() {
115
- if (cachedInt32Memory0 === null || cachedInt32Memory0.byteLength === 0) {
116
- cachedInt32Memory0 = new Int32Array(wasm.memory.buffer);
117
- }
118
- return cachedInt32Memory0;
119
- }
120
-
121
- function debugString(val) {
122
- // primitive types
123
- const type = typeof val;
124
- if (type == 'number' || type == 'boolean' || val == null) {
125
- return `${val}`;
126
- }
127
- if (type == 'string') {
128
- return `"${val}"`;
129
- }
130
- if (type == 'symbol') {
131
- const description = val.description;
132
- if (description == null) {
133
- return 'Symbol';
134
- } else {
135
- return `Symbol(${description})`;
136
- }
137
- }
138
- if (type == 'function') {
139
- const name = val.name;
140
- if (typeof name == 'string' && name.length > 0) {
141
- return `Function(${name})`;
142
- } else {
143
- return 'Function';
144
- }
145
- }
146
- // objects
147
- if (Array.isArray(val)) {
148
- const length = val.length;
149
- let debug = '[';
150
- if (length > 0) {
151
- debug += debugString(val[0]);
152
- }
153
- for(let i = 1; i < length; i++) {
154
- debug += ', ' + debugString(val[i]);
155
- }
156
- debug += ']';
157
- return debug;
158
- }
159
- // Test for built-in
160
- const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
161
- let className;
162
- if (builtInMatches.length > 1) {
163
- className = builtInMatches[1];
164
- } else {
165
- // Failed to match the standard '[object ClassName]'
166
- return toString.call(val);
167
- }
168
- if (className == 'Object') {
169
- // we're a user defined class or Object
170
- // JSON.stringify avoids problems with cycles, and is generally much
171
- // easier than looping through ownProperties of `val`.
172
- try {
173
- return 'Object(' + JSON.stringify(val) + ')';
174
- } catch (_) {
175
- return 'Object';
176
- }
177
- }
178
- // errors
179
- if (val instanceof Error) {
180
- return `${val.name}: ${val.message}\n${val.stack}`;
181
- }
182
- // TODO we could test for more things here, like `Set`s and `Map`s.
183
- return className;
184
- }
185
-
186
- let stack_pointer = 128;
187
-
188
- function addBorrowedObject(obj) {
189
- if (stack_pointer == 1) throw new Error('out of js stack');
190
- heap[--stack_pointer] = obj;
191
- return stack_pointer;
192
- }
193
- /**
194
- * @param {string} text
195
- * @returns {string}
196
- */
197
- module.exports.escape = function(text) {
198
- let deferred2_0;
199
- let deferred2_1;
200
- try {
201
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
202
- const ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
203
- const len0 = WASM_VECTOR_LEN;
204
- wasm.escape(retptr, ptr0, len0);
205
- var r0 = getInt32Memory0()[retptr / 4 + 0];
206
- var r1 = getInt32Memory0()[retptr / 4 + 1];
207
- deferred2_0 = r0;
208
- deferred2_1 = r1;
209
- return getStringFromWasm0(r0, r1);
210
- } finally {
211
- wasm.__wbindgen_add_to_stack_pointer(16);
212
- wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
213
- }
214
- };
215
-
216
- function handleError(f, args) {
217
- try {
218
- return f.apply(this, args);
219
- } catch (e) {
220
- wasm.__wbindgen_exn_store(addHeapObject(e));
221
- }
222
- }
223
- /**
224
- * A compiled regular expression for matching Unicode strings.
225
- * @see https://docs.rs/regex/latest/regex/
226
- */
227
- class RRegex {
228
-
229
- __destroy_into_raw() {
230
- const ptr = this.__wbg_ptr;
231
- this.__wbg_ptr = 0;
232
-
233
- return ptr;
234
- }
235
-
236
- free() {
237
- const ptr = this.__destroy_into_raw();
238
- wasm.__wbg_rregex_free(ptr);
239
- }
240
- /**
241
- * Compiles a regular expression. Once compiled, it can be used repeatedly to search, split or replace text in a string.
242
- * If an invalid expression is given, then an error is returned.
243
- * @param {string} re
244
- */
245
- constructor(re) {
246
- try {
247
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
248
- const ptr0 = passStringToWasm0(re, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
249
- const len0 = WASM_VECTOR_LEN;
250
- wasm.rregex_new(retptr, ptr0, len0);
251
- var r0 = getInt32Memory0()[retptr / 4 + 0];
252
- var r1 = getInt32Memory0()[retptr / 4 + 1];
253
- var r2 = getInt32Memory0()[retptr / 4 + 2];
254
- if (r2) {
255
- throw takeObject(r1);
256
- }
257
- this.__wbg_ptr = r0 >>> 0;
258
- return this;
259
- } finally {
260
- wasm.__wbindgen_add_to_stack_pointer(16);
261
- }
262
- }
263
- /**
264
- * Returns true if and only if there is a match for the regex in the string given.
265
- * It is recommended to use this method if all you need to do is test a match, since the underlying matching engine may be able to do less work.
266
- * @see https://docs.rs/regex/latest/regex/struct.Regex.html#method.is_match
267
- * @param {string} text
268
- * @returns {boolean}
269
- */
270
- isMatch(text) {
271
- const ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
272
- const len0 = WASM_VECTOR_LEN;
273
- const ret = wasm.rregex_isMatch(this.__wbg_ptr, ptr0, len0);
274
- return ret !== 0;
275
- }
276
- /**
277
- * Returns the same as is_match, but starts the search at the given offset.
278
- * The significance of the starting point is that it takes the surrounding context into consideration. For example, the `\A` anchor can only match when `start == 0`.
279
- * @see https://docs.rs/regex/latest/regex/struct.Regex.html#method.is_match_at
280
- * @param {string} text
281
- * @param {number} start
282
- * @returns {boolean}
283
- */
284
- isMatchAt(text, start) {
285
- const ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
286
- const len0 = WASM_VECTOR_LEN;
287
- const ret = wasm.rregex_isMatchAt(this.__wbg_ptr, ptr0, len0, start);
288
- return ret !== 0;
289
- }
290
- /**
291
- * Returns the start and end byte range of the leftmost-first match in `text`. If no match exists, then `undefined` is returned.
292
- * Note that this should only be used if you want to discover the position of the match. Testing the existence of a match is faster if you use `is_match`.
293
- * @see https://docs.rs/regex/latest/regex/struct.Regex.html#method.find
294
- * @param {string} text
295
- * @returns {any}
296
- */
297
- find(text) {
298
- const ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
299
- const len0 = WASM_VECTOR_LEN;
300
- const ret = wasm.rregex_find(this.__wbg_ptr, ptr0, len0);
301
- return takeObject(ret);
302
- }
303
- /**
304
- * Returns the same as find, but starts the search at the given offset.
305
- * The significance of the starting point is that it takes the surrounding context into consideration. For example, the \A anchor can only match when `start == 0`.
306
- * @see https://docs.rs/regex/latest/regex/struct.Regex.html#method.find_at
307
- * @param {string} text
308
- * @param {number} start
309
- * @returns {any}
310
- */
311
- findAt(text, start) {
312
- const ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
313
- const len0 = WASM_VECTOR_LEN;
314
- const ret = wasm.rregex_findAt(this.__wbg_ptr, ptr0, len0, start);
315
- return takeObject(ret);
316
- }
317
- /**
318
- * Returns an array for each successive non-overlapping match in text, returning the start and end byte indices with respect to text.
319
- * @see https://docs.rs/regex/latest/regex/struct.Regex.html#method.find_iter
320
- * @param {string} text
321
- * @returns {any}
322
- */
323
- findAll(text) {
324
- const ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
325
- const len0 = WASM_VECTOR_LEN;
326
- const ret = wasm.rregex_findAll(this.__wbg_ptr, ptr0, len0);
327
- return takeObject(ret);
328
- }
329
- /**
330
- * Replaces the leftmost-first match with the replacement provided.
331
- * The replacement can be a regular string (where `$N` and `$name` are expanded to match capture groups) or a function that takes the matches’ `Captures` and returns the replaced string.
332
- * If no match is found, then a copy of the string is returned unchanged.
333
- * @see https://docs.rs/regex/latest/regex/struct.Regex.html#method.replace
334
- * @param {string} text
335
- * @param {string} rep
336
- * @returns {string}
337
- */
338
- replace(text, rep) {
339
- let deferred3_0;
340
- let deferred3_1;
341
- try {
342
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
343
- const ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
344
- const len0 = WASM_VECTOR_LEN;
345
- const ptr1 = passStringToWasm0(rep, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
346
- const len1 = WASM_VECTOR_LEN;
347
- wasm.rregex_replace(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1);
348
- var r0 = getInt32Memory0()[retptr / 4 + 0];
349
- var r1 = getInt32Memory0()[retptr / 4 + 1];
350
- deferred3_0 = r0;
351
- deferred3_1 = r1;
352
- return getStringFromWasm0(r0, r1);
353
- } finally {
354
- wasm.__wbindgen_add_to_stack_pointer(16);
355
- wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
356
- }
357
- }
358
- /**
359
- * Replaces at most `limit` non-overlapping matches in `text` with the replacement provided. If `limit` is 0, then all non-overlapping matches are replaced.
360
- * See the documentation for `replace` for details on how to access capturing group matches in the replacement string.
361
- * @see https://docs.rs/regex/latest/regex/struct.Regex.html#method.replacen
362
- * @param {string} text
363
- * @param {number} limit
364
- * @param {string} rep
365
- * @returns {string}
366
- */
367
- replacen(text, limit, rep) {
368
- let deferred3_0;
369
- let deferred3_1;
370
- try {
371
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
372
- const ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
373
- const len0 = WASM_VECTOR_LEN;
374
- const ptr1 = passStringToWasm0(rep, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
375
- const len1 = WASM_VECTOR_LEN;
376
- wasm.rregex_replacen(retptr, this.__wbg_ptr, ptr0, len0, limit, ptr1, len1);
377
- var r0 = getInt32Memory0()[retptr / 4 + 0];
378
- var r1 = getInt32Memory0()[retptr / 4 + 1];
379
- deferred3_0 = r0;
380
- deferred3_1 = r1;
381
- return getStringFromWasm0(r0, r1);
382
- } finally {
383
- wasm.__wbindgen_add_to_stack_pointer(16);
384
- wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
385
- }
386
- }
387
- /**
388
- * Replaces all non-overlapping matches in `text` with the replacement provided. This is the same as calling `replacen` with `limit` set to `0`.
389
- * See the documentation for `replace` for details on how to access capturing group matches in the replacement string.
390
- * @see https://docs.rs/regex/latest/regex/struct.Regex.html#method.replace_all
391
- * @param {string} text
392
- * @param {string} rep
393
- * @returns {string}
394
- */
395
- replaceAll(text, rep) {
396
- let deferred3_0;
397
- let deferred3_1;
398
- try {
399
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
400
- const ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
401
- const len0 = WASM_VECTOR_LEN;
402
- const ptr1 = passStringToWasm0(rep, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
403
- const len1 = WASM_VECTOR_LEN;
404
- wasm.rregex_replaceAll(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1);
405
- var r0 = getInt32Memory0()[retptr / 4 + 0];
406
- var r1 = getInt32Memory0()[retptr / 4 + 1];
407
- deferred3_0 = r0;
408
- deferred3_1 = r1;
409
- return getStringFromWasm0(r0, r1);
410
- } finally {
411
- wasm.__wbindgen_add_to_stack_pointer(16);
412
- wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
413
- }
414
- }
415
- /**
416
- * Returns an iterator of substrings of `text` delimited by a match of the regular expression. Namely, each element of the iterator corresponds to text that isn’t matched by the regular expression.
417
- * This method will not copy the text given.
418
- * @see https://docs.rs/regex/latest/regex/struct.Regex.html#method.split
419
- * @param {string} text
420
- * @returns {any}
421
- */
422
- split(text) {
423
- const ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
424
- const len0 = WASM_VECTOR_LEN;
425
- const ret = wasm.rregex_split(this.__wbg_ptr, ptr0, len0);
426
- return takeObject(ret);
427
- }
428
- /**
429
- * Returns an iterator of at most `limit` substrings of `text` delimited by a match of the regular expression. (A limit of 0 will return no substrings.) Namely, each element of the iterator corresponds to text that isn’t matched by the regular expression. The remainder of the string that is not split will be the last element in the iterator.
430
- * This method will not copy the text given.
431
- * @see https://docs.rs/regex/latest/regex/struct.Regex.html#method.splitn
432
- * @param {string} text
433
- * @param {number} limit
434
- * @returns {any}
435
- */
436
- splitn(text, limit) {
437
- const ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
438
- const len0 = WASM_VECTOR_LEN;
439
- const ret = wasm.rregex_splitn(this.__wbg_ptr, ptr0, len0, limit);
440
- return takeObject(ret);
441
- }
442
- /**
443
- * Returns the end location of a match in the text given.
444
- * This method may have the same performance characteristics as `is_match`, except it provides an end location for a match. In particular, the location returned may be shorter than the proper end of the leftmost-first match.
445
- * @see https://docs.rs/regex/latest/regex/struct.Regex.html#method.shortest_match
446
- * @param {string} text
447
- * @returns {number | undefined}
448
- */
449
- shortestMatch(text) {
450
- try {
451
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
452
- const ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
453
- const len0 = WASM_VECTOR_LEN;
454
- wasm.rregex_shortestMatch(retptr, this.__wbg_ptr, ptr0, len0);
455
- var r0 = getInt32Memory0()[retptr / 4 + 0];
456
- var r1 = getInt32Memory0()[retptr / 4 + 1];
457
- return r0 === 0 ? undefined : r1 >>> 0;
458
- } finally {
459
- wasm.__wbindgen_add_to_stack_pointer(16);
460
- }
461
- }
462
- /**
463
- * Returns the same as shortest_match, but starts the search at the given offset.
464
- * The significance of the starting point is that it takes the surrounding context into consideration. For example, the \A anchor can only match when `start == 0`.
465
- * @see https://docs.rs/regex/latest/regex/struct.Regex.html#method.shortest_match_at
466
- * @param {string} text
467
- * @param {number} limit
468
- * @returns {number | undefined}
469
- */
470
- shortestMatchAt(text, limit) {
471
- try {
472
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
473
- const ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
474
- const len0 = WASM_VECTOR_LEN;
475
- wasm.rregex_shortestMatchAt(retptr, this.__wbg_ptr, ptr0, len0, limit);
476
- var r0 = getInt32Memory0()[retptr / 4 + 0];
477
- var r1 = getInt32Memory0()[retptr / 4 + 1];
478
- return r0 === 0 ? undefined : r1 >>> 0;
479
- } finally {
480
- wasm.__wbindgen_add_to_stack_pointer(16);
481
- }
482
- }
483
- /**
484
- * Return the Regex syntax object
485
- * @returns {any}
486
- */
487
- syntax() {
488
- const ret = wasm.rregex_syntax(this.__wbg_ptr);
489
- return takeObject(ret);
490
- }
491
- /**
492
- * Returns a string representing the regular expression
493
- * @returns {string}
494
- */
495
- toString() {
496
- let deferred1_0;
497
- let deferred1_1;
498
- try {
499
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
500
- wasm.rregex_toString(retptr, this.__wbg_ptr);
501
- var r0 = getInt32Memory0()[retptr / 4 + 0];
502
- var r1 = getInt32Memory0()[retptr / 4 + 1];
503
- deferred1_0 = r0;
504
- deferred1_1 = r1;
505
- return getStringFromWasm0(r0, r1);
506
- } finally {
507
- wasm.__wbindgen_add_to_stack_pointer(16);
508
- wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
509
- }
510
- }
511
- }
512
- module.exports.RRegex = RRegex;
513
- /**
514
- * Match multiple (possibly overlapping) regular expressions in a single scan.
515
- * A regex set corresponds to the union of two or more regular expressions. That is, a regex set will match text where at least one of its constituent regular expressions matches. A regex set as its formulated here provides a touch more power: it will also report which regular expressions in the set match. Indeed, this is the key difference between regex sets and a single `Regex` with many alternates, since only one alternate can match at a time.
516
- * @see https://docs.rs/regex/latest/regex/struct.RegexSet.html#method.empty
517
- */
518
- class RRegexSet {
519
-
520
- __destroy_into_raw() {
521
- const ptr = this.__wbg_ptr;
522
- this.__wbg_ptr = 0;
523
-
524
- return ptr;
525
- }
526
-
527
- free() {
528
- const ptr = this.__destroy_into_raw();
529
- wasm.__wbg_rregexset_free(ptr);
530
- }
531
- /**
532
- * Create a new regex set with the given regular expressions.
533
- * @param {Array<any>} list
534
- */
535
- constructor(list) {
536
- try {
537
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
538
- wasm.rregexset_new(retptr, addBorrowedObject(list));
539
- var r0 = getInt32Memory0()[retptr / 4 + 0];
540
- var r1 = getInt32Memory0()[retptr / 4 + 1];
541
- var r2 = getInt32Memory0()[retptr / 4 + 2];
542
- if (r2) {
543
- throw takeObject(r1);
544
- }
545
- this.__wbg_ptr = r0 >>> 0;
546
- return this;
547
- } finally {
548
- wasm.__wbindgen_add_to_stack_pointer(16);
549
- heap[stack_pointer++] = undefined;
550
- }
551
- }
552
- /**
553
- * Returns true if and only if one of the regexes in this set matches the text given.
554
- * This method should be preferred if you only need to test whether any of the regexes in the set should match, but don’t care about which regexes matched. This is because the underlying matching engine will quit immediately after seeing the first match instead of continuing to find all matches.
555
- * @see https://docs.rs/regex/latest/regex/struct.RegexSet.html#method.is_match
556
- * @param {string} text
557
- * @returns {boolean}
558
- */
559
- isMatch(text) {
560
- const ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
561
- const len0 = WASM_VECTOR_LEN;
562
- const ret = wasm.rregexset_isMatch(this.__wbg_ptr, ptr0, len0);
563
- return ret !== 0;
564
- }
565
- /**
566
- * Returns the set of regular expressions that match in the given text.
567
- * The set returned contains the index of each regular expression that matches in the given text. The index is in correspondence with the order of regular expressions given to RegexSet’s constructor.
568
- * the set can also be used to iterate over the matched indices.
569
- * @param {string} text
570
- * @returns {any}
571
- */
572
- matches(text) {
573
- const ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
574
- const len0 = WASM_VECTOR_LEN;
575
- const ret = wasm.rregexset_matches(this.__wbg_ptr, ptr0, len0);
576
- return takeObject(ret);
577
- }
578
- }
579
- module.exports.RRegexSet = RRegexSet;
580
-
581
- module.exports.__wbindgen_object_drop_ref = function(arg0) {
582
- takeObject(arg0);
583
- };
584
-
585
- module.exports.__wbindgen_string_new = function(arg0, arg1) {
586
- const ret = getStringFromWasm0(arg0, arg1);
587
- return addHeapObject(ret);
588
- };
589
-
590
- module.exports.__wbindgen_number_new = function(arg0) {
591
- const ret = arg0;
592
- return addHeapObject(ret);
593
- };
594
-
595
- module.exports.__wbindgen_is_string = function(arg0) {
596
- const ret = typeof(getObject(arg0)) === 'string';
597
- return ret;
598
- };
599
-
600
- module.exports.__wbindgen_string_get = function(arg0, arg1) {
601
- const obj = getObject(arg1);
602
- const ret = typeof(obj) === 'string' ? obj : undefined;
603
- var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
604
- var len1 = WASM_VECTOR_LEN;
605
- getInt32Memory0()[arg0 / 4 + 1] = len1;
606
- getInt32Memory0()[arg0 / 4 + 0] = ptr1;
607
- };
608
-
609
- module.exports.__wbg_get_f01601b5a68d10e3 = function(arg0, arg1) {
610
- const ret = getObject(arg0)[arg1 >>> 0];
611
- return addHeapObject(ret);
612
- };
613
-
614
- module.exports.__wbg_length_1009b1af0c481d7b = function(arg0) {
615
- const ret = getObject(arg0).length;
616
- return ret;
617
- };
618
-
619
- module.exports.__wbg_new_ffc6d4d085022169 = function() {
620
- const ret = new Array();
621
- return addHeapObject(ret);
622
- };
623
-
624
- module.exports.__wbg_new_9fb8d994e1c0aaac = function() {
625
- const ret = new Object();
626
- return addHeapObject(ret);
627
- };
628
-
629
- module.exports.__wbg_push_901f3914205d44de = function(arg0, arg1) {
630
- const ret = getObject(arg0).push(getObject(arg1));
631
- return ret;
632
- };
633
-
634
- module.exports.__wbg_new_a64e3f2afc2cf2f8 = function(arg0, arg1) {
635
- const ret = new Error(getStringFromWasm0(arg0, arg1));
636
- return addHeapObject(ret);
637
- };
638
-
639
- module.exports.__wbg_set_759f75cd92b612d2 = function() { return handleError(function (arg0, arg1, arg2) {
640
- const ret = Reflect.set(getObject(arg0), getObject(arg1), getObject(arg2));
641
- return ret;
642
- }, arguments) };
643
-
644
- module.exports.__wbindgen_debug_string = function(arg0, arg1) {
645
- const ret = debugString(getObject(arg1));
646
- const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
647
- const len1 = WASM_VECTOR_LEN;
648
- getInt32Memory0()[arg0 / 4 + 1] = len1;
649
- getInt32Memory0()[arg0 / 4 + 0] = ptr1;
650
- };
651
-
652
- module.exports.__wbindgen_throw = function(arg0, arg1) {
653
- throw new Error(getStringFromWasm0(arg0, arg1));
654
- };
655
-
656
- const path = require('path').join(__dirname, 'rregex.wasm');
657
- const bytes = require('fs').readFileSync(path);
658
-
659
- const wasmModule = new WebAssembly.Module(bytes);
660
- const wasmInstance = new WebAssembly.Instance(wasmModule, imports);
661
- wasm = wasmInstance.exports;
662
- module.exports.__wasm = wasm;
663
-
664
-
665
- module.exports.metadata = {
666
- "name": "rregex",
667
- "description": "Rust Regex binding for Javascript",
668
- "authors": [
669
- "Fede Ramirez <i@2fd.me>"
670
- ],
671
- "homepage": "https://2fd.github.io/rregex",
672
- "repository": "https://github.com/2fd/rregex",
673
- "regex": "1.7.3",
674
- "regex-syntax": "0.6.29"
675
- }