UNPKG

knip

Version:

Find and fix unused dependencies, exports and files in your TypeScript and JavaScript projects

13 lines (12 loc) 490 B
import parseArgs from 'minimist'; export const resolve = (_binary, args, options) => { const { fromArgs, manifestScriptNames } = options; const parsed = parseArgs(args, { '--': true }); const [command, script] = parsed._; const _childArgs = parsed['--'] && parsed['--'].length > 0 ? fromArgs(parsed['--']) : []; if (command === 'exec') return _childArgs; if (command === 'run' && manifestScriptNames.has(script)) return _childArgs; return []; };