Implement orderBy(arr, keys, dirs)
Write a stable, multi-key sort: orderBy(arr, keys, dirs) sorts a copy of arr by keys (an array of property names, or functions) in order, the first key breaks the most ties, the second breaks ties within that, and so on. dirs is a parallel array of "asc"/"desc" (defaults to "asc").
Stability matters: items that compare equal on every key must keep their original relative order.
orderBy(
[{ name: "Bob", age: 30 }, { name: "Alice", age: 30 }, { name: "Zoe", age: 20 }],
["age", "name"],
["asc", "asc"]
);
// [{ name: "Zoe", age: 20 }, { name: "Alice", age: 30 }, { name: "Bob", age: 30 }]