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[];
|
tags: TagType[];
|
||||||
map: Map<string, TagType[]>;
|
map: Map<string, TagType[]>;
|
||||||
constructor(tags: TagType[]);
|
constructor(tags: TagType[]);
|
||||||
|
getByName(name: string): TagType;
|
||||||
getByElementName(element: string): TagType | undefined;
|
getByElementName(element: string): TagType | undefined;
|
||||||
}
|
}
|
||||||
export {};
|
export {};
|
||||||
Vendored
+5
@@ -143,6 +143,11 @@ class TagCollection {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
getByName(name) {
|
||||||
|
return this.tags.filter(t => {
|
||||||
|
t.constructor.name == name;
|
||||||
|
})[0] || undefined;
|
||||||
|
}
|
||||||
getByElementName(element) {
|
getByElementName(element) {
|
||||||
const el = element.toUpperCase();
|
const el = element.toUpperCase();
|
||||||
return this.tags.filter(t => {
|
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 {
|
getByElementName(element: string): TagType | undefined {
|
||||||
const el = element.toUpperCase();
|
const el = element.toUpperCase();
|
||||||
return this.tags.filter(t => {
|
return this.tags.filter(t => {
|
||||||
|
|||||||
Reference in new issue
Block a user