Builds an inverse index, retaining every row that shares a projected key.
import { readTableIndex, tableKey } from '@datamoc/mw_games/mwl';const rows = [{ item: 'potion', effect: 'heal' }, { item: 'herb', effect: 'heal' }];const byEffect = readTableIndex(rows, { key: 'effect' });console.log(byEffect.get(tableKey('heal'))?.length); // 2 Copy
import { readTableIndex, tableKey } from '@datamoc/mw_games/mwl';const rows = [{ item: 'potion', effect: 'heal' }, { item: 'herb', effect: 'heal' }];const byEffect = readTableIndex(rows, { key: 'effect' });console.log(byEffect.get(tableKey('heal'))?.length); // 2
Builds an inverse index, retaining every row that shares a projected key.