summaryrefslogtreecommitdiff
path: root/desk/lib/json/common.hoon
blob: 64d4b034a134474fe25bae4606f844761998fb47 (plain)
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
27
28
29
/+  sr=sortug
|%
++  en
=,  enjs:format
  |%
  ++  cord  |=  s=@t   ^-  json  s+s
  ++  hex   |=  h=@ux  ^-  json
    [%s (crip (scow:sr %ux h))]
  ++  b64   |=  h=@uv  ^-  json  
    [%s (crip (scow:sr %uv h))]
  ++  ud    |=  n=@  ^-  json  
    [%s (crip (scow:sr %ud n))]
  ++  patp  |=  p=@p  ^-  json
    [%s (scot %p p)]
  --
++  de
=,  dejs-soft:format
  |%
  ++  hex  |=  jon=json  ^-  (unit @ux)
    ?.  ?=(%s -.jon)  ~
    =/  atom=(unit @)  (slaw:sr %ux p.jon)
    ?~  atom  ~
    atom
  ++  se  |=  aur=@tas  |=  jon=json
    ?.  ?=(%s -.jon)  ~
    (slaw aur p.jon)
  --

--