Move left pane entirely to React
This commit is contained in:
parent
bf904ddd12
commit
b3ac1373fa
142 changed files with 5016 additions and 3428 deletions
12
ts/util/makeLookup.ts
Normal file
12
ts/util/makeLookup.ts
Normal file
|
@ -0,0 +1,12 @@
|
|||
import { fromPairs, map } from 'lodash';
|
||||
|
||||
export function makeLookup<T>(
|
||||
items: Array<T>,
|
||||
key: string
|
||||
): { [key: string]: T } {
|
||||
// Yep, we can't index into item without knowing what it is. True. But we want to.
|
||||
// @ts-ignore
|
||||
const pairs = map(items, item => [item[key], item]);
|
||||
|
||||
return fromPairs(pairs);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue