MCPcopy Index your code
hub / github.com/nodejs/node / runPositional

Method runPositional

deps/npm/lib/utils/allow-scripts-cmd.js:170–188  ·  view source on GitHub ↗
(args, arb)

Source from the content-addressed store, hash-verified

168 }
169
170 async runPositional (args, arb) {
171 const { matched, unmatched } = this.findNodesForArgs(args, arb)
172 if (unmatched.length > 0) {
173 throw Object.assign(
174 new Error(`No installed packages match: ${unmatched.join(', ')}`),
175 { code: 'ENOMATCH' }
176 )
177 }
178 const groups = this.groupByPackage(matched)
179 /* istanbul ignore if: matched is non-empty here; groups only empties when a
180 matched node has no trusted key, which groupByPackage already warns on */
181 if (Object.keys(groups).length === 0) {
182 throw Object.assign(
183 new Error(`No installed packages match: ${args.join(', ')}`),
184 { code: 'ENOMATCH' }
185 )
186 }
187 await this.writePolicyChanges(groups)
188 }
189
190 findNodesForArgs (args, arb) {
191 // Match positional args against each node's trusted name. Registry deps

Callers 1

execMethod · 0.95

Calls 6

findNodesForArgsMethod · 0.95
groupByPackageMethod · 0.95
writePolicyChangesMethod · 0.95
assignMethod · 0.80
keysMethod · 0.65
joinMethod · 0.45

Tested by

no test coverage detected