forked from public/foundryvtt-reve-de-dragon
Amélioration de la recherche dans un milieu
- gestion correcte de la case - recherche insensitive - correction de la liste des milieux à ajouter dans la feuille - si aucun milieu ne correspond à la recherche, affiche la liste des milieux disponibles
This commit is contained in:
@ -72,6 +72,19 @@ export class Misc {
|
||||
}
|
||||
}
|
||||
|
||||
static indexLowercase(list) {
|
||||
const obj = {};
|
||||
const addToObj = (map, val) => {
|
||||
const key = Grammar.toLowerCaseNoAccent(val);
|
||||
if (key && !map[key]) map[key] = val
|
||||
}
|
||||
list.forEach(it => addToObj(obj, it))
|
||||
return obj;
|
||||
}
|
||||
static concat(lists) {
|
||||
return lists.reduce((a, b) => a.concat(b), []);
|
||||
}
|
||||
|
||||
static classify(items, classifier = it => it.type) {
|
||||
let itemsBy = {}
|
||||
Misc.classifyInto(itemsBy, items, classifier)
|
||||
|
Reference in New Issue
Block a user