There is aJavaScript object. I want to have a method to dynamically generate an object grouped by one or more attributes. The parameter attrs is an array, which contains some attributes for grouping.