Skip to content

unctionjs/keyChainTree

Repository files navigation

@unction/keyChainTree

Tests Stability Dependencies

Record<string | number | symbol, B> | Map<A, B> => Array<KeyChainType>

Takes a tree and returns all keychains for that tree. Note, it only follows record types (types with keys).

keyChainTree({
  id: "1",
  attributes: {
    name: "Kurtis Rainbolt-Greene",
    age: 24,
  },
  meta: new Map([
    ["version", "1.0.0"],
  ]),
  included: [
    {
      id: "2",
      attributes: {
        name: "Angela Englund",
      },
    },
  ],
})

which would return

[
  ["id"],
  ["attributes", "name"],
  ["attributes", "age"],
  ["meta", "version"],
  ["included"],
]