@blockchaincommons/envelope - v1.0.0-beta.4
    Preparing search index...

    Class Expression

    A function with its parameters: the expression envelope whose subject is the function leaf and whose assertions are the parameters (parameter: argument), as the reference's Expression holds its function and envelope.

    Parameters are assertions, so the same parameter may appear several times (objectsForParameter returns every argument) and every assertion, parameter or not, survives a round trip through an envelope.

    Implements

    Index
    • get parameters(): Parameter[]

      The parameters of the expression, each carrying its argument as paramValue: every assertion whose predicate decodes as a parameter (#6.40007(id)), in the envelope's order. An assertion whose predicate is not a parameter is skipped. A TypeScript convenience: the reference reads parameters one at a time through object_for_parameter.

      Returns Parameter[]

    • Reads an expression from an envelope (the reference's Expression::try_from((envelope, expected_function))): the subject is extracted as a function and the envelope is kept as it is, so assertions that are not parameters survive a round trip.

      Parameters

      Returns Expression

      EnvelopeError Cbor with the reference's dcbor Display as its message: invalid format when the subject is not a leaf, dcbor error: <reason> when the leaf is not a function (dcbor error: invalid function, dcbor error: expected CBOR tag function, but got 40007), and Expected function <expected>, but found <found> (the reference's Debug renderings) when expectedFunction is given and differs

    • The reference's Display: the expression's format string, quoted and escaped (write!(f, "{:?}", self.envelope.format())); JSON.stringify produces the same text for the characters a format string contains.

      Returns string