interface Comparable

interface Comparable

lib/comparable.tya:2

Comparable provides the comparable standard library API.

Source
# Comparable provides the comparable standard library API.
interface Comparable
  # compare provides the comparable API operation.
  # @param other Any other value.
  # @return Any the resulting value.
  compare: other ->
  # lt? provides the comparable API operation.
  # @param other Any other value.
  # @return Boolean the resulting value.
  lt?: other ->
    self.compare(other) < 0
  # lte? provides the comparable API operation.
  # @param other Any other value.
  # @return Boolean the resulting value.
  lte?: other ->
    self.compare(other) <= 0
  # gt? provides the comparable API operation.
  # @param other Any other value.
  # @return Boolean the resulting value.
  gt?: other ->
    self.compare(other) > 0
  # gte? provides the comparable API operation.
  # @param other Any other value.
  # @return Boolean the resulting value.
  gte?: other ->
    self.compare(other) >= 0
  # between? provides the comparable API operation.
  # @param min Int min value.
  # @param max Int max value.
  # @return Boolean the resulting value.
  between?: min, max ->
    self.gte?(min) and self.lte?(max)

Methods

between?

Comparable.between?(min, max)

lib/comparable.tya:31

between? provides the comparable API operation.

Source
  # between? provides the comparable API operation.
  # @param min Int min value.
  # @param max Int max value.
  # @return Boolean the resulting value.
  between?: min, max ->
    self.gte?(min) and self.lte?(max)

compare

Comparable.compare(other)

lib/comparable.tya:6

compare provides the comparable API operation.

Source
  # compare provides the comparable API operation.
  # @param other Any other value.
  # @return Any the resulting value.
  compare: other ->

gt?

Comparable.gt?(other)

lib/comparable.tya:20

gt? provides the comparable API operation.

Source
  # gt? provides the comparable API operation.
  # @param other Any other value.
  # @return Boolean the resulting value.
  gt?: other ->
    self.compare(other) > 0

gte?

Comparable.gte?(other)

lib/comparable.tya:25

gte? provides the comparable API operation.

Source
  # gte? provides the comparable API operation.
  # @param other Any other value.
  # @return Boolean the resulting value.
  gte?: other ->
    self.compare(other) >= 0

lt?

Comparable.lt?(other)

lib/comparable.tya:10

lt? provides the comparable API operation.

Source
  # lt? provides the comparable API operation.
  # @param other Any other value.
  # @return Boolean the resulting value.
  lt?: other ->
    self.compare(other) < 0

lte?

Comparable.lte?(other)

lib/comparable.tya:15

lte? provides the comparable API operation.

Source
  # lte? provides the comparable API operation.
  # @param other Any other value.
  # @return Boolean the resulting value.
  lte?: other ->
    self.compare(other) <= 0