in src/component/transform/sortTransform.ts [104:167]
each(orderExprList, function (orderExpr) {
const dimLoose = orderExpr.dimension;
const order = orderExpr.order;
const parserName = orderExpr.parser;
const incomparable = orderExpr.incomparable;
if (dimLoose == null) {
if (__DEV__) {
errMsg = 'Sort transform config must has "dimension" specified.' + sampleLog;
}
throwError(errMsg);
}
if (order !== 'asc' && order !== 'desc') {
if (__DEV__) {
errMsg = 'Sort transform config must has "order" specified.' + sampleLog;
}
throwError(errMsg);
}
if (incomparable && (incomparable !== 'min' && incomparable !== 'max')) {
let errMsg = '';
if (__DEV__) {
errMsg = 'incomparable must be "min" or "max" rather than "' + incomparable + '".';
}
throwError(errMsg);
}
if (order !== 'asc' && order !== 'desc') {
let errMsg = '';
if (__DEV__) {
errMsg = 'order must be "asc" or "desc" rather than "' + order + '".';
}
throwError(errMsg);
}
const dimInfo = upstream.getDimensionInfo(dimLoose);
if (!dimInfo) {
if (__DEV__) {
errMsg = makePrintable(
'Can not find dimension info via: ' + dimLoose + '.\n',
'Existing dimensions: ', upstream.cloneAllDimensionInfo(), '.\n',
'Illegal config:', orderExpr, '.\n'
);
}
throwError(errMsg);
}
const parser = parserName ? getRawValueParser(parserName) : null;
if (parserName && !parser) {
if (__DEV__) {
errMsg = makePrintable(
'Invalid parser name ' + parserName + '.\n',
'Illegal config:', orderExpr, '.\n'
);
}
throwError(errMsg);
}
orderDefList.push({
dimIdx: dimInfo.index,
parser: parser,
comparator: new SortOrderComparator(order, incomparable)
});
});