(arg)
| 17 | // semver. npm-package-arg handles dotted and scoped names; fall back to the |
| 18 | // raw string as the name if it can't be parsed. |
| 19 | const parsePositional = (arg) => { |
| 20 | let parsed |
| 21 | try { |
| 22 | parsed = npa(arg) |
| 23 | } catch { |
| 24 | return { name: arg, range: null } |
| 25 | } |
| 26 | const name = parsed.name || arg |
| 27 | if (parsed.type === 'version' || parsed.type === 'range') { |
| 28 | const spec = parsed.fetchSpec |
| 29 | const range = (!spec || spec === '*' || parsed.rawSpec === '' || parsed.rawSpec === '*') |
| 30 | ? null |
| 31 | : spec |
| 32 | return { name, range } |
| 33 | } |
| 34 | return { name, range: null } |
| 35 | } |
| 36 | |
| 37 | // Shared implementation for `npm approve-scripts` and `npm deny-scripts`. |
| 38 | // Subclasses set `verb` to `'approve'` or `'deny'`. |
no outgoing calls
no test coverage detected
searching dependent graphs…