Hello,
I am interested to know what kind of global custom helpers people use.
Maybe it can inspire some1 or we can discuss good patterns for them.
As I am not sure if my helpers are best way how to accomplish what I need.
So these are my:
firstThree - simple first 3 items from array
firstFour - simple first 4 items from array
sortByNum - math based sort above array of objects based on parameters itemProperty and ascending/descending
sortByStr - same as above for strings
Most of these I use with combination of some expand button to show all results if needed.
But as querying subdocument arrays (or keeping them ordered in DB and than using slice) is such pain, I decided to most of the time send whole array and do these operations on client.
These are usually denormalized data attached to current user viewed document consisting of minimal amount of info to show them.