(transOption, upSourceList, infoForPrint, // If `pipeIndex` is null/undefined, no piped transform.
pipeIndex)
| 21444 | } |
| 21445 | |
| 21446 | function applySingleDataTransform(transOption, upSourceList, infoForPrint, // If `pipeIndex` is null/undefined, no piped transform. |
| 21447 | pipeIndex) { |
| 21448 | var errMsg = ''; |
| 21449 | |
| 21450 | if (!upSourceList.length) { |
| 21451 | if ("development" !== 'production') { |
| 21452 | errMsg = 'Must have at least one upstream dataset.'; |
| 21453 | } |
| 21454 | |
| 21455 | throwError(errMsg); |
| 21456 | } |
| 21457 | |
| 21458 | if (!isObject(transOption)) { |
| 21459 | if ("development" !== 'production') { |
| 21460 | errMsg = 'transform declaration must be an object rather than ' + typeof transOption + '.'; |
| 21461 | } |
| 21462 | |
| 21463 | throwError(errMsg); |
| 21464 | } |
| 21465 | |
| 21466 | var transType = transOption.type; |
| 21467 | var externalTransform = externalTransformMap.get(transType); |
| 21468 | |
| 21469 | if (!externalTransform) { |
| 21470 | if ("development" !== 'production') { |
| 21471 | errMsg = 'Can not find transform on type "' + transType + '".'; |
| 21472 | } |
| 21473 | |
| 21474 | throwError(errMsg); |
| 21475 | } // Prepare source |
| 21476 | |
| 21477 | |
| 21478 | var extUpSourceList = map(upSourceList, function (upSource) { |
| 21479 | return createExternalSource(upSource, externalTransform); |
| 21480 | }); |
| 21481 | var resultList = normalizeToArray(externalTransform.transform({ |
| 21482 | upstream: extUpSourceList[0], |
| 21483 | upstreamList: extUpSourceList, |
| 21484 | config: clone(transOption.config) |
| 21485 | })); |
| 21486 | |
| 21487 | if ("development" !== 'production') { |
| 21488 | if (transOption.print) { |
| 21489 | var printStrArr = map(resultList, function (extSource) { |
| 21490 | var pipeIndexStr = pipeIndex != null ? ' === pipe index: ' + pipeIndex : ''; |
| 21491 | return ['=== dataset index: ' + infoForPrint.datasetIndex + pipeIndexStr + ' ===', '- transform result data:', makePrintable(extSource.data), '- transform result dimensions:', makePrintable(extSource.dimensions)].join('\n'); |
| 21492 | }).join('\n'); |
| 21493 | consoleLog(printStrArr); |
| 21494 | } |
| 21495 | } |
| 21496 | |
| 21497 | return map(resultList, function (result, resultIndex) { |
| 21498 | var errMsg = ''; |
| 21499 | |
| 21500 | if (!isObject(result)) { |
| 21501 | if ("development" !== 'production') { |
| 21502 | errMsg = 'A transform should not return some empty results.'; |
| 21503 | } |
no test coverage detected
searching dependent graphs…