@Cards-TS
    Preparing search index...

    A class for the rank of a card like 'TWO' or 'KING'

    Index

    Properties

    char: string
    order: number

    The internal ordering of this rank

    type: "rank" = 'rank'
    value: number
    ACE: Rank = ...
    EIGHT: Rank = ...
    FIVE: Rank = ...
    FOUR: Rank = ...
    JACK: Rank = ...
    JOKER: Rank = ...
    KING: Rank = ...
    NINE: Rank = ...
    QUEEN: Rank = ...
    ranks: Rank[] = ...

    All of the ranks that are possible for cards

    SEVEN: Rank = ...
    SIX: Rank = ...
    TEN: Rank = ...
    THREE: Rank = ...
    TWO: Rank = ...

    Methods

    • Tells how far apart two ranks are based on the inner values

      Note that jokers and twos are accepted by the function but the result is not defined

      Parameters

      • other: Rank

        the other rank

      Returns number

      the signed difference between the ranks

      Rank.distance

      KING.difference(JACK)
      > -2
    • Gets the rank that is above or below this one by a certain amount

      Parameters

      • i: number

        how much to displace this rank by

      Returns Rank

      the displaced rank

    • Tells how far apart two ranks are based on the inner value of the ranks Note that jokers and twos are accepted by the function but the result is not defined

      Parameters

      • other: Rank

        the other rank

      Returns number

      the unsigned (abs) distance between the ranks

      Rank.difference

      KING.distance(JACK)
      > 2
    • Tells how far apart two ranks are based on the inner values Note that jokers and twos are accepted by the function but the result is not defined

      Parameters

      • one: Rank

        the first rank

      • two: Rank

        the second rank

      Returns number

      the signed difference between the ranks

      Rank.distance

      difference(JACK, KING)
      > 2
    • Tells how far apart two ranks are based on the inner value of the ranks Note that jokers and twos are accepted by the function but the result is not defined

      Parameters

      • one: Rank

        the first rank

      • two: Rank

        the second rank

      Returns number

      the unsigned (abs) distance between the ranks

      Rank.difference

      distance(JACK, KING)
      > 2
    • Looks up a rank based on an object Since the order field is an internal representation, this is not guaranteed to be stable between versions

      Parameters

      • obj: any

        the object to convert from

      Returns Rank

      the corresponding rank