# GC.Spread.CalcEngine.Functions.Function

## Content

# Class: Function

[CalcEngine](../modules/GC.Spread.CalcEngine).[Functions](../modules/GC.Spread.CalcEngine.Functions).Function

## Hierarchy

- **`Function`**

  ↳ [`AsyncFunction`](GC.Spread.CalcEngine.Functions.AsyncFunction)

## Table of contents

### Constructors

- [constructor](GC.Spread.CalcEngine.Functions.Function#constructor)

### Properties

- [maxArgs](GC.Spread.CalcEngine.Functions.Function#maxargs)
- [minArgs](GC.Spread.CalcEngine.Functions.Function#minargs)
- [name](GC.Spread.CalcEngine.Functions.Function#name)
- [typeName](GC.Spread.CalcEngine.Functions.Function#typename)

### Methods

- [acceptsArray](GC.Spread.CalcEngine.Functions.Function#acceptsarray)
- [acceptsError](GC.Spread.CalcEngine.Functions.Function#acceptserror)
- [acceptsMissingArgument](GC.Spread.CalcEngine.Functions.Function#acceptsmissingargument)
- [acceptsReference](GC.Spread.CalcEngine.Functions.Function#acceptsreference)
- [description](GC.Spread.CalcEngine.Functions.Function#description)
- [evaluate](GC.Spread.CalcEngine.Functions.Function#evaluate)
- [findBranchArgument](GC.Spread.CalcEngine.Functions.Function#findbranchargument)
- [findTestArgument](GC.Spread.CalcEngine.Functions.Function#findtestargument)
- [isBranch](GC.Spread.CalcEngine.Functions.Function#isbranch)
- [isContextSensitive](GC.Spread.CalcEngine.Functions.Function#iscontextsensitive)
- [isVolatile](GC.Spread.CalcEngine.Functions.Function#isvolatile)

## Constructors

### <a id="constructor" name="constructor"></a> constructor

• **new Function**(`name?`, `minArgs?`, `maxArgs?`, `description?`)

Represents an abstract base class for defining functions.

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `name?` | `string` | The name of the function. |
| `minArgs?` | `number` | The minimum number of arguments for the function. |
| `maxArgs?` | `number` | The maximum number of arguments for the function. |
| `description?` | [`IFunctionDescription`](../interfaces/GC.Spread.CalcEngine.Functions.IFunctionDescription) | - |

## Properties

### <a id="maxargs" name="maxargs"></a> maxArgs

• **maxArgs**: `number`

Represents the maximum number of arguments for the function.

___

### <a id="minargs" name="minargs"></a> minArgs

• **minArgs**: `number`

Represents the minimum number of arguments for the function.

___

### <a id="name" name="name"></a> name

• **name**: `string`

Represents the name of the function.

___

### <a id="typename" name="typename"></a> typeName

• **typeName**: `string`

Represents the type name string used for supporting serialization.

## Methods

### <a id="acceptsarray" name="acceptsarray"></a> acceptsArray

▸ **acceptsArray**(`argIndex`): `boolean`

Determines whether the function accepts array values for the specified argument.

**`function`**

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `argIndex` | `number` | Index of the argument. |

#### Returns

`boolean`

`true` if the function accepts array values for the specified argument; otherwise, `false`.

___

### <a id="acceptserror" name="acceptserror"></a> acceptsError

▸ **acceptsError**(`argIndex`): `boolean`

Indicates whether the function can process Error values.

**`function`**

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `argIndex` | `number` | Index of the argument. |

#### Returns

`boolean`

`true` if the function can process Error values for the specified argument; otherwise, `false`.

___

### <a id="acceptsmissingargument" name="acceptsmissingargument"></a> acceptsMissingArgument

▸ **acceptsMissingArgument**(`argIndex`): `boolean`

Indicates whether the Evaluate method can process missing arguments.

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `argIndex` | `number` | Index of the argument |

#### Returns

`boolean`

`true` if the Evaluate method can process missing arguments; otherwise, `false`.

___

### <a id="acceptsreference" name="acceptsreference"></a> acceptsReference

▸ **acceptsReference**(`argIndex`): `boolean`

Determines whether the function accepts Reference values for the specified argument.

**`function`**

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `argIndex` | `number` | Index of the argument. |

#### Returns

`boolean`

`true` if the function accepts Reference values for the specified argument; otherwise, `false`.

___

### <a id="description" name="description"></a> description

▸ **description**(): [`IFunctionDescription`](../interfaces/GC.Spread.CalcEngine.Functions.IFunctionDescription)

Returns the description of the function.

**`function`**

#### Returns

[`IFunctionDescription`](../interfaces/GC.Spread.CalcEngine.Functions.IFunctionDescription)

The description of the function.

___

### <a id="evaluate" name="evaluate"></a> evaluate

▸ **evaluate**(...`args`): `any`

Returns the result of the function applied to the arguments.

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `...args` | `any` | Arguments for the function evaluation |

#### Returns

`any`

The result of the function applied to the arguments.

___

### <a id="findbranchargument" name="findbranchargument"></a> findBranchArgument

▸ **findBranchArgument**(`test`): `number`

Finds the branch argument.

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `test` | `any` | The test. |

#### Returns

`number`

Indicates the index of the argument that would be treated as the branch condition.

___

### <a id="findtestargument" name="findtestargument"></a> findTestArgument

▸ **findTestArgument**(): `number`

Finds the test argument when this function is branched.

#### Returns

`number`

Indicates the index of the argument that would be treated as the test condition.

___

### <a id="isbranch" name="isbranch"></a> isBranch

▸ **isBranch**(): `boolean`

Gets a value that indicates whether this function is branched by arguments as conditional.

#### Returns

`boolean`

`true` if this instance is branched; otherwise, `false`.

___

### <a id="iscontextsensitive" name="iscontextsensitive"></a> isContextSensitive

▸ **isContextSensitive**(): `boolean`

Determines whether the evaluation of the function is dependent on the context in which the evaluation occurs.

#### Returns

`boolean`

`true` if the evaluation of the function is dependent on the context; otherwise, `false`.

___

### <a id="isvolatile" name="isvolatile"></a> isVolatile

▸ **isVolatile**(): `boolean`

Determines whether the function is volatile while it is being evaluated.

#### Returns

`boolean`

`true` if the function is volatile; otherwise, `false`.
