Merge branch 'master' into settings

This commit is contained in:
Samuel Elliott 2018-03-04 21:45:40 +00:00
commit d32959b8b9
1 changed files with 11 additions and 0 deletions

View File

@ -101,6 +101,17 @@ export default class SettingsSet {
return false;
}
/**
* Return the first setting that matches the id in any category
*/
findFirst(settingId) {
for (let cat of this.categories) {
const found = cat.settings.find(s => s.id === settingId);
if (found) return found;
}
return null;
}
/**
* Returns the first category where calling {function} returns true.
* @param {Function} function A function to call to filter categories