I am trying to create a count function that I can include in all of my objects. In my 'core' file, Prisma is this. So I can do things like this.user.count() or this.company.count()
I have tried creating a function called count like this
count(dataType) {
return this['dataType'].count()
}
So that from every other place in the app, I could just call count('dataType').
My function is actually a good bit more complex - as all this work for a one-line to one-line replacement wouldn't make sense, but this is the idea. No way I've tried works - is this possible?