OperatorTerm

OperatorTerm

A type of RollTerm used to denote and perform an arithmetic operation.

Constructor

new OperatorTerm()

Extends

Members

_evaluated :boolean

Overrides:

An internal flag for whether the term has been evaluated

Type:
  • boolean

expression :string

Overrides:

A string representation of the formula expression for this RollTerm, prior to evaluation.

Type:
  • string

flavor :string

Overrides:

Optional flavor text which modifies and describes this term.

Type:
  • string

FLAVOR_REGEXP :RegExp

Overrides:

A regular expression which identifies term-level flavor text

Type:

FLAVOR_REGEXP_STRING :string

Overrides:

A regular expression pattern which identifies optional term-level flavor text

Type:
  • string

formula :string

Overrides:

A string representation of the formula, including optional flavor text.

Type:
  • string

isDeterministic :boolean

Overrides:

Whether this term is entirely deterministic or contains some randomness.

Type:
  • boolean

isIntermediate :boolean

Overrides:

Is this term intermediate, and should be evaluated first as part of the simplification process?

Type:
  • boolean

OPERATORS :Array.<string>

An array of operators which represent arithmetic operations

Type:

options :object

Overrides:

An object of additional options which describes and modifies the term.

Type:
  • object

REGEXP :RegExp

Overrides:

A regular expression used to match a term of this type

Type:

SERIALIZE_ATTRIBUTES :Array.<string>

Overrides:

An array of additional attributes which should be retained when the term is serialized

Type:

total :number|string

Overrides:

A string or numeric representation of the final output for this term, after evaluation.

Type:
  • number | string

Methods

evaluate(optionsopt) → {RollTerm}

Overrides:

Evaluate the term, processing its inputs and finalizing its total.

Parameters:
Name Type Attributes Default Description
options object <optional>
{}

Options which modify how the RollTerm is evaluated

Properties
Name Type Attributes Default Description
minimize boolean <optional>
false

Minimize the result, obtaining the smallest possible value.

maximize boolean <optional>
false

Maximize the result, obtaining the largest possible value.

async boolean <optional>
false

Evaluate the term asynchronously, receiving a Promise as the returned value. This will become the default behavior in version 10.x

Returns:

The evaluated RollTerm

Type
RollTerm

toJSON() → {object}

Overrides:

Serialize the RollTerm to a JSON string which allows it to be saved in the database or embedded in text. This method should return an object suitable for passing to the JSON.stringify function.

Returns:
Type
object