Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | 1x 302x 302x 302x 302x 102x 102x 302x 102x 102x 302x 100x 897x 897x 897x 302x | module.exports = (options = {}) => {
const {key = null, args = [], types = null, only = null, desc = '', opts = null} = options
const errs = []
const args2 = {}
if (key === null) {
const noArgumentProvidedInOption = {
code: 'No argument provided in option',
msg: "Please provide a key (e.g. [{key: 'foo', ...}])",
info: {options}
}
errs.push(noArgumentProvidedInOption)
}
if (args === null || args.length === 0) {
const noArgumentsProvidedInOption = {
code: 'No arguments provided in option',
msg: "Please provide at least one argument (e.g. [{args: ['--foo'], ...}])",
info: {options}
}
errs.push(noArgumentsProvidedInOption)
}
if (key !== null && args !== null && args.length > 0) {
for (let i = 0; i < args.length; i++) {
const arg = args[i]
if (typeof args2[arg] === 'undefined') args2[arg] = []
args2[arg].push({key, types, only, desc, opts})
}
}
return {errs, args: args2}
} |