Merge pull request #153 from JsSucks/setting-getters
Find first setting
This commit is contained in:
commit
050118f26c
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue