Javascript object to do complex queries into array of objects in a simple way!