@pid7/ashwa 0.2.0 → 0.2.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/README.md +154 -58
- package/browser.js +27 -6
- package/browser.mjs +30 -2
- package/index.d.ts +27 -1
- package/index.js +17 -0
- package/index.mjs +17 -0
- package/native/index.d.ts +31 -1
- package/native/index.darwin-arm64.node +0 -0
- package/native/index.js +643 -361
- package/native/index.linux-arm64-gnu.node +0 -0
- package/native/index.linux-x64-gnu.node +0 -0
- package/native/index.win32-arm64-msvc.node +0 -0
- package/native/index.win32-x64-msvc.node +0 -0
- package/package.json +1 -1
- package/wasm/pkg/ashwa_wasm.d.ts +14 -0
- package/wasm/pkg/ashwa_wasm.js +23 -0
- package/wasm/pkg/ashwa_wasm_bg.wasm +0 -0
- package/wasm/pkg/ashwa_wasm_bg.wasm.d.ts +1 -0
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/package.json
CHANGED
package/wasm/pkg/ashwa_wasm.d.ts
CHANGED
|
@@ -14,11 +14,25 @@
|
|
|
14
14
|
*/
|
|
15
15
|
export function searchOne(haystack: Uint8Array, needle: number): bigint | undefined;
|
|
16
16
|
|
|
17
|
+
/**
|
|
18
|
+
* Searches for the first occurrence of a two-byte `needle` in `haystack`.
|
|
19
|
+
*
|
|
20
|
+
* # Arguments
|
|
21
|
+
* * `haystack` - A byte slice (`&[u8]`) to search within.
|
|
22
|
+
* * `needle` - A 2-byte slice (`&[u8]`) to locate.
|
|
23
|
+
*
|
|
24
|
+
* # Returns
|
|
25
|
+
* * `Some(index)` - The 0-based byte index of the first match.
|
|
26
|
+
* * `None` - If `needle` is not found.
|
|
27
|
+
*/
|
|
28
|
+
export function searchTwo(haystack: Uint8Array, needle: Uint8Array): bigint | undefined;
|
|
29
|
+
|
|
17
30
|
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
|
18
31
|
|
|
19
32
|
export interface InitOutput {
|
|
20
33
|
readonly memory: WebAssembly.Memory;
|
|
21
34
|
readonly searchOne: (a: number, b: number, c: number) => [number, bigint];
|
|
35
|
+
readonly searchTwo: (a: number, b: number, c: number, d: number) => [number, bigint];
|
|
22
36
|
readonly __wbindgen_externrefs: WebAssembly.Table;
|
|
23
37
|
readonly __wbindgen_malloc: (a: number, b: number) => number;
|
|
24
38
|
readonly __wbindgen_start: () => void;
|
package/wasm/pkg/ashwa_wasm.js
CHANGED
|
@@ -20,6 +20,29 @@ export function searchOne(haystack, needle) {
|
|
|
20
20
|
const ret = wasm.searchOne(ptr0, len0, needle);
|
|
21
21
|
return ret[0] === 0 ? undefined : ret[1];
|
|
22
22
|
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Searches for the first occurrence of a two-byte `needle` in `haystack`.
|
|
26
|
+
*
|
|
27
|
+
* # Arguments
|
|
28
|
+
* * `haystack` - A byte slice (`&[u8]`) to search within.
|
|
29
|
+
* * `needle` - A 2-byte slice (`&[u8]`) to locate.
|
|
30
|
+
*
|
|
31
|
+
* # Returns
|
|
32
|
+
* * `Some(index)` - The 0-based byte index of the first match.
|
|
33
|
+
* * `None` - If `needle` is not found.
|
|
34
|
+
* @param {Uint8Array} haystack
|
|
35
|
+
* @param {Uint8Array} needle
|
|
36
|
+
* @returns {bigint | undefined}
|
|
37
|
+
*/
|
|
38
|
+
export function searchTwo(haystack, needle) {
|
|
39
|
+
const ptr0 = passArray8ToWasm0(haystack, wasm.__wbindgen_malloc);
|
|
40
|
+
const len0 = WASM_VECTOR_LEN;
|
|
41
|
+
const ptr1 = passArray8ToWasm0(needle, wasm.__wbindgen_malloc);
|
|
42
|
+
const len1 = WASM_VECTOR_LEN;
|
|
43
|
+
const ret = wasm.searchTwo(ptr0, len0, ptr1, len1);
|
|
44
|
+
return ret[0] === 0 ? undefined : ret[1];
|
|
45
|
+
}
|
|
23
46
|
function __wbg_get_imports() {
|
|
24
47
|
const import0 = {
|
|
25
48
|
__proto__: null,
|
|
Binary file
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
export const memory: WebAssembly.Memory;
|
|
4
4
|
export const searchOne: (a: number, b: number, c: number) => [number, bigint];
|
|
5
|
+
export const searchTwo: (a: number, b: number, c: number, d: number) => [number, bigint];
|
|
5
6
|
export const __wbindgen_externrefs: WebAssembly.Table;
|
|
6
7
|
export const __wbindgen_malloc: (a: number, b: number) => number;
|
|
7
8
|
export const __wbindgen_start: () => void;
|