Just chase the first pair of return conditions with a second pair of return conditions.
public sortByRowDataLength(data): CircleTimelineDataModel {
return data.headers.sort((yin, yang) => {
if (yin.rowData.length < yang.rowData.length) {
return 1;
}
if (yin.rowData.length > yang.rowData.length) {
return -1;
}
if (yin.label > yang.label) {
return 1;
}
if (yin.label < yang.label) {
return -1;
}
return 0;
});
}
No comments:
Post a Comment