Function getFromKeys

Returns the first value in data that matches a key from keys.

// Iterate, yielding: `a.b.c.d`, `b.c.d`, `c.d`, `d`
const keys = Text.segmentsFromEnd(`a.b.c.d`);
// Gets first value that matches a key (starting from most precise)
const value = getFromKeys(data, keys);
  • Type Parameters

    • T

    Parameters

    • data: ReadonlyMap<string, T>
    • keys: Iterable<string>

    Returns undefined | T