This commit is contained in:
Luke Barnard 2017-06-23 17:35:07 +01:00
parent 004d4828f8
commit 89afcfd897
7 changed files with 23 additions and 17 deletions

View file

@ -14,13 +14,15 @@ class KeyMap {
export default class QueryMatcher {
/**
* Given an array of objects and keys, returns a KeyMap
* @param {object[]} objects the objects to perform a match on
* @param {string[]} keys an array of keys within each object to match on
* Keys can refer to object properties by name and as in JavaScript (for nested properties)
*
* To use, simply presort objects by required criteria, run through this function and create a QueryMatcher with the
* resulting KeyMap.
*
* TODO: Handle arrays and objects (Fuse did this, RoomProvider uses it)
* @return {KeyMap}
*/
static valuesToKeyMap(objects: Array<Object>, keys: Array<String>): KeyMap {
const keyMap = new KeyMap();