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 | 4x 4x 73x 73x 73x 228x 228x 228x 7x 2x 5x 1x 4x 2x 2x 73x 4x 1x | const {invalidDefaultValues} = require('../errors') const setDefaultValues = ({errs = [], opts: OPTS = []} = {}) => { let args = {_: []} let errs2 = [] for (let i = 0; i < OPTS.length; i++) { const opt = OPTS[i] const {key, types, values, defaultValues} = opt if (typeof values === 'undefined' && typeof defaultValues !== 'undefined') { if (!Array.isArray(types)) { args[key] = defaultValues } else if (types.length === 0 && typeof defaultValues === 'object' && isFlag(defaultValues)) { args[key] = defaultValues } else if (Array.isArray(defaultValues) && types.length === defaultValues.length) { args[key] = defaultValues.length === 1 ? defaultValues[0] : defaultValues } else { errs2.push(invalidDefaultValues({defaultValues, option: opt})) } } } return {errs: errs.concat(errs2), args} } module.exports = { setDefaultValues } function isFlag ({type, count}) { return type === 'flag' && typeof count === 'number' } |