MCPcopy Create free account
hub / github.com/npm/cli / humanOutput

Function humanOutput

lib/commands/ls.js:510–525  ·  view source on GitHub ↗
({ chalk, result, seenItems, unicode })

Source from the content-addressed store, hash-verified

508const sortAlphabetically = ({ pkgid: a }, { pkgid: b }) => localeCompare(a, b)
509
510const humanOutput = ({ chalk, result, seenItems, unicode }) => {
511 // 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)
512 // here is where we put items in their expected place for archy output
513 for (const item of seenItems) {
514 if (item[_include] && item[_parent]) {
515 item[_parent].nodes.push(item)
516 }
517 }
518
519 if (!result.nodes.length) {
520 result.nodes = ['(empty)']
521 }
522
523 const archyOutput = archy(result, '', { unicode })
524 return chalk.reset(archyOutput)
525}
526
527const jsonOutput = ({ path, problems, result, rootError, seenItems }) => {
528 if (problems.size) {

Callers 1

execMethod · 0.85

Calls 2

pushMethod · 0.80
resetMethod · 0.45

Tested by

no test coverage detected