Class: Tuple

types~ Tuple

A tuple is a sequence of immutable objects. Tuples are sequences, just like Arrays. The only difference is that tuples can't be changed.

As tuples can be used as a Map keys, the toString() method calls toString of each element, to try to get a unique string key.

Constructor

new Tuple(argumentsopt)

Creates a new sequence of immutable objects with the parameters provided.
Parameters:
Name Type Attributes Description
arguments <optional>
The sequence elements as arguments.

Members

length :Number

Returns the number of the elements.
Type:
  • Number

Methods

(static) fromArray(elements) → {Tuple}

Creates a new instance of a tuple based on the Array
Parameters:
Name Type Description
elements Array
Returns:
Type
Tuple

get(index)

Returns the value located at the index.
Parameters:
Name Type Description
index Number Element index

toJSON() → {Array}

Returns the Array representation of the sequence.
Returns:
Type
Array

toString() → {string}

Returns the string representation of the sequence surrounded by parenthesis, ie: (1, 2).

The returned value attempts to be a unique string representation of its values.

Returns:
Type
string

values() → {Array}

Gets the elements as an array
Returns:
Type
Array