Expand description
Read plain data out of Dataform JavaScript without running it.
Mirrors kumosql.js_literals: strings, arrays and objects written as literals, the exports of a
module, require bindings and loop substitution. Anything computed is reported as computed
(JsValue::Expression in lenient parsing, None in strict parsing), never guessed.
Enums§
- JsValue
- A JavaScript value read from source text.
Functions§
- local_
constants - Literal
constvalues defined once in this file. - module_
exports - What a module offers a
require:{"": whole export, "name": member}, literals only. - parse_
complete - Like
parse_literal, but the literal must end its expression ([...].map(f)is not one). - parse_
lenient - Parse a value leniently: comments are skipped, trailing commas and unquoted keys allowed, and
anything computed becomes
JsValue::Expression. Returns the value and where it ends. - parse_
literal - Parse one literal value at byte
index(strings, arrays, objects, numbers, booleans, null):(value, end), orNonewhen the value is computed or malformed. - required_
bindings - Names this file binds from
require:const x = require("m")andconst { a, b } = require("m"). A name bound more than once is left out. - resolve_
module - The exports of
require(spec)from the project-relative filefrom_file, if known. - source_
items - The items a loop ranges over when
expressionis a literal array, a name inscopeorname.member;Nonewhen unknown. - strip_
comments textwithout//and/* */comments (string contents are left alone).- substitute
configwith the loop variable replaced by this item’s literals;Nonewhen a member is missing or not a string, or the variable is still used afterwards.