@idealworld/formula-editor v0.6.2 / iwInterface / FunInfo
Interface: FunInfo
Function information
Example
{
name: 'sum',
label: '求和',
note: `获取一组数值的总和。<br/>用法:<span style='color: #529b2e'>SUM(数字1,数字2,...)</span>`,
input: [
{
kind: VarKind.NUMBER,
},
],
isVarLen: true,
isAsync: false,
output: {
kind: VarKind.NUMBER,
},
body: `return Array.from(arguments).reduce((a, b) => a + b)`,
cates: ['常用', '计算'],
}
Properties
body
body:
string
Function body
The function body is a JavaScript structure, which can be a single expression or a block statement When it is a block-level statement, you need to use the return
keyword to return the value Function parameters are called using arguments
Source
cates
cates:
string
[]
Function category
One function can correspond to multiple categories
Source
input
input:
VarInfo
[]
Function input parameters
Source
isAsync
isAsync:
boolean
Whether it is an asynchronous function
Asynchronous functions will be called in the formula in the form of (await <Full name of function>)
Source
isVarLen
isVarLen:
boolean
Whether the parameter is of variable length
The variable length type is the type of the last input
Source
label
label:
string
Function display name
Source
name
name:
string
Function name
Source
note?
optional
note:string
Function description
Support html tags
Source
output
output:
VarGuard
Function return qualification