add tag.getByname()
This commit is contained in:
1 parent
241f67fb4d
commit
77b68bf272
3 files changed
+12
No files matched your search
Vendored
+1
@@ -32,6 +32,7 @@ export declare class TagCollection implements TagCollectionType {
|
||||
tags: TagType[];
|
||||
map: Map<string, TagType[]>;
|
||||
constructor(tags: TagType[]);
|
||||
getByName(name: string): TagType;
|
||||
getByElementName(element: string): TagType | undefined;
|
||||
}
|
||||
export {};
|
||||
Vendored
+5
@@ -143,6 +143,11 @@ class TagCollection {
|
||||
}
|
||||
}
|
||||
}
|
||||
getByName(name) {
|
||||
return this.tags.filter(t => {
|
||||
t.constructor.name == name;
|
||||
})[0] || undefined;
|
||||
}
|
||||
getByElementName(element) {
|
||||
const el = element.toUpperCase();
|
||||
return this.tags.filter(t => {
|
||||
|
||||
@@ -157,6 +157,12 @@ export class TagCollection implements TagCollectionType {
|
||||
}
|
||||
}
|
||||
|
||||
getByName(name: string) {
|
||||
return this.tags.filter(t => {
|
||||
t.constructor.name == name
|
||||
})[0] || undefined;
|
||||
}
|
||||
|
||||
getByElementName(element: string): TagType | undefined {
|
||||
const el = element.toUpperCase();
|
||||
return this.tags.filter(t => {
|
||||
|
||||
Reference in new issue
Block a user