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

Function locationRank

lib/commands/query.js:7–12  ·  view source on GitHub ↗
(node)

Source from the content-addressed store, hash-verified

5// Ranks competing representations of the same physical package so the most logical one is reported.
6// A top-level placement (e.g. node_modules/<pkg>) beats the canonical store node, which beats an internal store symlink.
7const locationRank = (node) => {
8 if (!node.location.includes('node_modules/.store/')) {
9 return 2
10 }
11 return node.isLink ? 0 : 1
12}
13
14class QuerySelectorItem {
15 constructor (node) {

Callers 1

#queryTreeMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected