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

Function parseAllowScriptsList

workspaces/config/lib/parse-allow-scripts-list.js:6–21  ·  view source on GitHub ↗
(raw)

Source from the content-addressed store, hash-verified

4// package.json / .npmrc layer (in lib/utils/resolve-allow-scripts.js) so
5// both paths agree on quoting, whitespace, and duplicate handling.
6const parseAllowScriptsList = (raw) => {
7 const parts = []
8 const entries = Array.isArray(raw) ? raw : (typeof raw === 'string' ? [raw] : [])
9 for (const entry of entries) {
10 if (typeof entry !== 'string') {
11 continue
12 }
13 for (const part of entry.split(',')) {
14 const trimmed = part.trim()
15 if (trimmed) {
16 parts.push(trimmed)
17 }
18 }
19 }
20 return parts
21}
22
23module.exports = parseAllowScriptsList

Callers 2

policyFromSourcesFunction · 0.85
flattenFunction · 0.85

Calls 1

pushMethod · 0.80

Tested by

no test coverage detected