UNPKG
diamante-js-xdr
Version:
latest (1.0.1)
1.0.1
Read/write XDR encoded data structures (RFC 4506)
github.com/diamcircle/js-xdr
diamcircle/js-xdr
diamante-js-xdr
/
examples
/
linked_list.js
14 lines
(10 loc)
•
304 B
JavaScript
View Raw
1
2
3
4
5
6
7
8
9
10
11
12
13
14
import
*
as
XDR
from
'../src'
;
let
xdr =
XDR
.
config
(
(
xdr
) =>
{ xdr.
struct
(
'IntList'
, [ [
'value'
, xdr.
int
()], [
'rest'
, xdr.
option
(xdr.
lookup
(
'IntList'
))] ]); });
let
n1 =
new
xdr.
IntList
({
value
:
1
});
let
n2 =
new
xdr.
IntList
({
value
:
3
,
rest
: n1 });
console
.
log
(n2.
toXDR
());