Skip to content

@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

processes/interface.ts:305


cates

cates: string[]

Function category

One function can correspond to multiple categories

Source

processes/interface.ts:311


input

input: VarInfo[]

Function input parameters

Source

processes/interface.ts:281


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

processes/interface.ts:293


isVarLen

isVarLen: boolean

Whether the parameter is of variable length

The variable length type is the type of the last input

Source

processes/interface.ts:287


label

label: string

Function display name

Source

processes/interface.ts:271


name

name: string

Function name

Source

processes/interface.ts:267


note?

optional note: string

Function description

Support html tags

Source

processes/interface.ts:277


output

output: VarGuard

Function return qualification

Source

processes/interface.ts:297