Home Reference Source Test
public class | source

SafeTupleBuilder

Creates safe type tuple.

Example:

const expected = ['Barkley', 'Rosser']
    , StringPair = SafeTupleBuilder.of(String, String)
    , name = new StringPair(...expected)
    , [first, last] = name.getAll();

   first // Barkley
   last // Rosser

   name.unpack((first, last) => {
     first // Barkley
     last // Rosser
   });

   name.get(0); // Barkley
   name.get(1) // Rosser

Test:

Static Method Summary

Static Public Methods
public static

of(types: ...any): Tuple

Creates Safe Type Tuple.

Static Public Methods

public static of(types: ...any): Tuple source

Creates Safe Type Tuple.

Params:

NameTypeAttributeDescription
types ...any

Types which will be checked in newly created tuples.

Return:

Tuple

Returns Safe Tuple.

Example:

const StringPair = SafeTupleBuilder.of(String, String);