change approach again

This commit is contained in:
2018-05-09 14:31:22 +02:00
parent 54a933c83a
commit 0686e02b75
2252 changed files with 864743 additions and 270 deletions

35
node_modules/command-line-args/lib/grouped-output.js generated vendored Normal file
View File

@@ -0,0 +1,35 @@
'use strict'
const arrayify = require('array-back')
const Output = require('./output')
class GroupedOutput extends Output {
toObject () {
const superOutput = super.toObject()
delete superOutput._unknown
const grouped = {
_all: superOutput
}
if (this.unknown.length) grouped._unknown = this.unknown
this.definitions.whereGrouped().forEach(def => {
const outputValue = this.output[def.name]
for (const groupName of arrayify(def.group)) {
grouped[groupName] = grouped[groupName] || {}
if (outputValue && outputValue.isDefined()) {
grouped[groupName][def.name] = outputValue.value
}
}
})
this.definitions.whereNotGrouped().forEach(def => {
const outputValue = this.output[def.name]
if (outputValue && outputValue.isDefined()) {
if (!grouped._none) grouped._none = {}
grouped._none[def.name] = outputValue.value
}
})
return grouped
}
}
module.exports = GroupedOutput