fixed search tests

This commit is contained in:
zadam
2020-12-15 15:09:00 +01:00
parent 3a12181a57
commit 96eff4c410
7 changed files with 27 additions and 21 deletions

View File

@@ -133,6 +133,16 @@ class Note {
return !!this.attributes.find(attr => attr.type === type && attr.name === name);
}
getAttributeCaseInsensitive(type, name, value) {
name = name.toLowerCase();
value = value ? value.toLowerCase() : null;
return this.attributes.find(
attr => attr.type === type
&& attr.name.toLowerCase() === name
&& (!value || attr.value.toLowerCase() === value));
}
getLabelValue(name) {
const label = this.attributes.find(attr => attr.type === 'label' && attr.name === name);