rregex 1.0.0 → 1.0.1

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/module.js CHANGED
@@ -1,4 +1,4 @@
1
- import * as wasm from './module_bg.wasm';
1
+ import * as wasm from './rregex.wasm';
2
2
 
3
3
  const heap = new Array(32).fill(undefined);
4
4
 
@@ -47,6 +47,75 @@ function addHeapObject(obj) {
47
47
  return idx;
48
48
  }
49
49
 
50
+ let WASM_VECTOR_LEN = 0;
51
+
52
+ const lTextEncoder = typeof TextEncoder === 'undefined' ? (0, module.require)('util').TextEncoder : TextEncoder;
53
+
54
+ let cachedTextEncoder = new lTextEncoder('utf-8');
55
+
56
+ const encodeString = (typeof cachedTextEncoder.encodeInto === 'function'
57
+ ? function (arg, view) {
58
+ return cachedTextEncoder.encodeInto(arg, view);
59
+ }
60
+ : function (arg, view) {
61
+ const buf = cachedTextEncoder.encode(arg);
62
+ view.set(buf);
63
+ return {
64
+ read: arg.length,
65
+ written: buf.length
66
+ };
67
+ });
68
+
69
+ function passStringToWasm0(arg, malloc, realloc) {
70
+
71
+ if (realloc === undefined) {
72
+ const buf = cachedTextEncoder.encode(arg);
73
+ const ptr = malloc(buf.length);
74
+ getUint8Memory0().subarray(ptr, ptr + buf.length).set(buf);
75
+ WASM_VECTOR_LEN = buf.length;
76
+ return ptr;
77
+ }
78
+
79
+ let len = arg.length;
80
+ let ptr = malloc(len);
81
+
82
+ const mem = getUint8Memory0();
83
+
84
+ let offset = 0;
85
+
86
+ for (; offset < len; offset++) {
87
+ const code = arg.charCodeAt(offset);
88
+ if (code > 0x7F) break;
89
+ mem[ptr + offset] = code;
90
+ }
91
+
92
+ if (offset !== len) {
93
+ if (offset !== 0) {
94
+ arg = arg.slice(offset);
95
+ }
96
+ ptr = realloc(ptr, len, len = offset + arg.length * 3);
97
+ const view = getUint8Memory0().subarray(ptr + offset, ptr + len);
98
+ const ret = encodeString(arg, view);
99
+
100
+ offset += ret.written;
101
+ }
102
+
103
+ WASM_VECTOR_LEN = offset;
104
+ return ptr;
105
+ }
106
+
107
+ function isLikeNone(x) {
108
+ return x === undefined || x === null;
109
+ }
110
+
111
+ let cachegetInt32Memory0 = null;
112
+ function getInt32Memory0() {
113
+ if (cachegetInt32Memory0 === null || cachegetInt32Memory0.buffer !== wasm.memory.buffer) {
114
+ cachegetInt32Memory0 = new Int32Array(wasm.memory.buffer);
115
+ }
116
+ return cachegetInt32Memory0;
117
+ }
118
+
50
119
  function debugString(val) {
51
120
  // primitive types
52
121
  const type = typeof val;
@@ -111,71 +180,25 @@ function debugString(val) {
111
180
  // TODO we could test for more things here, like `Set`s and `Map`s.
112
181
  return className;
113
182
  }
114
-
115
- let WASM_VECTOR_LEN = 0;
116
-
117
- const lTextEncoder = typeof TextEncoder === 'undefined' ? (0, module.require)('util').TextEncoder : TextEncoder;
118
-
119
- let cachedTextEncoder = new lTextEncoder('utf-8');
120
-
121
- const encodeString = (typeof cachedTextEncoder.encodeInto === 'function'
122
- ? function (arg, view) {
123
- return cachedTextEncoder.encodeInto(arg, view);
124
- }
125
- : function (arg, view) {
126
- const buf = cachedTextEncoder.encode(arg);
127
- view.set(buf);
128
- return {
129
- read: arg.length,
130
- written: buf.length
131
- };
132
- });
133
-
134
- function passStringToWasm0(arg, malloc, realloc) {
135
-
136
- if (realloc === undefined) {
137
- const buf = cachedTextEncoder.encode(arg);
138
- const ptr = malloc(buf.length);
139
- getUint8Memory0().subarray(ptr, ptr + buf.length).set(buf);
140
- WASM_VECTOR_LEN = buf.length;
141
- return ptr;
142
- }
143
-
144
- let len = arg.length;
145
- let ptr = malloc(len);
146
-
147
- const mem = getUint8Memory0();
148
-
149
- let offset = 0;
150
-
151
- for (; offset < len; offset++) {
152
- const code = arg.charCodeAt(offset);
153
- if (code > 0x7F) break;
154
- mem[ptr + offset] = code;
155
- }
156
-
157
- if (offset !== len) {
158
- if (offset !== 0) {
159
- arg = arg.slice(offset);
160
- }
161
- ptr = realloc(ptr, len, len = offset + arg.length * 3);
162
- const view = getUint8Memory0().subarray(ptr + offset, ptr + len);
163
- const ret = encodeString(arg, view);
164
-
165
- offset += ret.written;
183
+ /**
184
+ * @param {string} text
185
+ * @returns {string}
186
+ */
187
+ export function escape(text) {
188
+ try {
189
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
190
+ var ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
191
+ var len0 = WASM_VECTOR_LEN;
192
+ wasm.escape(retptr, ptr0, len0);
193
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
194
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
195
+ return getStringFromWasm0(r0, r1);
196
+ } finally {
197
+ wasm.__wbindgen_add_to_stack_pointer(16);
198
+ wasm.__wbindgen_free(r0, r1);
166
199
  }
167
-
168
- WASM_VECTOR_LEN = offset;
169
- return ptr;
170
200
  }
171
201
 
172
- let cachegetInt32Memory0 = null;
173
- function getInt32Memory0() {
174
- if (cachegetInt32Memory0 === null || cachegetInt32Memory0.buffer !== wasm.memory.buffer) {
175
- cachegetInt32Memory0 = new Int32Array(wasm.memory.buffer);
176
- }
177
- return cachegetInt32Memory0;
178
- }
179
202
  /**
180
203
  * @returns {any}
181
204
  */
@@ -184,6 +207,14 @@ export function get_metadata() {
184
207
  return takeObject(ret);
185
208
  }
186
209
 
210
+ let stack_pointer = 32;
211
+
212
+ function addBorrowedObject(obj) {
213
+ if (stack_pointer == 1) throw new Error('out of js stack');
214
+ heap[--stack_pointer] = obj;
215
+ return stack_pointer;
216
+ }
217
+
187
218
  function handleError(f, args) {
188
219
  try {
189
220
  return f.apply(this, args);
@@ -192,11 +223,13 @@ function handleError(f, args) {
192
223
  }
193
224
  }
194
225
  /**
226
+ * A compiled regular expression for matching Unicode strings.
227
+ * @see https://docs.rs/regex/latest/regex/
195
228
  */
196
- export class RRegExp {
229
+ export class RRegex {
197
230
 
198
231
  static __wrap(ptr) {
199
- const obj = Object.create(RRegExp.prototype);
232
+ const obj = Object.create(RRegex.prototype);
200
233
  obj.ptr = ptr;
201
234
 
202
235
  return obj;
@@ -211,70 +244,90 @@ export class RRegExp {
211
244
 
212
245
  free() {
213
246
  const ptr = this.__destroy_into_raw();
214
- wasm.__wbg_rregexp_free(ptr);
247
+ wasm.__wbg_rregex_free(ptr);
215
248
  }
216
249
  /**
250
+ * Compiles a regular expression. Once compiled, it can be used repeatedly to search, split or replace text in a string.
251
+ * If an invalid expression is given, then an error is returned.
217
252
  * @param {string} re
218
253
  */
219
254
  constructor(re) {
220
255
  var ptr0 = passStringToWasm0(re, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
221
256
  var len0 = WASM_VECTOR_LEN;
222
- var ret = wasm.rregexp_new(ptr0, len0);
223
- return RRegExp.__wrap(ret);
257
+ var ret = wasm.rregex_new(ptr0, len0);
258
+ return RRegex.__wrap(ret);
224
259
  }
225
260
  /**
261
+ * Returns true if and only if there is a match for the regex in the string given.
262
+ * 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.
263
+ * @see https://docs.rs/regex/latest/regex/struct.Regex.html#method.is_match
226
264
  * @param {string} text
227
265
  * @returns {boolean}
228
266
  */
229
- is_match(text) {
267
+ isMatch(text) {
230
268
  var ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
231
269
  var len0 = WASM_VECTOR_LEN;
232
- var ret = wasm.rregexp_is_match(this.ptr, ptr0, len0);
270
+ var ret = wasm.rregex_isMatch(this.ptr, ptr0, len0);
233
271
  return ret !== 0;
234
272
  }
235
273
  /**
274
+ * Returns the same as is_match, but starts the search at the given offset.
275
+ * 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`.
276
+ * @see https://docs.rs/regex/latest/regex/struct.Regex.html#method.is_match_at
236
277
  * @param {string} text
237
278
  * @param {number} start
238
279
  * @returns {boolean}
239
280
  */
240
- is_match_at(text, start) {
281
+ isMatchAt(text, start) {
241
282
  var ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
242
283
  var len0 = WASM_VECTOR_LEN;
243
- var ret = wasm.rregexp_is_match_at(this.ptr, ptr0, len0, start);
284
+ var ret = wasm.rregex_isMatchAt(this.ptr, ptr0, len0, start);
244
285
  return ret !== 0;
245
286
  }
246
287
  /**
288
+ * Returns the start and end byte range of the leftmost-first match in `text`. If no match exists, then `undefined` is returned.
289
+ * 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`.
290
+ * @see https://docs.rs/regex/latest/regex/struct.Regex.html#method.find
247
291
  * @param {string} text
248
292
  * @returns {any}
249
293
  */
250
294
  find(text) {
251
295
  var ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
252
296
  var len0 = WASM_VECTOR_LEN;
253
- var ret = wasm.rregexp_find(this.ptr, ptr0, len0);
297
+ var ret = wasm.rregex_find(this.ptr, ptr0, len0);
254
298
  return takeObject(ret);
255
299
  }
256
300
  /**
301
+ * Returns the same as find, but starts the search at the given offset.
302
+ * 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`.
303
+ * @see https://docs.rs/regex/latest/regex/struct.Regex.html#method.find_at
257
304
  * @param {string} text
258
305
  * @param {number} start
259
306
  * @returns {any}
260
307
  */
261
- find_at(text, start) {
308
+ findAt(text, start) {
262
309
  var ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
263
310
  var len0 = WASM_VECTOR_LEN;
264
- var ret = wasm.rregexp_find_at(this.ptr, ptr0, len0, start);
311
+ var ret = wasm.rregex_findAt(this.ptr, ptr0, len0, start);
265
312
  return takeObject(ret);
266
313
  }
267
314
  /**
315
+ * Returns an array for each successive non-overlapping match in text, returning the start and end byte indices with respect to text.
316
+ * @see https://docs.rs/regex/latest/regex/struct.Regex.html#method.find_iter
268
317
  * @param {string} text
269
318
  * @returns {any}
270
319
  */
271
- find_all(text) {
320
+ findAll(text) {
272
321
  var ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
273
322
  var len0 = WASM_VECTOR_LEN;
274
- var ret = wasm.rregexp_find_all(this.ptr, ptr0, len0);
323
+ var ret = wasm.rregex_findAll(this.ptr, ptr0, len0);
275
324
  return takeObject(ret);
276
325
  }
277
326
  /**
327
+ * Replaces the leftmost-first match with the replacement provided.
328
+ * 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.
329
+ * If no match is found, then a copy of the string is returned unchanged.
330
+ * @see https://docs.rs/regex/latest/regex/struct.Regex.html#method.replace
278
331
  * @param {string} text
279
332
  * @param {string} rep
280
333
  * @returns {string}
@@ -286,7 +339,7 @@ export class RRegExp {
286
339
  var len0 = WASM_VECTOR_LEN;
287
340
  var ptr1 = passStringToWasm0(rep, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
288
341
  var len1 = WASM_VECTOR_LEN;
289
- wasm.rregexp_replace(retptr, this.ptr, ptr0, len0, ptr1, len1);
342
+ wasm.rregex_replace(retptr, this.ptr, ptr0, len0, ptr1, len1);
290
343
  var r0 = getInt32Memory0()[retptr / 4 + 0];
291
344
  var r1 = getInt32Memory0()[retptr / 4 + 1];
292
345
  return getStringFromWasm0(r0, r1);
@@ -296,6 +349,9 @@ export class RRegExp {
296
349
  }
297
350
  }
298
351
  /**
352
+ * Replaces at most `limit` non-overlapping matches in `text` with the replacement provided. If `limit` is 0, then all non-overlapping matches are replaced.
353
+ * See the documentation for `replace` for details on how to access capturing group matches in the replacement string.
354
+ * @see https://docs.rs/regex/latest/regex/struct.Regex.html#method.replacen
299
355
  * @param {string} text
300
356
  * @param {number} limit
301
357
  * @param {string} rep
@@ -308,7 +364,7 @@ export class RRegExp {
308
364
  var len0 = WASM_VECTOR_LEN;
309
365
  var ptr1 = passStringToWasm0(rep, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
310
366
  var len1 = WASM_VECTOR_LEN;
311
- wasm.rregexp_replacen(retptr, this.ptr, ptr0, len0, limit, ptr1, len1);
367
+ wasm.rregex_replacen(retptr, this.ptr, ptr0, len0, limit, ptr1, len1);
312
368
  var r0 = getInt32Memory0()[retptr / 4 + 0];
313
369
  var r1 = getInt32Memory0()[retptr / 4 + 1];
314
370
  return getStringFromWasm0(r0, r1);
@@ -318,18 +374,21 @@ export class RRegExp {
318
374
  }
319
375
  }
320
376
  /**
377
+ * Replaces all non-overlapping matches in `text` with the replacement provided. This is the same as calling `replacen` with `limit` set to `0`.
378
+ * See the documentation for `replace` for details on how to access capturing group matches in the replacement string.
379
+ * @see https://docs.rs/regex/latest/regex/struct.Regex.html#method.replace_all
321
380
  * @param {string} text
322
381
  * @param {string} rep
323
382
  * @returns {string}
324
383
  */
325
- replace_all(text, rep) {
384
+ replaceAll(text, rep) {
326
385
  try {
327
386
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
328
387
  var ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
329
388
  var len0 = WASM_VECTOR_LEN;
330
389
  var ptr1 = passStringToWasm0(rep, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
331
390
  var len1 = WASM_VECTOR_LEN;
332
- wasm.rregexp_replace_all(retptr, this.ptr, ptr0, len0, ptr1, len1);
391
+ wasm.rregex_replaceAll(retptr, this.ptr, ptr0, len0, ptr1, len1);
333
392
  var r0 = getInt32Memory0()[retptr / 4 + 0];
334
393
  var r1 = getInt32Memory0()[retptr / 4 + 1];
335
394
  return getStringFromWasm0(r0, r1);
@@ -339,16 +398,22 @@ export class RRegExp {
339
398
  }
340
399
  }
341
400
  /**
401
+ * 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.
402
+ * This method will not copy the text given.
403
+ * @see https://docs.rs/regex/latest/regex/struct.Regex.html#method.split
342
404
  * @param {string} text
343
405
  * @returns {any}
344
406
  */
345
407
  split(text) {
346
408
  var ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
347
409
  var len0 = WASM_VECTOR_LEN;
348
- var ret = wasm.rregexp_split(this.ptr, ptr0, len0);
410
+ var ret = wasm.rregex_split(this.ptr, ptr0, len0);
349
411
  return takeObject(ret);
350
412
  }
351
413
  /**
414
+ * 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.
415
+ * This method will not copy the text given.
416
+ * @see https://docs.rs/regex/latest/regex/struct.Regex.html#method.splitn
352
417
  * @param {string} text
353
418
  * @param {number} limit
354
419
  * @returns {any}
@@ -356,14 +421,136 @@ export class RRegExp {
356
421
  splitn(text, limit) {
357
422
  var ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
358
423
  var len0 = WASM_VECTOR_LEN;
359
- var ret = wasm.rregexp_splitn(this.ptr, ptr0, len0, limit);
424
+ var ret = wasm.rregex_splitn(this.ptr, ptr0, len0, limit);
360
425
  return takeObject(ret);
361
426
  }
362
427
  /**
428
+ * Returns the end location of a match in the text given.
429
+ * 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.
430
+ * @see https://docs.rs/regex/latest/regex/struct.Regex.html#method.shortest_match
431
+ * @param {string} text
432
+ * @returns {number | undefined}
433
+ */
434
+ shortestMatch(text) {
435
+ try {
436
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
437
+ var ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
438
+ var len0 = WASM_VECTOR_LEN;
439
+ wasm.rregex_shortestMatch(retptr, this.ptr, ptr0, len0);
440
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
441
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
442
+ return r0 === 0 ? undefined : r1 >>> 0;
443
+ } finally {
444
+ wasm.__wbindgen_add_to_stack_pointer(16);
445
+ }
446
+ }
447
+ /**
448
+ * Returns the same as shortest_match, but starts the search at the given offset.
449
+ * 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`.
450
+ * @see https://docs.rs/regex/latest/regex/struct.Regex.html#method.shortest_match_at
451
+ * @param {string} text
452
+ * @param {number} limit
453
+ * @returns {number | undefined}
454
+ */
455
+ shortestMatchAt(text, limit) {
456
+ try {
457
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
458
+ var ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
459
+ var len0 = WASM_VECTOR_LEN;
460
+ wasm.rregex_shortestMatchAt(retptr, this.ptr, ptr0, len0, limit);
461
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
462
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
463
+ return r0 === 0 ? undefined : r1 >>> 0;
464
+ } finally {
465
+ wasm.__wbindgen_add_to_stack_pointer(16);
466
+ }
467
+ }
468
+ /**
469
+ * Return the Regex syntax object
363
470
  * @returns {any}
364
471
  */
365
472
  syntax() {
366
- var ret = wasm.rregexp_syntax(this.ptr);
473
+ var ret = wasm.rregex_syntax(this.ptr);
474
+ return takeObject(ret);
475
+ }
476
+ /**
477
+ * Returns a string representing the regular expression
478
+ * @returns {string}
479
+ */
480
+ toString() {
481
+ try {
482
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
483
+ wasm.rregex_toString(retptr, this.ptr);
484
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
485
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
486
+ return getStringFromWasm0(r0, r1);
487
+ } finally {
488
+ wasm.__wbindgen_add_to_stack_pointer(16);
489
+ wasm.__wbindgen_free(r0, r1);
490
+ }
491
+ }
492
+ }
493
+ /**
494
+ * Match multiple (possibly overlapping) regular expressions in a single scan.
495
+ * 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.
496
+ * @see https://docs.rs/regex/latest/regex/struct.RegexSet.html#method.empty
497
+ */
498
+ export class RRegexSet {
499
+
500
+ static __wrap(ptr) {
501
+ const obj = Object.create(RRegexSet.prototype);
502
+ obj.ptr = ptr;
503
+
504
+ return obj;
505
+ }
506
+
507
+ __destroy_into_raw() {
508
+ const ptr = this.ptr;
509
+ this.ptr = 0;
510
+
511
+ return ptr;
512
+ }
513
+
514
+ free() {
515
+ const ptr = this.__destroy_into_raw();
516
+ wasm.__wbg_rregexset_free(ptr);
517
+ }
518
+ /**
519
+ * Create a new regex set with the given regular expressions.
520
+ * @param {Array<any>} list
521
+ */
522
+ constructor(list) {
523
+ try {
524
+ var ret = wasm.rregexset_new(addBorrowedObject(list));
525
+ return RRegexSet.__wrap(ret);
526
+ } finally {
527
+ heap[stack_pointer++] = undefined;
528
+ }
529
+ }
530
+ /**
531
+ * Returns true if and only if one of the regexes in this set matches the text given.
532
+ * 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.
533
+ * @see https://docs.rs/regex/latest/regex/struct.RegexSet.html#method.is_match
534
+ * @param {string} text
535
+ * @returns {boolean}
536
+ */
537
+ isMatch(text) {
538
+ var ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
539
+ var len0 = WASM_VECTOR_LEN;
540
+ var ret = wasm.rregexset_isMatch(this.ptr, ptr0, len0);
541
+ return ret !== 0;
542
+ }
543
+ /**
544
+ * Returns the set of regular expressions that match in the given text.
545
+ * 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.
546
+ * the set can also be used to iterate over the matched indices.
547
+ * @param {string} text
548
+ * @returns {any}
549
+ */
550
+ matches(text) {
551
+ var ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
552
+ var len0 = WASM_VECTOR_LEN;
553
+ var ret = wasm.rregexset_matches(this.ptr, ptr0, len0);
367
554
  return takeObject(ret);
368
555
  }
369
556
  }
@@ -382,6 +569,30 @@ export function __wbindgen_number_new(arg0) {
382
569
  return addHeapObject(ret);
383
570
  };
384
571
 
572
+ export function __wbindgen_is_string(arg0) {
573
+ var ret = typeof(getObject(arg0)) === 'string';
574
+ return ret;
575
+ };
576
+
577
+ export function __wbindgen_string_get(arg0, arg1) {
578
+ const obj = getObject(arg1);
579
+ var ret = typeof(obj) === 'string' ? obj : undefined;
580
+ var ptr0 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
581
+ var len0 = WASM_VECTOR_LEN;
582
+ getInt32Memory0()[arg0 / 4 + 1] = len0;
583
+ getInt32Memory0()[arg0 / 4 + 0] = ptr0;
584
+ };
585
+
586
+ export function __wbg_get_67189fe0b323d288(arg0, arg1) {
587
+ var ret = getObject(arg0)[arg1 >>> 0];
588
+ return addHeapObject(ret);
589
+ };
590
+
591
+ export function __wbg_length_42e02f5a04d67464(arg0) {
592
+ var ret = getObject(arg0).length;
593
+ return ret;
594
+ };
595
+
385
596
  export function __wbg_new_949bbc1147195c4e() {
386
597
  var ret = new Array();
387
598
  return addHeapObject(ret);
package/lib/rregex.wasm CHANGED
Binary file
@@ -1,20 +1,28 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
3
  export const memory: WebAssembly.Memory;
4
- export function __wbg_rregexp_free(a: number): void;
5
- export function rregexp_new(a: number, b: number): number;
6
- export function rregexp_is_match(a: number, b: number, c: number): number;
7
- export function rregexp_is_match_at(a: number, b: number, c: number, d: number): number;
8
- export function rregexp_find(a: number, b: number, c: number): number;
9
- export function rregexp_find_at(a: number, b: number, c: number, d: number): number;
10
- export function rregexp_find_all(a: number, b: number, c: number): number;
11
- export function rregexp_replace(a: number, b: number, c: number, d: number, e: number, f: number): void;
12
- export function rregexp_replacen(a: number, b: number, c: number, d: number, e: number, f: number, g: number): void;
13
- export function rregexp_replace_all(a: number, b: number, c: number, d: number, e: number, f: number): void;
14
- export function rregexp_split(a: number, b: number, c: number): number;
15
- export function rregexp_splitn(a: number, b: number, c: number, d: number): number;
16
- export function rregexp_syntax(a: number): number;
4
+ export function escape(a: number, b: number, c: number): void;
5
+ export function __wbg_rregex_free(a: number): void;
6
+ export function rregex_new(a: number, b: number): number;
7
+ export function rregex_isMatch(a: number, b: number, c: number): number;
8
+ export function rregex_isMatchAt(a: number, b: number, c: number, d: number): number;
9
+ export function rregex_find(a: number, b: number, c: number): number;
10
+ export function rregex_findAt(a: number, b: number, c: number, d: number): number;
11
+ export function rregex_findAll(a: number, b: number, c: number): number;
12
+ export function rregex_replace(a: number, b: number, c: number, d: number, e: number, f: number): void;
13
+ export function rregex_replacen(a: number, b: number, c: number, d: number, e: number, f: number, g: number): void;
14
+ export function rregex_replaceAll(a: number, b: number, c: number, d: number, e: number, f: number): void;
15
+ export function rregex_split(a: number, b: number, c: number): number;
16
+ export function rregex_splitn(a: number, b: number, c: number, d: number): number;
17
+ export function rregex_shortestMatch(a: number, b: number, c: number, d: number): void;
18
+ export function rregex_shortestMatchAt(a: number, b: number, c: number, d: number, e: number): void;
19
+ export function rregex_syntax(a: number): number;
20
+ export function rregex_toString(a: number, b: number): void;
17
21
  export function get_metadata(): number;
22
+ export function __wbg_rregexset_free(a: number): void;
23
+ export function rregexset_new(a: number): number;
24
+ export function rregexset_isMatch(a: number, b: number, c: number): number;
25
+ export function rregexset_matches(a: number, b: number, c: number): number;
18
26
  export function __wbindgen_malloc(a: number): number;
19
27
  export function __wbindgen_realloc(a: number, b: number, c: number): number;
20
28
  export function __wbindgen_add_to_stack_pointer(a: number): number;