Find first setting
This commit is contained in:
parent
1b6a846102
commit
43bc873bcb
|
@ -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