* Normalizes server arg keys from schema names to parser destination names. * * This mutates and returns the same object.
(obj: T)
| 110 | * This mutates and returns the same object. |
| 111 | */ |
| 112 | static normalizeServerArgs<T extends LooseArgsMap>(obj: T): T { |
| 113 | const mutableObj = obj as LooseArgsMap; |
| 114 | for (const spec of getAllArgSpecs().values()) { |
| 115 | if (!spec.extType && mutableObj[spec.name] !== undefined && spec.rawDest !== spec.name) { |
| 116 | mutableObj[spec.rawDest] = mutableObj[spec.name] ?? mutableObj[spec.rawDest]; |
| 117 | delete mutableObj[spec.name]; |
| 118 | } |
| 119 | } |
| 120 | return obj; |
| 121 | } |
| 122 | |
| 123 | /** |
| 124 | * Given an object full of arguments as returned by `argparser.parse_args`, |
no outgoing calls
no test coverage detected