]> gitweb.factorcode.org Git - factor.git/commitdiff
json: add json-null>f
authorDoug Coleman <doug.coleman@gmail.com>
Mon, 3 Apr 2023 03:42:28 +0000 (22:42 -0500)
committerDoug Coleman <doug.coleman@gmail.com>
Fri, 14 Apr 2023 04:18:02 +0000 (23:18 -0500)
basis/json/json.factor

index 4da7e9c88f25901df447c24acdbcc4cf150547a2..13cced3e8dca08b8f90250a1030f423b29071e8d 100644 (file)
@@ -22,6 +22,9 @@ M: json-fp-special-error summary
     [ [ drop ] prepose ]
     [ ] tri* if ; inline
 
+: json-null>f ( obj/json-null -- obj/f )
+    dup json-null = [ drop f ] when ; inline
+
 : when-json-null ( x if-null -- ) [ ] if-json-null ; inline
 
 : unless-json-null ( x else -- ) [ ] swap if-json-null ; inline