- js_expression(+Expression)// is det
- Emit a single JSON argument. Expression is one of:
- Variable
-
Emitted as Javascript
null
- List
-
Produces a Javascript list, where each element is processed
by this library.
object(Attributes)
-
Where Attributes is a Key-Value list where each pair can be
written as Key-Value, Key=Value or Key(Value), accomodating
all common constructs for this used in Prolog.
$ { K:V, ... }
Same as
object(Attributes)
, providing a more JavaScript-like
syntax. This may be useful if the object appears literally
in the source-code, but is generally less friendlyto produce
as a result from a computation.
- Dict
-
Emit a dict as a JSON object using json_write_dict/3.
json(Term)
-
Emits a term using json_write/3.
- @(Atom)
-
Emits these constants without quotes. Normally used for the
symbols
true
, false
and null
, but can also be use for
emitting JavaScript symbols (i.e. function- or variable
names).
- Number
-
Emited literally
symbol(Atom)
-
Synonym for @(Atom). Deprecated.
- Atom or String
-
Emitted as quoted JavaScript string.