Registers the methods of the module math in microTasks.
- math
- ~math.add([Numbers]) ⇒
number - ~math.divide([Numbers]) ⇒
number - ~math.multiply([Numbers]) ⇒
number - ~math.operate(operation, [args]) ⇒
number - ~math.parseInt(operation, [args]) ⇒
number - ~math.substract([Numbers]) ⇒
number
- ~math.add([Numbers]) ⇒
Returns: number - Returns the sum of several numbers.
| Name | Type | Description |
|---|---|---|
| [Numbers] | number |
List of numbers. |
Example
microTasks.taskRun([{
method: 'math.add',
params: [1, 2, 3],
resultPath: 'total'
}])
// payload.total = 6Returns: number - Returns the division of several numbers.
| Name | Type | Description |
|---|---|---|
| [Numbers] | number |
List of numbers. |
Example
microTasks.taskRun([{
method: 'math.divide',
params: [24, 3, 2],
resultPath: 'total'
}])
// payload.total = 4Returns: number - Returns the multiplication of several numbers.
| Name | Type | Description |
|---|---|---|
| [Numbers] | number |
List of numbers. |
Example
microTasks.taskRun([{
method: 'math.multiply',
params: [2, 3, 4],
resultPath: 'total'
}])
// payload.total = 24Returns: number - Returns the result of a mathematical operation, using the native library Math.
| Name | Type | Description |
|---|---|---|
| operation | operation |
Numbers. |
| [args] | args |
Arguments of the operation. |
Example
microTasks.taskRun([{
method: 'math.operate',
params: [round, 1.1], // Math.round(1.1)
resultPath: 'total'
}])
// payload.total = 1Returns: number - Returns the number parsed to integer.
| Name | Type | Description |
|---|---|---|
| number | number |
Numbers. |
Example
microTasks.taskRun([{
method: 'math.parseInt',
params: 1.1, // parseInt(1.1)
resultPath: 'total'
}])
// payload.total = 1Returns: number - Returns the subtraction of several numbers.
| Name | Type | Description |
|---|---|---|
| [Numbers] | number |
List of numbers. |
Example
microTasks.taskRun([{
method: 'math.substract',
params: [10, 3, 1],
resultPath: 'total'
}])
// payload.total = 6