Skip to content

Latest commit

 

History

History
104 lines (85 loc) · 2.73 KB

math.md

File metadata and controls

104 lines (85 loc) · 2.73 KB

math

Registers the methods of the module math in microTasks.

math~math.add([Numbers]) ⇒ 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

math~math.divide([Numbers]) ⇒ 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

math~math.multiply([Numbers]) ⇒ 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

math~math.operate(operation, [args]) ⇒ 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

math~math.substract([Numbers]) ⇒ 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