I would like to make a new class that derives from Array that has its own methods in addition to the regular array methods.
export class ObjectCollection<T extends Iidentifier> extends Array<T> {
constructor(collection: T[] = []) {
super(...collection);
}
// used for getting instance from a collection of objects
public getInstance(id: Id) {
return this.find(item => item.Id.toString() === id.toString()) || new
Array<T>();
}
}
I have also have child classes that inherit from that class.
export class TargetCategories extends ObjectCollection<TargetCategory> {
constructor(categories: TargetCategory[] = []) {
super(categories);
}
public getCategoryType(id: Iidentifier): string {
return this[id].Category.length < 2 ? "dummy" : "saved";
}
}
When I instantiate a TargetCategories object, I'm only able to use methods that are in array though. I'm not able to call things like getCategoryType and getInstance.
Firebase Cloud Functions: PubSub, "res.on is not a function"
TypeError: Cannot read properties of undefined (reading 'createMessageComponentCollector')
I download a code of dashboard in codepen: https://codepenio/mr_alien/pen/pNRQxK, but i need this in drupal, so I make the respective changes but I have this issue(the site work but show this issue):
I have 2 database tableOne is for menu name and another is for child menu name
Which is the best way to remove duplicate values from bidimensional array? For example, my array looks like this: