MCPcopy
hub / github.com/tj/commander.js / valueFromOption

Method valueFromOption

lib/option.js:297–305  ·  view source on GitHub ↗

* Did the value come from the option, and not from possible matching dual option? * * @param {*} value * @param {Option} option * @returns {boolean}

(value, option)

Source from the content-addressed store, hash-verified

295 * @returns {boolean}
296 */
297 valueFromOption(value, option) {
298 const optionKey = option.attributeName();
299 if (!this.dualOptions.has(optionKey)) return true;
300
301 // Use the value to deduce if (probably) came from the option.
302 const preset = this.negativeOptions.get(optionKey).presetArg;
303 const negativeValue = preset !== undefined ? preset : false;
304 return option.negate === (negativeValue === value);
305 }
306}
307
308/**

Callers 2

_parseOptionsImpliedMethod · 0.95

Calls 1

attributeNameMethod · 0.80

Tested by

no test coverage detected