MCPcopy Create free account
hub / github.com/nodejs/node / humanOutput

Function humanOutput

deps/npm/lib/commands/ls.js:526–541  ·  view source on GitHub ↗
({ chalk, result, seenItems, unicode })

Source from the content-addressed store, hash-verified

524const sortAlphabetically = ({ pkgid: a }, { pkgid: b }) => localeCompare(a, b)
525
526const humanOutput = ({ chalk, result, seenItems, unicode }) => {
527 // we need to traverse the entire tree in order to determine which items should be included (since a nested transitive included dep will make it so that all its ancestors should be displayed)
528 // here is where we put items in their expected place for archy output
529 for (const item of seenItems) {
530 if (item[_include] && item[_parent]) {
531 item[_parent].nodes.push(item)
532 }
533 }
534
535 if (!result.nodes.length) {
536 result.nodes = ['(empty)']
537 }
538
539 const archyOutput = archy(result, '', { unicode })
540 return chalk.reset(archyOutput)
541}
542
543const jsonOutput = ({ path, problems, result, rootError, seenItems }) => {
544 if (problems.size) {

Callers 1

execMethod · 0.85

Calls 2

pushMethod · 0.45
resetMethod · 0.45

Tested by

no test coverage detected