FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
msgpack-javascript/example/amd-example.js at main · false-spring/msgpack-javascript · GitHub
false-spring
/
msgpack-javascript
Public
forked from
msgpack/msgpack-javascript
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
msgpack-javascript
/
example
/
amd-example.js
Copy path
More file actions
More file actions
Latest commit
History
History
History
26 lines (22 loc) · 715 Bytes
Breadcrumbs
msgpack-javascript
/
example
/
amd-example.js
Copy path
File metadata and controls
26 lines (22 loc) · 715 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
/* eslint-disable no-console */
"use strict"
;
try
{
const
object
=
{
nil
:
null
,
integer
:
1
,
float
:
Math
.
PI
,
string
:
"Hello, world!"
,
binary
:
Uint8Array
.
from
(
[
1
,
2
,
3
]
)
,
array
:
[
10
,
20
,
30
]
,
map
:
{
foo
:
"bar"
}
,
timestampExt
:
new
Date
(
)
,
}
;
document
.
writeln
(
"<p>input:</p>"
)
;
document
.
writeln
(
`<pre><code>
${
JSON
.
stringify
(
object
,
undefined
,
2
)
}
</code></pre>`
)
;
const
encoded
=
MessagePack
.
encode
(
object
)
;
document
.
writeln
(
"<p>output:</p>"
)
;
document
.
writeln
(
`<pre><code>
${
JSON
.
stringify
(
MessagePack
.
decode
(
encoded
)
,
undefined
,
2
)
}
</code></pre>`
)
;
}
catch
(
e
)
{
console
.
error
(
e
)
;
document
.
write
(
`<p style="color: red">
${
e
.
constructor
.
name
}
:
${
e
.
message
}
</p>`
)
;
}
Back
|
FazBrowse Home
|
New Git URL