Looking to work with an array of JavaScript objects, each containing three fields:
var people = [
{first: "john", middle: "james", last: "doe"},
{first: "jane", middle: "kate", last: "smith"},
...
{first: "kathy", middle: "rose", last: "green"},
];
The goal is to query this array based on any field and receive the matching object as output. For example, being able to execute people.getByMiddle("kate")
and retrieve
{first: "jane", middle: "kate", last: "smith"}
Wondering if there's a data structure that simplifies associating these elements or if it's better to create individual functions for each field to iterate over the data and search for matches. The primary concern is avoiding dependency on array ordering.