(raw)
| 4 | // package.json / .npmrc layer (in lib/utils/resolve-allow-scripts.js) so |
| 5 | // both paths agree on quoting, whitespace, and duplicate handling. |
| 6 | const 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 | |
| 23 | module.exports = parseAllowScriptsList |
no test coverage detected