summaryrefslogtreecommitdiff
path: root/app/lib/json/common.hoon
diff options
context:
space:
mode:
authorpolwex <polwex@sortug.com>2025-10-06 01:01:41 +0700
committerpolwex <polwex@sortug.com>2025-10-06 01:01:41 +0700
commitc4b392a179048f936c062f5ffccc2bc25627e500 (patch)
tree09be0904be8ec4d7ea52992ef7580d42ed0c28c1 /app/lib/json/common.hoon
working
Diffstat (limited to 'app/lib/json/common.hoon')
-rw-r--r--app/lib/json/common.hoon30
1 files changed, 30 insertions, 0 deletions
diff --git a/app/lib/json/common.hoon b/app/lib/json/common.hoon
new file mode 100644
index 0000000..0ed54cd
--- /dev/null
+++ b/app/lib/json/common.hoon
@@ -0,0 +1,30 @@
+/+ sr=sortug
+|%
+++ en
+=, enjs:format
+ |%
+ ++ cord |= s=@t ^- json s+s
+ ++ hex |= h=@ux ^- json
+ =/ scoww scow:sr
+ [%s (crip (scoww(min-chars 64) %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)
+ --
+
+--