Skip to content

varargs parameter signature #711

@alturkovic

Description

@alturkovic

There is currently support for the following:

    + - one or more arguments of this type
        E.g. $zip has signature <a+>; it accepts one array, or two arrays, or three arrays, or...
    ? - optional argument
        E.g. $join has signature <a<s>s?:s>; it accepts an array of strings and an optional joiner string which defaults to the empty string. It returns a string.
    - - if this argument is missing, use the context value ("focus").
        E.g. $length has signature <s-:n>; it can be called as $length(OrderID) (one argument) but equivalently as OrderID.$length().

Is it possible to define a signature that accepts 0 or more json types (varargs)? I want to support something like:

expression.registerFunction("myFunction", (...args) => ..., "?")

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @mattbaileyuk@alturkovic

        Issue actions

          varargs parameter signature · Issue #711 · jsonata-js/jsonata