Skip to main content

Class: Function_

Function represents a resolver provided by a Module.

A function always evaluates against a parent object and is given a set of named arguments.

Extends​

  • BaseClient

Constructors​

Constructor​

new Function_(ctx?, _id?, _description?, _name?): Function_

Constructor is used for internal usage only, do not create object from it.

Parameters​

ctx?​

Context

_id?​

FunctionID

_description?​

string

_name?​

string

Returns​

Function_

Overrides​

BaseClient.constructor

Methods​

args()​

args(): Promise<FunctionArg[]>

Arguments accepted by the function, if any.

Returns​

Promise<FunctionArg[]>


description()​

description(): Promise<string>

A doc string for the function, if any.

Returns​

Promise<string>


id()​

id(): Promise<FunctionID>

A unique identifier for this Function.

Returns​

Promise<FunctionID>


name()​

name(): Promise<string>

The name of the function.

Returns​

Promise<string>


returnType()​

returnType(): TypeDef

The type returned by the function.

Returns​

TypeDef


sourceMap()​

sourceMap(): SourceMap

The location of this function declaration.

Returns​

SourceMap


with()​

with(arg): Function_

Call the provided function with current Function.

This is useful for reusability and readability by not breaking the calling chain.

Parameters​

arg​

(param) => Function_

Returns​

Function_


withArg()​

withArg(name, typeDef, opts?): Function_

Returns the function with the provided argument

Parameters​

name​

string

The name of the argument

typeDef​

TypeDef

The type of the argument

opts?​

FunctionWithArgOpts

Returns​

Function_


withDescription()​

withDescription(description): Function_

Returns the function with the given doc string.

Parameters​

description​

string

The doc string to set.

Returns​

Function_


withSourceMap()​

withSourceMap(sourceMap): Function_

Returns the function with the given source map.

Parameters​

sourceMap​

SourceMap

The source map for the function definition.

Returns​

Function_