@unction/pairskeys

Takes an array of arrays (pairs) and returns the keys


Keywords
unction, functional
License
ICU
Install
npm install @unction/pairskeys@9.13.0

Documentation

@unction/pairsKeys

Tests Stability Dependencies

ListType<[A, B]> => Array | Set

Takes an list that looks like a list of pairs (key, values) and returns all the keys.

Lets say you have this data:

const data = {
  a: 1,
  b: 2,
  c: 3,
}

And you turn it into pairs:

const pairings = toPairs(data)

You would end up with this:

[
  ['a', 1],
  ['b', 2],
  ['c', 3],
]

Now you just want the keys:

pairsKeys(pairings)

You would get the following:

[
  'a',
  'b',
  'c',
]