rregex 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/README.md +2 -0
- package/lib/browser.d.ts +111 -0
- package/lib/browser.js +465 -0
- package/lib/commonjs.d.ts +76 -0
- package/lib/commonjs.js +433 -0
- package/lib/module.d.ts +76 -0
- package/lib/module.js +425 -0
- package/lib/rregex.wasm +0 -0
- package/lib/rregex.wasm.d.ts +22 -0
- package/lib/types.d.ts +111 -0
- package/package.json +35 -0
package/lib/browser.js
ADDED
|
@@ -0,0 +1,465 @@
|
|
|
1
|
+
|
|
2
|
+
let wasm;
|
|
3
|
+
|
|
4
|
+
const heap = new Array(32).fill(undefined);
|
|
5
|
+
|
|
6
|
+
heap.push(undefined, null, true, false);
|
|
7
|
+
|
|
8
|
+
function getObject(idx) { return heap[idx]; }
|
|
9
|
+
|
|
10
|
+
let heap_next = heap.length;
|
|
11
|
+
|
|
12
|
+
function dropObject(idx) {
|
|
13
|
+
if (idx < 36) return;
|
|
14
|
+
heap[idx] = heap_next;
|
|
15
|
+
heap_next = idx;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function takeObject(idx) {
|
|
19
|
+
const ret = getObject(idx);
|
|
20
|
+
dropObject(idx);
|
|
21
|
+
return ret;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
25
|
+
|
|
26
|
+
cachedTextDecoder.decode();
|
|
27
|
+
|
|
28
|
+
let cachegetUint8Memory0 = null;
|
|
29
|
+
function getUint8Memory0() {
|
|
30
|
+
if (cachegetUint8Memory0 === null || cachegetUint8Memory0.buffer !== wasm.memory.buffer) {
|
|
31
|
+
cachegetUint8Memory0 = new Uint8Array(wasm.memory.buffer);
|
|
32
|
+
}
|
|
33
|
+
return cachegetUint8Memory0;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function getStringFromWasm0(ptr, len) {
|
|
37
|
+
return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function addHeapObject(obj) {
|
|
41
|
+
if (heap_next === heap.length) heap.push(heap.length + 1);
|
|
42
|
+
const idx = heap_next;
|
|
43
|
+
heap_next = heap[idx];
|
|
44
|
+
|
|
45
|
+
heap[idx] = obj;
|
|
46
|
+
return idx;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function debugString(val) {
|
|
50
|
+
// primitive types
|
|
51
|
+
const type = typeof val;
|
|
52
|
+
if (type == 'number' || type == 'boolean' || val == null) {
|
|
53
|
+
return `${val}`;
|
|
54
|
+
}
|
|
55
|
+
if (type == 'string') {
|
|
56
|
+
return `"${val}"`;
|
|
57
|
+
}
|
|
58
|
+
if (type == 'symbol') {
|
|
59
|
+
const description = val.description;
|
|
60
|
+
if (description == null) {
|
|
61
|
+
return 'Symbol';
|
|
62
|
+
} else {
|
|
63
|
+
return `Symbol(${description})`;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
if (type == 'function') {
|
|
67
|
+
const name = val.name;
|
|
68
|
+
if (typeof name == 'string' && name.length > 0) {
|
|
69
|
+
return `Function(${name})`;
|
|
70
|
+
} else {
|
|
71
|
+
return 'Function';
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
// objects
|
|
75
|
+
if (Array.isArray(val)) {
|
|
76
|
+
const length = val.length;
|
|
77
|
+
let debug = '[';
|
|
78
|
+
if (length > 0) {
|
|
79
|
+
debug += debugString(val[0]);
|
|
80
|
+
}
|
|
81
|
+
for(let i = 1; i < length; i++) {
|
|
82
|
+
debug += ', ' + debugString(val[i]);
|
|
83
|
+
}
|
|
84
|
+
debug += ']';
|
|
85
|
+
return debug;
|
|
86
|
+
}
|
|
87
|
+
// Test for built-in
|
|
88
|
+
const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
|
|
89
|
+
let className;
|
|
90
|
+
if (builtInMatches.length > 1) {
|
|
91
|
+
className = builtInMatches[1];
|
|
92
|
+
} else {
|
|
93
|
+
// Failed to match the standard '[object ClassName]'
|
|
94
|
+
return toString.call(val);
|
|
95
|
+
}
|
|
96
|
+
if (className == 'Object') {
|
|
97
|
+
// we're a user defined class or Object
|
|
98
|
+
// JSON.stringify avoids problems with cycles, and is generally much
|
|
99
|
+
// easier than looping through ownProperties of `val`.
|
|
100
|
+
try {
|
|
101
|
+
return 'Object(' + JSON.stringify(val) + ')';
|
|
102
|
+
} catch (_) {
|
|
103
|
+
return 'Object';
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
// errors
|
|
107
|
+
if (val instanceof Error) {
|
|
108
|
+
return `${val.name}: ${val.message}\n${val.stack}`;
|
|
109
|
+
}
|
|
110
|
+
// TODO we could test for more things here, like `Set`s and `Map`s.
|
|
111
|
+
return className;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
let WASM_VECTOR_LEN = 0;
|
|
115
|
+
|
|
116
|
+
let cachedTextEncoder = new TextEncoder('utf-8');
|
|
117
|
+
|
|
118
|
+
const encodeString = (typeof cachedTextEncoder.encodeInto === 'function'
|
|
119
|
+
? function (arg, view) {
|
|
120
|
+
return cachedTextEncoder.encodeInto(arg, view);
|
|
121
|
+
}
|
|
122
|
+
: function (arg, view) {
|
|
123
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
124
|
+
view.set(buf);
|
|
125
|
+
return {
|
|
126
|
+
read: arg.length,
|
|
127
|
+
written: buf.length
|
|
128
|
+
};
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
function passStringToWasm0(arg, malloc, realloc) {
|
|
132
|
+
|
|
133
|
+
if (realloc === undefined) {
|
|
134
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
135
|
+
const ptr = malloc(buf.length);
|
|
136
|
+
getUint8Memory0().subarray(ptr, ptr + buf.length).set(buf);
|
|
137
|
+
WASM_VECTOR_LEN = buf.length;
|
|
138
|
+
return ptr;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
let len = arg.length;
|
|
142
|
+
let ptr = malloc(len);
|
|
143
|
+
|
|
144
|
+
const mem = getUint8Memory0();
|
|
145
|
+
|
|
146
|
+
let offset = 0;
|
|
147
|
+
|
|
148
|
+
for (; offset < len; offset++) {
|
|
149
|
+
const code = arg.charCodeAt(offset);
|
|
150
|
+
if (code > 0x7F) break;
|
|
151
|
+
mem[ptr + offset] = code;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
if (offset !== len) {
|
|
155
|
+
if (offset !== 0) {
|
|
156
|
+
arg = arg.slice(offset);
|
|
157
|
+
}
|
|
158
|
+
ptr = realloc(ptr, len, len = offset + arg.length * 3);
|
|
159
|
+
const view = getUint8Memory0().subarray(ptr + offset, ptr + len);
|
|
160
|
+
const ret = encodeString(arg, view);
|
|
161
|
+
|
|
162
|
+
offset += ret.written;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
WASM_VECTOR_LEN = offset;
|
|
166
|
+
return ptr;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
let cachegetInt32Memory0 = null;
|
|
170
|
+
function getInt32Memory0() {
|
|
171
|
+
if (cachegetInt32Memory0 === null || cachegetInt32Memory0.buffer !== wasm.memory.buffer) {
|
|
172
|
+
cachegetInt32Memory0 = new Int32Array(wasm.memory.buffer);
|
|
173
|
+
}
|
|
174
|
+
return cachegetInt32Memory0;
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* @returns {any}
|
|
178
|
+
*/
|
|
179
|
+
export function get_metadata() {
|
|
180
|
+
var ret = wasm.get_metadata();
|
|
181
|
+
return takeObject(ret);
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
function handleError(f, args) {
|
|
185
|
+
try {
|
|
186
|
+
return f.apply(this, args);
|
|
187
|
+
} catch (e) {
|
|
188
|
+
wasm.__wbindgen_exn_store(addHeapObject(e));
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
*/
|
|
193
|
+
export class RRegExp {
|
|
194
|
+
|
|
195
|
+
static __wrap(ptr) {
|
|
196
|
+
const obj = Object.create(RRegExp.prototype);
|
|
197
|
+
obj.ptr = ptr;
|
|
198
|
+
|
|
199
|
+
return obj;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
__destroy_into_raw() {
|
|
203
|
+
const ptr = this.ptr;
|
|
204
|
+
this.ptr = 0;
|
|
205
|
+
|
|
206
|
+
return ptr;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
free() {
|
|
210
|
+
const ptr = this.__destroy_into_raw();
|
|
211
|
+
wasm.__wbg_rregexp_free(ptr);
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* @param {string} re
|
|
215
|
+
*/
|
|
216
|
+
constructor(re) {
|
|
217
|
+
var ptr0 = passStringToWasm0(re, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
218
|
+
var len0 = WASM_VECTOR_LEN;
|
|
219
|
+
var ret = wasm.rregexp_new(ptr0, len0);
|
|
220
|
+
return RRegExp.__wrap(ret);
|
|
221
|
+
}
|
|
222
|
+
/**
|
|
223
|
+
* @param {string} text
|
|
224
|
+
* @returns {boolean}
|
|
225
|
+
*/
|
|
226
|
+
is_match(text) {
|
|
227
|
+
var ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
228
|
+
var len0 = WASM_VECTOR_LEN;
|
|
229
|
+
var ret = wasm.rregexp_is_match(this.ptr, ptr0, len0);
|
|
230
|
+
return ret !== 0;
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
* @param {string} text
|
|
234
|
+
* @param {number} start
|
|
235
|
+
* @returns {boolean}
|
|
236
|
+
*/
|
|
237
|
+
is_match_at(text, start) {
|
|
238
|
+
var ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
239
|
+
var len0 = WASM_VECTOR_LEN;
|
|
240
|
+
var ret = wasm.rregexp_is_match_at(this.ptr, ptr0, len0, start);
|
|
241
|
+
return ret !== 0;
|
|
242
|
+
}
|
|
243
|
+
/**
|
|
244
|
+
* @param {string} text
|
|
245
|
+
* @returns {any}
|
|
246
|
+
*/
|
|
247
|
+
find(text) {
|
|
248
|
+
var ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
249
|
+
var len0 = WASM_VECTOR_LEN;
|
|
250
|
+
var ret = wasm.rregexp_find(this.ptr, ptr0, len0);
|
|
251
|
+
return takeObject(ret);
|
|
252
|
+
}
|
|
253
|
+
/**
|
|
254
|
+
* @param {string} text
|
|
255
|
+
* @param {number} start
|
|
256
|
+
* @returns {any}
|
|
257
|
+
*/
|
|
258
|
+
find_at(text, start) {
|
|
259
|
+
var ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
260
|
+
var len0 = WASM_VECTOR_LEN;
|
|
261
|
+
var ret = wasm.rregexp_find_at(this.ptr, ptr0, len0, start);
|
|
262
|
+
return takeObject(ret);
|
|
263
|
+
}
|
|
264
|
+
/**
|
|
265
|
+
* @param {string} text
|
|
266
|
+
* @returns {any}
|
|
267
|
+
*/
|
|
268
|
+
find_all(text) {
|
|
269
|
+
var ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
270
|
+
var len0 = WASM_VECTOR_LEN;
|
|
271
|
+
var ret = wasm.rregexp_find_all(this.ptr, ptr0, len0);
|
|
272
|
+
return takeObject(ret);
|
|
273
|
+
}
|
|
274
|
+
/**
|
|
275
|
+
* @param {string} text
|
|
276
|
+
* @param {string} rep
|
|
277
|
+
* @returns {string}
|
|
278
|
+
*/
|
|
279
|
+
replace(text, rep) {
|
|
280
|
+
try {
|
|
281
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
282
|
+
var ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
283
|
+
var len0 = WASM_VECTOR_LEN;
|
|
284
|
+
var ptr1 = passStringToWasm0(rep, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
285
|
+
var len1 = WASM_VECTOR_LEN;
|
|
286
|
+
wasm.rregexp_replace(retptr, this.ptr, ptr0, len0, ptr1, len1);
|
|
287
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
288
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
289
|
+
return getStringFromWasm0(r0, r1);
|
|
290
|
+
} finally {
|
|
291
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
292
|
+
wasm.__wbindgen_free(r0, r1);
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
/**
|
|
296
|
+
* @param {string} text
|
|
297
|
+
* @param {number} limit
|
|
298
|
+
* @param {string} rep
|
|
299
|
+
* @returns {string}
|
|
300
|
+
*/
|
|
301
|
+
replacen(text, limit, rep) {
|
|
302
|
+
try {
|
|
303
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
304
|
+
var ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
305
|
+
var len0 = WASM_VECTOR_LEN;
|
|
306
|
+
var ptr1 = passStringToWasm0(rep, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
307
|
+
var len1 = WASM_VECTOR_LEN;
|
|
308
|
+
wasm.rregexp_replacen(retptr, this.ptr, ptr0, len0, limit, ptr1, len1);
|
|
309
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
310
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
311
|
+
return getStringFromWasm0(r0, r1);
|
|
312
|
+
} finally {
|
|
313
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
314
|
+
wasm.__wbindgen_free(r0, r1);
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
/**
|
|
318
|
+
* @param {string} text
|
|
319
|
+
* @param {string} rep
|
|
320
|
+
* @returns {string}
|
|
321
|
+
*/
|
|
322
|
+
replace_all(text, rep) {
|
|
323
|
+
try {
|
|
324
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
325
|
+
var ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
326
|
+
var len0 = WASM_VECTOR_LEN;
|
|
327
|
+
var ptr1 = passStringToWasm0(rep, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
328
|
+
var len1 = WASM_VECTOR_LEN;
|
|
329
|
+
wasm.rregexp_replace_all(retptr, this.ptr, ptr0, len0, ptr1, len1);
|
|
330
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
331
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
332
|
+
return getStringFromWasm0(r0, r1);
|
|
333
|
+
} finally {
|
|
334
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
335
|
+
wasm.__wbindgen_free(r0, r1);
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
/**
|
|
339
|
+
* @param {string} text
|
|
340
|
+
* @returns {any}
|
|
341
|
+
*/
|
|
342
|
+
split(text) {
|
|
343
|
+
var ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
344
|
+
var len0 = WASM_VECTOR_LEN;
|
|
345
|
+
var ret = wasm.rregexp_split(this.ptr, ptr0, len0);
|
|
346
|
+
return takeObject(ret);
|
|
347
|
+
}
|
|
348
|
+
/**
|
|
349
|
+
* @param {string} text
|
|
350
|
+
* @param {number} limit
|
|
351
|
+
* @returns {any}
|
|
352
|
+
*/
|
|
353
|
+
splitn(text, limit) {
|
|
354
|
+
var ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
355
|
+
var len0 = WASM_VECTOR_LEN;
|
|
356
|
+
var ret = wasm.rregexp_splitn(this.ptr, ptr0, len0, limit);
|
|
357
|
+
return takeObject(ret);
|
|
358
|
+
}
|
|
359
|
+
/**
|
|
360
|
+
* @returns {any}
|
|
361
|
+
*/
|
|
362
|
+
syntax() {
|
|
363
|
+
var ret = wasm.rregexp_syntax(this.ptr);
|
|
364
|
+
return takeObject(ret);
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
async function load(module, imports) {
|
|
369
|
+
if (typeof Response === 'function' && module instanceof Response) {
|
|
370
|
+
if (typeof WebAssembly.instantiateStreaming === 'function') {
|
|
371
|
+
try {
|
|
372
|
+
return await WebAssembly.instantiateStreaming(module, imports);
|
|
373
|
+
|
|
374
|
+
} catch (e) {
|
|
375
|
+
if (module.headers.get('Content-Type') != 'application/wasm') {
|
|
376
|
+
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);
|
|
377
|
+
|
|
378
|
+
} else {
|
|
379
|
+
throw e;
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
const bytes = await module.arrayBuffer();
|
|
385
|
+
return await WebAssembly.instantiate(bytes, imports);
|
|
386
|
+
|
|
387
|
+
} else {
|
|
388
|
+
const instance = await WebAssembly.instantiate(module, imports);
|
|
389
|
+
|
|
390
|
+
if (instance instanceof WebAssembly.Instance) {
|
|
391
|
+
return { instance, module };
|
|
392
|
+
|
|
393
|
+
} else {
|
|
394
|
+
return instance;
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
async function init(input) {
|
|
400
|
+
if (typeof input === 'undefined') {
|
|
401
|
+
input = new URL('browser_bg.wasm', import.meta.url);
|
|
402
|
+
}
|
|
403
|
+
const imports = {};
|
|
404
|
+
imports.wbg = {};
|
|
405
|
+
imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
|
|
406
|
+
takeObject(arg0);
|
|
407
|
+
};
|
|
408
|
+
imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
|
|
409
|
+
var ret = getStringFromWasm0(arg0, arg1);
|
|
410
|
+
return addHeapObject(ret);
|
|
411
|
+
};
|
|
412
|
+
imports.wbg.__wbindgen_number_new = function(arg0) {
|
|
413
|
+
var ret = arg0;
|
|
414
|
+
return addHeapObject(ret);
|
|
415
|
+
};
|
|
416
|
+
imports.wbg.__wbg_new_949bbc1147195c4e = function() {
|
|
417
|
+
var ret = new Array();
|
|
418
|
+
return addHeapObject(ret);
|
|
419
|
+
};
|
|
420
|
+
imports.wbg.__wbg_new_0b83d3df67ecb33e = function() {
|
|
421
|
+
var ret = new Object();
|
|
422
|
+
return addHeapObject(ret);
|
|
423
|
+
};
|
|
424
|
+
imports.wbg.__wbg_push_284486ca27c6aa8b = function(arg0, arg1) {
|
|
425
|
+
var ret = getObject(arg0).push(getObject(arg1));
|
|
426
|
+
return ret;
|
|
427
|
+
};
|
|
428
|
+
imports.wbg.__wbg_new_342a24ca698edd87 = function(arg0, arg1) {
|
|
429
|
+
var ret = new Error(getStringFromWasm0(arg0, arg1));
|
|
430
|
+
return addHeapObject(ret);
|
|
431
|
+
};
|
|
432
|
+
imports.wbg.__wbg_set_82a4e8a85e31ac42 = function() { return handleError(function (arg0, arg1, arg2) {
|
|
433
|
+
var ret = Reflect.set(getObject(arg0), getObject(arg1), getObject(arg2));
|
|
434
|
+
return ret;
|
|
435
|
+
}, arguments) };
|
|
436
|
+
imports.wbg.__wbindgen_debug_string = function(arg0, arg1) {
|
|
437
|
+
var ret = debugString(getObject(arg1));
|
|
438
|
+
var ptr0 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
439
|
+
var len0 = WASM_VECTOR_LEN;
|
|
440
|
+
getInt32Memory0()[arg0 / 4 + 1] = len0;
|
|
441
|
+
getInt32Memory0()[arg0 / 4 + 0] = ptr0;
|
|
442
|
+
};
|
|
443
|
+
imports.wbg.__wbindgen_throw = function(arg0, arg1) {
|
|
444
|
+
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
445
|
+
};
|
|
446
|
+
imports.wbg.__wbindgen_rethrow = function(arg0) {
|
|
447
|
+
throw takeObject(arg0);
|
|
448
|
+
};
|
|
449
|
+
|
|
450
|
+
if (typeof input === 'string' || (typeof Request === 'function' && input instanceof Request) || (typeof URL === 'function' && input instanceof URL)) {
|
|
451
|
+
input = fetch(input);
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
|
|
455
|
+
|
|
456
|
+
const { instance, module } = await load(await input, imports);
|
|
457
|
+
|
|
458
|
+
wasm = instance.exports;
|
|
459
|
+
init.__wbindgen_wasm_module = module;
|
|
460
|
+
|
|
461
|
+
return wasm;
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
export default init;
|
|
465
|
+
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
/**
|
|
4
|
+
* @returns {any}
|
|
5
|
+
*/
|
|
6
|
+
export function get_metadata(): any;
|
|
7
|
+
/**
|
|
8
|
+
*/
|
|
9
|
+
export class RRegExp {
|
|
10
|
+
free(): void;
|
|
11
|
+
/**
|
|
12
|
+
* @param {string} re
|
|
13
|
+
*/
|
|
14
|
+
constructor(re: string);
|
|
15
|
+
/**
|
|
16
|
+
* @param {string} text
|
|
17
|
+
* @returns {boolean}
|
|
18
|
+
*/
|
|
19
|
+
is_match(text: string): boolean;
|
|
20
|
+
/**
|
|
21
|
+
* @param {string} text
|
|
22
|
+
* @param {number} start
|
|
23
|
+
* @returns {boolean}
|
|
24
|
+
*/
|
|
25
|
+
is_match_at(text: string, start: number): boolean;
|
|
26
|
+
/**
|
|
27
|
+
* @param {string} text
|
|
28
|
+
* @returns {any}
|
|
29
|
+
*/
|
|
30
|
+
find(text: string): any;
|
|
31
|
+
/**
|
|
32
|
+
* @param {string} text
|
|
33
|
+
* @param {number} start
|
|
34
|
+
* @returns {any}
|
|
35
|
+
*/
|
|
36
|
+
find_at(text: string, start: number): any;
|
|
37
|
+
/**
|
|
38
|
+
* @param {string} text
|
|
39
|
+
* @returns {any}
|
|
40
|
+
*/
|
|
41
|
+
find_all(text: string): any;
|
|
42
|
+
/**
|
|
43
|
+
* @param {string} text
|
|
44
|
+
* @param {string} rep
|
|
45
|
+
* @returns {string}
|
|
46
|
+
*/
|
|
47
|
+
replace(text: string, rep: string): string;
|
|
48
|
+
/**
|
|
49
|
+
* @param {string} text
|
|
50
|
+
* @param {number} limit
|
|
51
|
+
* @param {string} rep
|
|
52
|
+
* @returns {string}
|
|
53
|
+
*/
|
|
54
|
+
replacen(text: string, limit: number, rep: string): string;
|
|
55
|
+
/**
|
|
56
|
+
* @param {string} text
|
|
57
|
+
* @param {string} rep
|
|
58
|
+
* @returns {string}
|
|
59
|
+
*/
|
|
60
|
+
replace_all(text: string, rep: string): string;
|
|
61
|
+
/**
|
|
62
|
+
* @param {string} text
|
|
63
|
+
* @returns {any}
|
|
64
|
+
*/
|
|
65
|
+
split(text: string): any;
|
|
66
|
+
/**
|
|
67
|
+
* @param {string} text
|
|
68
|
+
* @param {number} limit
|
|
69
|
+
* @returns {any}
|
|
70
|
+
*/
|
|
71
|
+
splitn(text: string, limit: number): any;
|
|
72
|
+
/**
|
|
73
|
+
* @returns {any}
|
|
74
|
+
*/
|
|
75
|
+
syntax(): any;
|
|
76
|
+
}
|