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

Method query

lib/utils/queryable.js:232–254  ·  view source on GitHub ↗
(queries, opts)

Source from the content-addressed store, hash-verified

230 }
231
232 query (queries, opts) {
233 // this ugly interface here is meant to be a compatibility layer with the legacy API lib/view.js is consuming
234 // if at some point we refactor that command then we can revisit making this nicer
235 if (queries === Queryable.ALL) {
236 return { [Queryable.ALL]: this.#data }
237 }
238
239 const q = query =>
240 getter({
241 data: this.#data,
242 key: query,
243 }, opts)
244
245 if (Array.isArray(queries)) {
246 let res = {}
247 for (const query of queries) {
248 res = { ...res, ...q(query) }
249 }
250 return res
251 } else {
252 return q(queries)
253 }
254 }
255
256 // return the value for a single query if found; otherwise, returns undefined
257 get (query) {

Callers 14

getMethod · 0.95
showFieldsFunction · 0.95
retrieveSpecsMethod · 0.45
getNodesMethod · 0.45
getMethod · 0.45
execMethod · 0.45
queryable.jsFile · 0.45
mockOidcFunction · 0.45
searchMethod · 0.45
getPackageMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected