UNPKG

weather-cli-nk_sm

Version:
19 lines (18 loc) 500 B
export function getArgs(args = []) { let flag = '-'; const tempArr = []; args.forEach(arg => { if (arg[0] == '-') { if (flag != '-') tempArr.push([flag.slice(1), true]); flag = arg; } else if (flag != '-') { tempArr.push([flag.slice(1), arg]); flag = '-'; } }); if (flag != '-') tempArr.push([flag.slice(1), true]); return Object.fromEntries(tempArr); }