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

Function getArgs

scripts/util.js:45–56  ·  view source on GitHub ↗
(allArgs)

Source from the content-addressed store, hash-verified

43// for spawn, allow a flat array of arguments where the
44// the last arg can optionally be an options object
45const getArgs = (allArgs) => {
46 let args = allArgs.flat().filter(Boolean)
47 let opts = {}
48
49 const last = args[args.length - 1]
50 if (typeof last === 'object') {
51 args = args.slice(0, -1)
52 opts = last
53 }
54
55 return { args, opts }
56}
57
58const spawn = async (cmd, ...allArgs) => {
59 const {

Callers 3

help.jsFile · 0.85
spawnFunction · 0.85
util.jsFile · 0.85

Calls 2

filterMethod · 0.80
flatMethod · 0.80

Tested by

no test coverage detected