@ag1/tuple

key-value tuple

Usage no npm install needed!

<script type="module">
  import ag1Tuple from 'https://cdn.skypack.dev/@ag1/tuple';
</script>

README

Tuple Utils

Node.js CI

Mimic tuple behavior of other language [key, val].

Functions

toObject<T>(tuple: IKeyValTuple<T> | IKeyValTuple<T>[]): T

type fooType = { a: string; b: string };

const tupleList: IKeyValTuple<fooType>[] = [['a', 'a'], ['b', 'b']];

expect(toObject(tupleList)).toEqual({ a: 'a', b: 'b' });