UNPKG

parse-node-args

Version:
34 lines (28 loc) 628 B
"use strict"; exports.__esModule = true; exports.default = void 0; var _flags = require("./flags"); /** * @description * Extracts out nodejs flags from a list of arguments. * * @param {string[]} args The arguments list to look through (usually process.argv.slice(2) for cli's). */ function parse(args) { const cliArgs = []; const nodeArgs = []; for (const arg of args) { if (_flags.NODE_FLAGS.test(arg)) { nodeArgs.push(arg); } else { cliArgs.push(arg); } } return { cliArgs, nodeArgs }; } module.exports = exports = parse; var _default = parse; exports.default = _default;