@novasamatech/scale 0.5.4-9 → 0.5.4
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 +3 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -38,7 +38,7 @@ const bytes = fromHex("0xff0080");
|
|
|
38
38
|
|
|
39
39
|
### Nullable
|
|
40
40
|
|
|
41
|
-
Codec for nullable values (null
|
|
41
|
+
Codec for nullable values (null -> _void mapping).
|
|
42
42
|
|
|
43
43
|
```typescript
|
|
44
44
|
import { Nullable } from '@novasamatech/scale';
|
|
@@ -46,10 +46,10 @@ import { u32 } from 'scale-ts';
|
|
|
46
46
|
|
|
47
47
|
const nullableCodec = Nullable(u32);
|
|
48
48
|
|
|
49
|
-
// Encode null as
|
|
49
|
+
// Encode null as _void
|
|
50
50
|
const encoded = nullableCodec.enc(null);
|
|
51
51
|
|
|
52
|
-
// Decode
|
|
52
|
+
// Decode _void as null
|
|
53
53
|
const decoded = nullableCodec.dec(encoded);
|
|
54
54
|
// Result: null
|
|
55
55
|
```
|