@hazae41/stdbob 0.0.12 → 0.0.14
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/package.json +1 -1
- package/src/mods/bigints/mod.ts +0 -9
- package/src/mods/modules/mod.ts +1 -1
- package/src/mods/packs/mod.ts +0 -9
- package/src/mods/storage/mod.ts +3 -3
- package/src/mods/texts/mod.ts +18 -18
package/package.json
CHANGED
package/src/mods/bigints/mod.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { blobref } from "../blobs/mod";
|
|
2
1
|
import { textref } from "../texts/mod";
|
|
3
2
|
|
|
4
3
|
export type bigintref = externref
|
|
@@ -77,14 +76,6 @@ export namespace bigints {
|
|
|
77
76
|
@external("bigints", "pow")
|
|
78
77
|
export declare function pow(left: bigintref, right: bigintref): bigintref
|
|
79
78
|
|
|
80
|
-
// @ts-ignore: decorator
|
|
81
|
-
@external("bigints", "encode")
|
|
82
|
-
export declare function encode(bigint: bigintref): blobref
|
|
83
|
-
|
|
84
|
-
// @ts-ignore: decorator
|
|
85
|
-
@external("bigints", "decode")
|
|
86
|
-
export declare function decode(blob: blobref): bigintref
|
|
87
|
-
|
|
88
79
|
// @ts-ignore: decorator
|
|
89
80
|
@external("bigints", "from_base16")
|
|
90
81
|
export declare function fromBase16(text: textref): bigintref
|
package/src/mods/modules/mod.ts
CHANGED
|
@@ -9,7 +9,7 @@ export namespace modules {
|
|
|
9
9
|
|
|
10
10
|
// @ts-ignore: decorator
|
|
11
11
|
@external("modules", "call")
|
|
12
|
-
export declare function call(module: blobref, method: blobref, params: packref):
|
|
12
|
+
export declare function call<T>(module: blobref, method: blobref, params: packref): T
|
|
13
13
|
|
|
14
14
|
// @ts-ignore: decorator
|
|
15
15
|
@external("modules", "create")
|
package/src/mods/packs/mod.ts
CHANGED
|
@@ -1,17 +1,8 @@
|
|
|
1
|
-
import { blobref } from "../blobs/mod";
|
|
2
1
|
|
|
3
2
|
export type packref = externref
|
|
4
3
|
|
|
5
4
|
export namespace packs {
|
|
6
5
|
|
|
7
|
-
// @ts-ignore: decorator
|
|
8
|
-
@external("packs", "decode")
|
|
9
|
-
export declare function decode(blob: blobref): packref
|
|
10
|
-
|
|
11
|
-
// @ts-ignore: decorator
|
|
12
|
-
@external("packs", "encode")
|
|
13
|
-
export declare function encode(pack: packref): blobref
|
|
14
|
-
|
|
15
6
|
// @ts-ignore: decorator
|
|
16
7
|
@external("packs", "concat")
|
|
17
8
|
export declare function concat(left: packref, right: packref): packref
|
package/src/mods/storage/mod.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { textref } from "../mod";
|
|
2
2
|
|
|
3
3
|
export namespace storage {
|
|
4
4
|
|
|
5
5
|
// @ts-ignore: decorator
|
|
6
6
|
@external("storage", "get")
|
|
7
|
-
export declare function get(key:
|
|
7
|
+
export declare function get<T>(key: textref): T;
|
|
8
8
|
|
|
9
9
|
// @ts-ignore: decorator
|
|
10
10
|
@external("storage", "set")
|
|
11
|
-
export declare function set(key:
|
|
11
|
+
export declare function set<T>(key: textref, value: T): void;
|
|
12
12
|
|
|
13
13
|
}
|
package/src/mods/texts/mod.ts
CHANGED
|
@@ -4,24 +4,6 @@ export type textref = externref
|
|
|
4
4
|
|
|
5
5
|
export namespace texts {
|
|
6
6
|
|
|
7
|
-
export function fromString(string: string): textref {
|
|
8
|
-
const utf8 = String.UTF8.encode(string)
|
|
9
|
-
|
|
10
|
-
const blob = blobs.save(utf8)
|
|
11
|
-
const text = fromUtf8(blob)
|
|
12
|
-
|
|
13
|
-
return text
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export function toString(text: textref): string {
|
|
17
|
-
const blob = toUtf8(text)
|
|
18
|
-
const utf8 = blobs.load(blob)
|
|
19
|
-
|
|
20
|
-
const string = String.UTF8.decode(utf8)
|
|
21
|
-
|
|
22
|
-
return string
|
|
23
|
-
}
|
|
24
|
-
|
|
25
7
|
// @ts-ignore: decorator
|
|
26
8
|
@external("texts", "length")
|
|
27
9
|
export declare function length(text: textref): i32
|
|
@@ -62,4 +44,22 @@ export namespace texts {
|
|
|
62
44
|
@external("texts", "trim")
|
|
63
45
|
export declare function trim(text: textref): textref
|
|
64
46
|
|
|
47
|
+
export function fromString(string: string): textref {
|
|
48
|
+
const utf8 = String.UTF8.encode(string)
|
|
49
|
+
|
|
50
|
+
const blob = blobs.save(utf8)
|
|
51
|
+
const text = fromUtf8(blob)
|
|
52
|
+
|
|
53
|
+
return text
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export function toString(text: textref): string {
|
|
57
|
+
const blob = toUtf8(text)
|
|
58
|
+
const utf8 = blobs.load(blob)
|
|
59
|
+
|
|
60
|
+
const string = String.UTF8.decode(utf8)
|
|
61
|
+
|
|
62
|
+
return string
|
|
63
|
+
}
|
|
64
|
+
|
|
65
65
|
}
|