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
new Function_()
new Function_(
ctx
?,_id
?,_description
?,_name
?):Function_
Constructor is used for internal usage only, do not create object from it.
Parameters
ctx?
Context
_id?
_description?
string
_name?
string
Returns
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
sourceMap()
sourceMap():
SourceMap
The location of this function declaration.
Returns
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
withArg()
withArg(
name
,typeDef
,opts
?):Function_
Returns the function with the provided argument
Parameters
name
string
The name of the argument
typeDef
The type of the argument
opts?
Returns
withDescription()
withDescription(
description
):Function_
Returns the function with the given doc string.
Parameters
description
string
The doc string to set.
Returns
withSourceMap()
withSourceMap(
sourceMap
):Function_
Returns the function with the given source map.
Parameters
sourceMap
The source map for the function definition.