Constructor Summary
| Public Constructor | ||
| public |
constructor(values: ...any) |
|
Member Summary
| Public Members | ||
| public |
|
|
Method Summary
| Public Methods | ||
| public |
Returns value from tuple by index. |
|
| public |
Returns all values. |
|
| public |
Returns string representation of tuple. |
|
| public |
Returns string representation of tuple. |
|
| public |
Invokes callback with all values. |
|
Public Constructors
Public Members
public [`_${index + 1}`]: * source
Public Methods
public get(index: number): any source
Returns value from tuple by index.
Params:
| Name | Type | Attribute | Description |
| index | number | Index of tuple argument. |
Example:
const expected = ['Barkley', 'Rosser']
, name = new Tuple(...expected);
name.get(0); // Barkley
name.get(1); // Rosser
public getAll(): Array<any> source
Returns all values.
Example:
const expected = ['Barkley', 'Rosser']
, name = new Tuple(...expected)
, [first, last] = name.getAll();
first // Barkley
last // Rosser
public inspect(): string source
Returns string representation of tuple. NodeJS analog.
Example:
const expected = ['Barkley', 'Rosser']
, name = new Tuple(...expected);
name // (Barkley, Rosser)
public toString(): string source
Returns string representation of tuple.
Example:
const expected = ['Barkley', 'Rosser']
, name = new Tuple(...expected);
name // (Barkley, Rosser)
public unpack(cb: Function) source
Invokes callback with all values.
Params:
| Name | Type | Attribute | Description |
| cb | Function | Callback which accepts all arguments from current tuple. |
Example:
const expected = ['Barkley', 'Rosser']
, name = new Tuple(...expected);
name.unpack((first, last) => {
first // Barkley
last // Rosser
});