RPG Dice RollerRPG Dice Roller
Home
Guide
API
  • Contributing
  • Code of Conduct
GitHub
Home
Guide
API
  • Contributing
  • Code of Conduct
GitHub
  • API

    • Introduction
    • ComparePoint
    • Description
    • DiceRoll
    • DiceRoller
    • RollGroup
  • dice

    • FudgeDice
    • PercentileDice
    • StandardDice
  • exceptions

    • CompareOperatorError
    • DataFormatError
    • DieActionValueError
    • NotationError
    • RequiredArgumentError
  • modifiers

    • ComparisonModifier
    • CriticalFailureModifier
    • CriticalSuccessModifier
    • DropModifier
    • ExplodeModifier
    • KeepModifier
    • MaxModifier
    • MinModifier
    • Modifier
    • ReRollModifier
    • SortingModifier
    • TargetModifier
    • UniqueModifier
    • modifier-flags
  • parser

    • Parser
  • results

    • ResultGroup
    • RollResult
    • RollResults
  • traits

    • HasDescription
  • utilities

    • ExportFormats
    • NumberGenerator
    • math
    • utils

ComparePoint

ComparePoint

A ComparePoint object compares numbers against each other. For example, is 6 greater than 3, or is 8 equal to 10.

Kind: global class

  • ComparePoint
    • new ComparePoint(operator, value)
    • instance
      • .operator
      • .operator ⇒ string
      • .value
      • .value ⇒ number
      • .isMatch(value) ⇒ boolean
      • .toJSON() ⇒ Object
      • .toString() ⇒ string
    • static
      • .isValidOperator(operator) ⇒ boolean

new ComparePoint(operator, value)

Create a ComparePoint instance.

Throws:

  • CompareOperatorError operator is invalid
  • RequiredArgumentError operator and value are required
  • TypeError value must be numeric
ParamTypeDescription
operatorstringThe comparison operator (One of =, !=, <>, <, >, <=, >=)
valuenumberThe value to compare to

comparePoint.operator

Set the comparison operator.

Kind: instance property of ComparePoint
Throws:

  • CompareOperatorError operator is invalid
ParamTypeDescription
operatorstringOne of =, !=, <>, <, >, <=, >=

comparePoint.operator ⇒ string

The comparison operator.

Kind: instance property of ComparePoint

comparePoint.value

Set the value.

Kind: instance property of ComparePoint
Throws:

  • TypeError value must be numeric
ParamType
valuenumber

comparePoint.value ⇒ number

The comparison value

Kind: instance property of ComparePoint

comparePoint.isMatch(value) ⇒ boolean

Check whether value matches the compare point

Kind: instance method of ComparePoint
Returns: boolean - true if it is a match, false otherwise

ParamTypeDescription
valuenumberThe number to compare

comparePoint.toJSON() ⇒ Object

Return an object for JSON serialising.

This is called automatically when JSON encoding the object.

Kind: instance method of ComparePoint

comparePoint.toString() ⇒ string

Return the String representation of the object.

This is called automatically when casting the object to a string.

Kind: instance method of ComparePoint

ComparePoint.isValidOperator(operator) ⇒ boolean

Check if the operator is valid.

Kind: static method of ComparePoint
Returns: boolean - true if the operator is valid, false otherwise

ParamType
operatorstring
Edit this page
Last Updated: 07/02/2026, 21:45
Prev
Introduction
Next
Description