Registers the methods of the module math in microTasks.
number
number
number
number
number
number
number
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 = 6
number
Returns: 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 = 4
number
Returns: 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 = 24
number
Returns: 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 = 1
number
Returns: 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 = 1
number
Returns: 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