(option)
| 2083 | // The calling code does not know whether a negated option is the source of the |
| 2084 | // value, so do some work to take an educated guess. |
| 2085 | const findBestOptionFromValue = (option) => { |
| 2086 | const optionKey = option.attributeName(); |
| 2087 | const optionValue = this.getOptionValue(optionKey); |
| 2088 | const negativeOption = this.options.find( |
| 2089 | (target) => target.negate && optionKey === target.attributeName(), |
| 2090 | ); |
| 2091 | const positiveOption = this.options.find( |
| 2092 | (target) => !target.negate && optionKey === target.attributeName(), |
| 2093 | ); |
| 2094 | if ( |
| 2095 | negativeOption && |
| 2096 | ((negativeOption.presetArg === undefined && optionValue === false) || |
| 2097 | (negativeOption.presetArg !== undefined && |
| 2098 | optionValue === negativeOption.presetArg)) |
| 2099 | ) { |
| 2100 | return negativeOption; |
| 2101 | } |
| 2102 | return positiveOption || option; |
| 2103 | }; |
| 2104 | |
| 2105 | const getErrorMessage = (option) => { |
| 2106 | const bestOption = findBestOptionFromValue(option); |
nothing calls this directly
no test coverage detected