json: if-json-null combinator, in the same vein as if-zero, if-empty, etc.
parent
0844e138fb
commit
78486f0d80
|
|
@ -1,7 +1,15 @@
|
|||
USING: kernel vocabs.loader ;
|
||||
IN: json
|
||||
USE: vocabs.loader
|
||||
|
||||
SINGLETON: json-null
|
||||
|
||||
: if-json-null ( x if-null else -- )
|
||||
[ dup json-null? ]
|
||||
[ [ drop ] prepose ]
|
||||
[ ] tri* if ; inline
|
||||
|
||||
: when-json-null ( x if-null -- ) [ ] if-json-null ; inline
|
||||
: unless-json-null ( x else -- ) [ ] swap if-json-null ; inline
|
||||
|
||||
"json.reader" require
|
||||
"json.writer" require
|
||||
|
|
|
|||
Loading…
Reference in New Issue