diff options
| author | Adam Mathes <adam@adammathes.com> | 2026-02-14 14:46:37 -0800 |
|---|---|---|
| committer | Adam Mathes <adam@adammathes.com> | 2026-02-14 14:46:37 -0800 |
| commit | afa87af01c79a9baa539f2992d32154d2a4739bd (patch) | |
| tree | 92c7416db734270a2fee1d72ee9cc119379ff8e1 /vanilla/node_modules/istanbul-reports/lib/html-spa/src/getChildData.js | |
| parent | 3b927e84d200402281f68181cd4253bc77e5528d (diff) | |
| download | neko-afa87af01c79a9baa539f2992d32154d2a4739bd.tar.gz neko-afa87af01c79a9baa539f2992d32154d2a4739bd.tar.bz2 neko-afa87af01c79a9baa539f2992d32154d2a4739bd.zip | |
task: delete vanilla js prototype\n\n- Removed vanilla/ directory and web/dist/vanilla directory\n- Updated Makefile, Dockerfile, and CI workflow to remove vanilla references\n- Cleaned up web/web.go to remove vanilla embed and routes\n- Verified build and tests pass\n\nCloses NK-2tcnmq
Diffstat (limited to 'vanilla/node_modules/istanbul-reports/lib/html-spa/src/getChildData.js')
| -rw-r--r-- | vanilla/node_modules/istanbul-reports/lib/html-spa/src/getChildData.js | 155 |
1 files changed, 0 insertions, 155 deletions
diff --git a/vanilla/node_modules/istanbul-reports/lib/html-spa/src/getChildData.js b/vanilla/node_modules/istanbul-reports/lib/html-spa/src/getChildData.js deleted file mode 100644 index eff5d31..0000000 --- a/vanilla/node_modules/istanbul-reports/lib/html-spa/src/getChildData.js +++ /dev/null @@ -1,155 +0,0 @@ -function addPath(node, parentPath) { - if (!parentPath) { - return node; - } - return { ...node, file: parentPath + '/' + node.file }; -} - -function flatten(nodes, parentPath) { - let children = []; - for (let i = 0; i < nodes.length; i++) { - const child = nodes[i]; - if (child.children) { - children = [ - ...children, - ...flatten( - child.children, - (parentPath ? parentPath + '/' : '') + child.file - ) - ]; - } else { - children.push(addPath(child, parentPath)); - } - } - return children; -} - -function filterByFile(nodes, fileFilter, parentPath) { - let children = []; - - for (let i = 0; i < nodes.length; i++) { - const child = nodes[i]; - const childFullPath = (parentPath ? parentPath + '/' : '') + child.file; - - const isChildUnderFilter = - fileFilter === childFullPath || - fileFilter.indexOf(childFullPath + '/') === 0; - const isChildAboveFilter = - childFullPath.indexOf(fileFilter + '/') === 0; - - if (isChildUnderFilter) { - // flatten and continue looking underneath - children = [ - ...children, - ...filterByFile(child.children, fileFilter, childFullPath) - ]; - } else if (isChildAboveFilter) { - // remove the parent path and add everything underneath - const charsToRemoveFromFile = - fileFilter.length - (parentPath ? parentPath.length : 0); - let childFilename = child.file.slice(charsToRemoveFromFile); - if (childFilename[0] === '/') { - childFilename = childFilename.slice(1); - } - children.push({ - ...child, - file: childFilename - }); - } - } - return children; -} - -function sort(childData, activeSort) { - const top = activeSort.order === 'asc' ? 1 : -1; - const bottom = activeSort.order === 'asc' ? -1 : 1; - childData.sort((a, b) => { - let valueA; - let valueB; - if (activeSort.sortKey === 'file') { - valueA = a.file; - valueB = b.file; - } else { - const [metricType, valueType] = activeSort.sortKey.split('.'); - valueA = a.metrics[metricType][valueType]; - valueB = b.metrics[metricType][valueType]; - } - - if (valueA === valueB) { - return 0; - } - return valueA < valueB ? top : bottom; - }); - - for (let i = 0; i < childData.length; i++) { - const child = childData[i]; - if (child.children) { - childData[i] = { - ...child, - children: sort(child.children, activeSort) - }; - } - } - return childData; -} - -function filter(nodes, metricsMap, activeFilters) { - const children = []; - for (let i = 0; i < nodes.length; i++) { - let child = nodes[i]; - if (child.children) { - const newSubChildren = filter( - child.children, - metricsMap, - activeFilters - ); - if (newSubChildren.length) { - child = { ...child, children: newSubChildren }; - children.push(child); - } - } else { - if ( - (metricsMap.statements && - activeFilters[child.metrics.statements.classForPercent]) || - (metricsMap.branches && - activeFilters[child.metrics.branches.classForPercent]) || - (metricsMap.functions && - activeFilters[child.metrics.functions.classForPercent]) || - (metricsMap.lines && - activeFilters[child.metrics.lines.classForPercent]) - ) { - children.push(child); - } - } - } - return children; -} - -module.exports = function getChildData( - sourceData, - metricsToShow, - activeSort, - isFlat, - activeFilters, - fileFilter -) { - let childData = sourceData.children; - - if (isFlat) { - childData = flatten(childData.slice(0)); - } - - if (fileFilter) { - childData = filterByFile(childData, fileFilter); - } - - if (activeFilters.low) { - activeFilters = { ...activeFilters, empty: true }; - } - childData = filter(childData, metricsToShow, activeFilters); - - if (activeSort) { - childData = sort(childData, activeSort); - } - return childData; -}; |
