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

Method groupByPackage

deps/npm/lib/utils/allow-scripts-cmd.js:227–245  ·  view source on GitHub ↗
(nodes)

Source from the content-addressed store, hash-verified

225 }
226
227 groupByPackage (nodes) {
228 const groups = {}
229 for (const node of nodes) {
230 const key = nameKeyFor(node)
231 /* istanbul ignore if: callers prefilter via inBundle and trustedDisplay so untrusted nodes don't reach here */
232 if (!key) {
233 log.warn(
234 this.logTitle,
235 `skipping ${node.name || '<unknown>'}: no trusted identity for policy key`
236 )
237 continue
238 }
239 if (!groups[key]) {
240 groups[key] = []
241 }
242 groups[key].push(node)
243 }
244 return groups
245 }
246
247 async writePolicyChanges (groups) {
248 const pin = this.npm.config.get('allow-scripts-pin') !== false

Callers 2

runAllMethod · 0.95
runPositionalMethod · 0.95

Calls 3

nameKeyForFunction · 0.85
warnMethod · 0.80
pushMethod · 0.45

Tested by

no test coverage detected