in src/dataViewTransform.ts [63:95]
export function groupValues(values: DataViewValueColumn[]): DataViewValueColumnGroup[] {
let groups: DataViewValueColumnGroup[] = [],
currentGroup: DataViewValueColumnGroup;
for (let i = 0, len = values.length; i < len; i++) {
let value: DataViewValueColumn = values[i];
if (!currentGroup || currentGroup.identity !== value.identity) {
currentGroup = {
values: []
};
if (value.identity) {
currentGroup.identity = value.identity;
let source: DataViewMetadataColumn = value.source;
// allow null, which will be formatted as (Blank).
if (source.groupName !== undefined) {
currentGroup.name = source.groupName;
} else if (source.displayName) {
currentGroup.name = source.displayName;
}
}
groups.push(currentGroup);
}
currentGroup.values.push(value);
}
return groups;
}